1. Manifests
  2. Manifests

Manifests

Manifests

Before you create manifests, you'll want to set up locations in your dashboard so that you'll be able to add manifests to a certain location.

Create Manifest

POST
`/v1/manifests`

To create a manifest, you only need to include the location_id and specify the inventory items or parcels that you want to add. Parcel contents may be unknown, and may contain serialized inventory.

Example - Receiving Inventory

js
        const data = {
  location_id: "loc_afnHMjVUn3gnrvxU5zMvkX",
  articles: [
    {
      item_id: "item_pu8iNbturZy5zvB4zaUZ8t", //Create by ID
      packed_qty: 50,
      assets: [
        {
          id: "ast_1Ab3133a4",
          manufacturer_number: "PX-PP-MOSDS-8",
        },
        {
          id: "ast_1Ab3133a5",
          manufacturer_number: "PX-PP-MOSDS-9",
        },
      ],
    },
    {
      sku: "DRC123", //Create by SKU.
      packed_qty: 50,
    },
    {
      gtin: "123456789", //Create by GTIN.
      packed_qty: 50,
    },
  ],
  shipment_options: {
    verify_addresses: false, // whether to verify addresses
  },
  sender: {
    name: "Little Nap Cafe",
    email: "jamie_jones.special@packagex.xyz",
    phone: "(484) 483-6699",
    address: "6951 Camino Degrazia, San Diego, CA 92111",
    address_line2: null,
  },
  recipient: {
    name: "Jamie Jones",
    email: "jamie@packagex.xyz",
    phone: "4844836699",
    address: "500 7th Ave, New York, NY 10018",
  },
};

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

const manifest = response.data;

      

The quantities in articles will also be reflected in the manifested_qty of the relevant item level, determined from the manifest's location and article's layout. If no layout is assigned to the article, the quantities will be reflected in the level created against the default layout of the location.

For example, for item item_pu8iNbturZy5zvB4zaUZ8t, Fetch the inventory levels of the article and check the manifested_qty

js
        let default_layout_id = "lay_" + manifest.location_id.split("_")[1];
const response = await fetch(`https://api.packagex.io/v1/items/item_pu8iNbturZy5zvB4zaUZ8t/levels`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
}).then((res) => res.json());

const relevant_level = response.data.find((lvl) => lvl.location_id === manifest.location_id && lvl.layout_id === default_layout_id);
console.log(relevant_level.manifested_qty); // returns 50

      

Example - Receiving Parcels

js
        const data = {
  location_id: "loc_afnHMjVUn3gnrvxU5zMvkX",
  containers: [
    // parcels containing serialized or unserialized articles
    {
      container_id: "container_1",
      container_number: "CNTR-Pi31-001",
      tracking_number: "PKGX-0GP0241-UU22JNT",
    },
    {
      articles: [
        {
          item_id: "item_pu8iNbturZy5zvB4zaUZ8t",
          assets: [
            {
              id: "ast_1Ab3133a1",
              manufacturer_number: "PX-PP-MOSDS-3",
            },
            {
              id: "ast_1Ab3133a2",
              manufacturer_number: "PX-PP-MOSDS-4",
            },
          ],
        },
      ],
      container_id: "container_1",
      container_number: "CNTR-Pi31-001",
      tracking_number: "PKGX-0GOZRO1-URZ18CA",
    },
  ],
  shipment_options: {
    verify_addresses: false, // whether to verify addresses
  },
  sender: {
    name: "Little Nap Cafe",
    email: "jamie_jones.special@packagex.xyz",
    phone: "(484) 483-6699",
    address: "6951 Camino Degrazia, San Diego, CA 92111",
    address_line2: null,
  },
  recipient: {
    name: "Jamie Jones",
    email: "jamie@packagex.xyz",
    phone: "4844836699",
    address: "500 7th Ave, New York, NY 10018",
  },
}

      

Attachments and Special Handling Tags

Special handling tags can be applied to articles, parcels or parcel contents. The manifest will reflect the unique set of special handling tags on all articles included in the manifest. Likewise, manifests allow you to add attachments. Attachments can be PDF files or images, both have to be base64 encoded.

js
        const data = {
  location_id: "loc_afnHMjVUn3gnrvxU5zMvkX",
  shipment_options: {
    verify_addresses: false,
  },
  containers: [
    {
      special_handling_tags: ["lithium"],
      container_id: "container_1",
      container_number: "ASDF",
      tracking_number: "trk_123",
    },
    {
      special_handling_tags: ["lithium"],
      layout_id: "lay_11cCoQQVr6BUKxRT9K1p4x",
      articles: [
        {
          special_handling_tags: ["ftl"],
          item_id: "item_2z39qY36RthxqrJkJSpc52",
          is_asset: false,
          defective_qty: 2,
        },
      ],
      container_id: "container_2",
      container_number: "QWERT",
      tracking_number: "trk_0987",
    },
  ],
  shipment_info: {
    provider_id: "packagex",
    tracking_number: "PKGX-0GP09J1-U022414",
    document_number: "doc123",
    contact_email: "jamie@packagex.xyz",
  },
  recipient: {
    name: "Jamie Jones",
    email: "jamie@packagex.xyz",
    phone: "4844836699",
    address: "500 7th Ave, New York, NY 10018",
  },
  sender: {
    name: "Little Nap Cafe",
    email: "jamie_jones.special@packagex.xyz",
    phone: "(484) 483-6699",
    address: "6951 Camino Degrazia, San Diego, CA 92111",
    address_line2: null,
  },
  metadata: {
    key: "value",
  },
  attachments: {
    add: [
      {
        image:
          "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII",
        name: "Sample Attachment",
      },
    ],
  },
};

      

For item manifests

js
        const data = {
  location_id: "loc_afnHMjVUn3gnrvxU5zMvkX",
  shipment_options: {
    verify_addresses: false,
  },

  articles: [
    {
      item_id: "item_2z39qY36RthxqrJkJSpc52",
      is_asset: false,
      layout_id: "lay_11cCoQQVr6BUKxRT9K1p4x",
      special_handling_tags: ["ftl"],
      assets: [
        {
          manufacturer_number: "PX-PP-MOSDS-1",
          defective: true,
        },
        {
          manufacturer_number: "PX-PP-MOSDS-2",
        },
      ],
    },
    {
      item_id: "item_2z39qY36RthxqrJkJSpc52",
      is_asset: false,
      layout_id: "lay_11cCoQQVr6BUKxRT9K1p4x",
      special_handling_tags: ["ftl"],
      assets: [
        {
          manufacturer_number: "PX-PP-MOSDS-1",
          defective: true,
        },
        {
          manufacturer_number: "PX-PP-MOSDS-2",
        },
      ],
    },
  ],

  shipment_info: {
    provider_id: "packagex",
    tracking_number: "PKGX-0GP09J1-U022414",
    document_number: "doc123",
    contact_email: "jamie@packagex.xyz",
  },
  recipient: {
    name: "Jamie Jones",
    email: "jamie@packagex.xyz",
    phone: "4844836699",
    address: "500 7th Ave, New York, NY 10018",
  },
  sender: {
    name: "Little Nap Cafe",
    email: "jamie_jones.special@packagex.xyz",
    phone: "(484) 483-6699",
    address: "6951 Camino Degrazia, San Diego, CA 92111",
    address_line2: null,
  },
  metadata: {
    key: "value",
  },
  attachments: {
    add: [
      {
        image:
          "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII",
        name: "Sample Attachment",
      },
    ],
  }


      

Active special handling tags must be enabled in the org settings. Only those special handling tags will be applied to the manifest that are enabled in the org settings. The list of available special handling tags are

  • ftl
  • ltl
  • lithium
  • frozen
  • chemicals
  • hazmat
  • perishable
  • oversize
  • fragile
  • dry_cleaning
  • alcohol
  • cannabis
  • confidential
  • marijuana
  • pharma
  • dry_ice

Enable tracking

Tracking can be enabled for manifests by providing relevant provider_id and tracking_number. For example, if you want to use PackageX trackers, do the following

js
        const data = {
  location_id: "loc_afnHMjVUn3gnrvxU5zMvkX",
  articles: [
    {
      id: "item_pu8iNbturZy5zvB4zaUZ8t", //Create by ID
      packed_qty: 50,
    },
    {
      sku: "DRC123", //Create by SKU. If SKU doesn't exist we'll create one
      packed_qty: 50,
    },
    {
      gtin: "123456789", //Create by GTIN.
      packed_qty: 50,
    },
    {
      name: "Dispatch Roasters Coffee (3lb Bag)", //Will create a new item
      packed_qty: 50,
    },
  ],
  shipment_options: {
    verify_addresses: false, // whether to verify addresses
  },
  sender: {
    name: "Little Nap Cafe",
    email: "jamie_jones.special@packagex.xyz",
    phone: "(484) 483-6699",
    address: "6951 Camino Degrazia, San Diego, CA 92111",
    address_line2: null,
  },
  shipment_info: {
    provider_id: "other",
    document_number: "doc123",
    tracking_number: "PKGX-0GP09J1-U022414",
  },
  // optional
  recipient: {
    name: "Jamie Jones",
    email: "jamie@packagex.xyz",
    phone: "4844836699",
    address: "500 7th Ave, New York, NY 10018",
  },
};

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

const manifest = response.data;
const tracker_id = response.data.tracker_id;

      

Update Manifest

POST
`/v1/manifests/:manifest`

Before you can update a manifest, you'll need to update its status to accepted. The reason this exists is because manifests can be created (with your permission) by third parties. Therefore, it's best that you accept them, and understand that there could be inventory items that will get created.

If you do not wish to proceed with the manifest, you can update the status to void instead.

Accept Manifest

js
        const data = {
  status: "accepted",
};

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

const manifest = response.data;

      

Mark Parcel as Defective, Missing or Received

Parcels can be marked as defective, missing or received by passing the relevant flag as true.

js
        const data = {
  containers: [
    id: "prcl_fpKJ7oiMyLPKhd8Ei6MyKX",
    defective: false,
    missing: false,
    received: true,
  ]
}

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

const manifest = response.data;
const updated_container = manifest.parcels.find(p => p.id == "prcl_fpKJ7oiMyLPKhd8Ei6MyKX")
updated_container.defective == false // true
updated_container.missing == false // true
updated_container.received == true // true

      

Verify Inventory

When verifying inventory for a manifest, we want to determine what is in good condition, bad condition, and what is missing. We do so by incrementing the verified_qty and damaged_qty properties on each inventory item or parcel content within the manifest.

js
        const data = {
  containers: [
    id: "prcl_fpKJ7oiMyLPKhd8Ei6MyKX"
    articles: [
      {
        id: "ctent_xrMpnxwxnXnWi1BRsvaL6q",
        verified_qty: 1,
        damaged_qty: 1,
      }
    ]
  ]
};

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

const manifest = response.data;
const article_1 = manifest.articles.find(art => art.id === "art_pu8iNbturZy5zvB4zaUZ8t")
console.log(article_1.received_qty) // returns 2
const article_2 = manifest.articles.find(art => art.id === "art_r3CnfTDe66HPNPZid2WVrr")
console.log(article_2.received_qty) // returns (old_received_qty + 10 - 1)
const article_3 = manifest.articles.find(art => art.id === "art_ubo3miFdD9v45ZZkhtY7Us")
console.log(article_3.received_qty) // returns 0

      

Adding to Inventory

When all items have been verified -- and even if some items are missing -- you are able to update the status of the manifest to 'completed'. Once this happens, all of the inventory items that are referenced in the manifest will automatically have their available_qty and damaged_qty properties updated in the relevant levels. These quantities are also subtracted from the manifested_qty.

js
        const data = {
  status: "completed",
};

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

const manifest = response.data;

      

For item item_pu8iNbturZy5zvB4zaUZ8t, Fetch the inventory levels of the article and check the manifested_qty, verified_qty and defective_qty.

js
        let default_layout_id = "lay_" + manifest.location_id.split("_")[1];
const response = await fetch(`https://api.packagex.io/v1/items/item_pu8iNbturZy5zvB4zaUZ8t/levels`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
}).then((res) => res.json());

const relevant_level = response.data.find((lvl) => lvl.location_id === manifest.location_id && lvl.layout_id === default_layout_id);
console.log(relevant_level.manifested_qty); // returns 48
console.log(relevant_level.available_qty); // returns old available_qty (if any) + 1
console.log(relevant_level.defective_qty); // returns old defective_qty (if any) + 1