1. Containers
  2. Remove Deliveries from Container

Containers

Remove Deliveries from Container

POST
`/v1/containers/:container`

To remove deliveries from a container, send an array of the deliveries that you want to delete. If you delete the whole container, all of the deliveries from that container will be automatically unlinked.

js
        const data = {
  remove: ["ship_93B7p73TgbGfMSdtGDNCsu"],
};

fetch(`https://api.packagex.io/v1/containers/${container_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 container = res.data;

      

You can attach a comment to the removed_from_container tracking update for the shipments being removed by passing comment.remove:

js
        const data = {
  remove: ["ship_93B7p73TgbGfMSdtGDNCsu"],
  comment: {
    remove: "Package returned to sender"
  }
};

fetch(`https://api.packagex.io/v1/containers/${container_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 container = res.data;