1. Containers
  2. Delete Container

Containers

Delete Container

This endpoint permanently removes the container while properly unlinking all shipments from the container.

DELETE
`/v1/containers/:container`

When a container is deleted, all deliveries from the container will automatically be unlinked.

js
        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());

      

Effects of Deletion

When a container is deleted, the following actions occur:

  1. Shipment Processing
    • All associated shipments are automatically unlinked from the container.
    • Each shipment receives a new tracking update with status removed_from_container.
    • Shipment location and layout information is preserved
    • Previous tracking history remains intact
  2. Container Removal
    • The container record is permanently deleted from the system.
    • Container tracking history is preserved in associated shipments.

Response Structure

Successful Deletion

js
        {
    "message": "Container was deleted successfully and 3 shipments are being unlinked.",
    "data": {
        "success": true
    },
    "status": 200,
    "errors": [],
    "code": null,
    "pagination": null,
    "endpoint": null
}

      

The message will vary based on whether shipments were unlinked during deletion.

Error Responses

If the container doesn't exist or belongs to a different organization:

js
        {
    "message": "Container not found",
    "data": {},
    "status": 404,
    "errors": [],
    "code": "server.error",
    "pagination": null,
    "endpoint": null
}