1. Inferences
  2. Item Labels Inference

Inferences

Item Labels Inference

You can have the inference via the API or the vision-SDK while the vision-SDK will do the network request for you, the responses from this document will remain the same.

New Inference

POST
`/v0/ai/inferences/images/item-labels`

To create a new inference for item labels, 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 URL.

You're also able to specify what type of image the parser is looking at, so it can better extract data accurately along with other helpful information listed below:

image string (required)
Base64 encoded image.

barcode_values Array.<String>
Any existing values you've already extracted from the barcode.

For example,

js
        const data = {
  image: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASA...", //truncated
  location_id: null, //You an optionally pass the location ID to later filter scans by location
};

const res = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels", {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

const scan = response.data;

      

List Item Label Inferences

GET
`/v0/ai/inferences/images/item-labels`

Retrieve a paginated list of Item Label inferences for your organization. Results are returned in descending order by default, meaning the most recently created inference appears first.

Query Parameters

Parameter Type Description
page Number The page number for pagination. Defaults to 1.
limit Number The number of results per page. Defaults to 10.
order_by String The field to order results by. Supported value: created_at. Defaults to created_at.
direction String Sort direction. Can be asc or desc. Defaults to asc.
location_id String Filter inferences by a specific location ID.
statuses String Comma-separated list of statuses to filter by. Possible values include inferring, inferred, matched, completed, canceled, error, inference_error.
search String A search term to perform full-text search across inferences. Minimum 2 characters, maximum 255 characters.
search_strategy String The search matching strategy. Can be match_some or match_all.
metadata Object Filter by metadata key-value pairs.

Pagination

The response includes a pagination object. If has_more is true, there are additional inferences not yet returned. Use the page and limit query parameters to paginate through results. The total_count property returns the total number of inferences matching your query.

js
        const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels?page=1&limit=25", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const inferences = response.data;
const pagination = response.pagination;

      

Filtering by Location

js
        const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels?location_id=loc_abc123", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const inferences = response.data;

      

Filtering by Status

js
        const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels?statuses=completed,inferred", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const inferences = response.data;

      

Retrieve Item Label Inference

GET
`/v0/ai/inferences/images/item-labels/:inference_id`

Retrieve a single Item Label inference by its ID.

Parameter Type Description
inference_id String The ID of the Item Label inference to retrieve. Must start with inf_il_.
js
        const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels/inf_il_abc123", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const scan = response.data;

      

Update Item Label Inference

POST
`/v0/ai/inferences/images/item-labels/:inference_id`

Update an existing Item Label inference. You can modify the inferred data, set the status, or update metadata. At least one property must be provided in the request body.

Parameter Type Description
inference_id String The ID of the Item Label inference to update. Must start with inf_il_.

Body Parameters

Parameter Type Description
status String Set the inference status. Allowed values: completed, canceled. completed can only be set on inferred or matched statuses. canceled can only be set on error status.
metadata Object Custom key-value metadata to attach to the inference. Set to null to clear all metadata.
inference Object The inference data to update. At least one property is required within this object.
Inference Object Properties
Parameter Type Description
supplier Object Supplier contact details (name, email, phone, business, contact_id, address).
sender Object Sender contact details.
transit Object Transit/middle-mile contact details.
recipient Object Recipient contact details.
customer Object Customer details.
customer.sku String Customer SKU. Max 255 characters.
item Object Item details extracted from the label.
item.sku String Item SKU. Max 255 characters.
item.name String Item name. Max 255 characters.
item.numbers Array.<String> Item numbers. Set to null to clear.
item.quantity Number Item quantity. Must be a non-negative integer.
item.dimensions Object Item dimensions with length, width, height sub-objects (each with value and unit).
item.weight Object Item weight with value and unit.
item.volume Object Item volume with value and unit.
item.color String Item color. Max 255 characters.
item.model String Item model. Max 255 characters.
item.upc String Universal Product Code. Max 255 characters.
item.gtin String Global Trade Item Number. Max 255 characters.
item.version String Item version. Max 255 characters.
item.season String Item season. Max 255 characters.
item.mac_address String MAC address. Max 255 characters.
package Object Package-level measurements.
package.dimensions Object Package dimensions with length, width, height sub-objects.
package.weight Object Package weight with value and unit.
package.volume Object Package volume with value and unit.
pallet Object Pallet details.
pallet.id String Pallet ID. Max 255 characters.
pallet.number String Pallet number. Max 255 characters.
carton Object Carton details.
carton.number String Carton number. Max 255 characters.
lot Object Lot details.
lot.number String Lot number. Max 255 characters.
barcode_values Array.<String> Barcode values. Set to null to clear.
purchase_orders Array.<String> Purchase order numbers. Set to null to clear.
sales_orders Array.<String> Sales order numbers. Set to null to clear.
serial_numbers Array.<String> Serial numbers. Set to null to clear.
origin Object Origin details.
origin.country String Country of origin. Max 255 characters.
dates Object Date information.
dates.manufacturing Object Manufacturing date with year, month, and day properties.
dates.expiry Object Expiry date with year, month, and day properties.

WARNING

Inferences in a processing state (inferring, matching, transforming) cannot be updated. Inferences in a finished state (completed, canceled) can only have their metadata updated.

js
        const data = {
  status: "completed",
  metadata: { warehouse: "east-coast" },
  inference: {
    item: {
      sku: "WIDGET-001",
      name: "Industrial Widget",
      quantity: 50,
    },
    pallet: {
      number: "PLT-12345",
    },
    purchase_orders: ["PO-67890"],
  },
};

const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels/inf_il_abc123", {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());

const scan = response.data;

      

Delete Item Label Inference

DELETE
`/v0/ai/inferences/images/item-labels/:inference_id`

Permanently delete an Item Label inference and its associated image. This action cannot be undone.

Parameter Type Description
inference_id String The ID of the Item Label inference to delete. Must start with inf_il_.
js
        const response = await fetch("https://api.packagex.io/v0/ai/inferences/images/item-labels/inf_il_abc123", {
  method: "DELETE",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

console.log(response.data); // { success: true }