1. Inferences
  2. Bill of Lading Inference

Inferences

Bill of Lading 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
`/v1/inferences`

To create a new inference for bill of lading, 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.

location_id String
The ID of the location you want to attribute to this scan.

options Object
Option contains different other optional parameters you can provide along with the image. Those parameters are described below

Show Details

custom_attributes Array.<String>

This parameter allows you to provide custom attributes as an array of strings.
Each string can be a maximum of 127 characters, and the array can contain up to 25 elements.
Duplicate attributes (case-insensitive) will be removed, and the final array will retain the original casing of the first occurrence.
If omitted, the default value is an empty array.

match Object
All the options associated with matching logic.

These parameters are required only if matching is used.

Show Details
Parameter Type Description
search_in Object Includes the following fields: invoice_number, order_number, purchase_order_number, reference_number, customer_purchase_order_number, container_number, load_number. Each field is a boolean and at least one of these must be set to true must be set to true to include in the matching process.
search_type string Specifies the type of search to perform. Can be match_some or match_all. match_some will return all manifests that match any of the fields specified in search_in, while match_all will only return the manifests that return all of the specified fields.


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
  options: {
    match: {
      search_in: {
        invoice_number: true,
        order_number: true,
        purchase_order_number: true,
        reference_number: true,
        customer_purchase_order_number: true,
        container_number: true,
        load_number: false,
      },
      search_type: "match_some",
    },
  },
};

const res = await fetch("https://api.packagex.io/v1/inferences/images/bills-of-lading", {
  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;