1. Scans
  2. Create Scans

Scans

Create Scans

You can create s scan via API or the Vision SDK. While the Vision SDk will do the network requests for you, the responses from this document will remain the same.

New Scan

POST `/v1/scans`

To create a new scan, you'll need to pass the image as a base64 encoded data URL or public web URL. There's a soft cap of about 7.5MB per image for the base64 URI.

You're also able to specify what type of image the parser is looking at, so it can better extract data accurately.

js
const data = {
  image_url: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASA...", //truncated
  type: "shipping_label", //other options are "manifest", "item", and "invoice"
  parse_address: false, //Will run the address parser on any addresses that are extracted
  location_id: null, //You an optionally pass the location ID to later filter scans by location
  metadata: {}, //custom key value pairs you can add to the scans object
};

const res = await fetch("https://api.packagex.io/v1/scans", {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
});

const scan = response.data;