1. Containers
  2. Update Containers

Containers

Update Containers

When updating a container, you can update the tracking status which will be appended to the history of the container and can trigger notifications if those are set up. You can also send the location coordinates as often as you would like, though we recommend limiting this to a maximum of once every 30 seconds.

Update Container

POST
`/v1/containers/:container`

Request Body Example

js
        const data = {
  add: ["ship_82A6o62SfaFeLRctFCMBrt"],
  remove: ["ship_93B7p73TgbGfMSdtGDNCsu"],
  tracking_update: {
    status: "out_for_delivery",
    comment: "Vehicle departed from distribution center",
    address: {
      line1: "123 Delivery St",
      city: "San Diego",
      state: "California",
      postal_code: "92101",
      country: "US"
    },
    images: ["data:image/jpeg;base64,/9j/4AAQSkZJRg..."]
  },
  location_id: "loc_warehouse_main",
  layout_id: "lay_zone_a_shelf_1",
  coordinates: [40.7531386, -73.9894616],
  user_id: "user_45D8r84UhcHfNTeuHEODpv",
  metadata: {
    route_number: "RT-123",
    priority_level: "high"
  }
};

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;

      

Validations

  1. Shipment Ownership:
    • All shipments must belong to the same organization as the API key.
    • Shipments cannot be already assigned to another container.
  2. Layout Assignment:
    • A layout_id cannot be assigned without a valid location_id.
    • The layout must belong to the specified location.