Create a parcel and add track & trace#
This guide shows how to create a parcel for an order's delivery, assign specific inventory items to it, and attach a track & trace number so customers can follow their shipment.
Overview#
- Fetch the order to get the delivery ID and item IDs
- Create a parcel with
createParcelForDelivery - Attach track & trace with
addTrackTraceToItems
Step 1 — Fetch the delivery ID and item IDs#
An order has one or more deliveries. Query the order to get the delivery ID, then fetch the corresponding inventory items using the items query filtered by order_id.
Fetch the physical inventory items (with their IDs) using the items query:
id values from the items response as the items input in the mutations below. These are CollectionItem IDs (UUIDs).Step 2 — Create a parcel#
Use createParcelForDelivery to create a parcel for a specific delivery and assign items to it.
Input: CreateParcelForDeliveryInput!
| Name | Type | Required | Description |
|---|---|---|---|
delivery_id | String! | Required | The ID of the delivery to create a parcel for (from `order.deliveries[].id`). |
items | [String!]! | Required | List of CollectionItem IDs to include in this parcel. |
Returns: CreateParcelForDeliveryPayload
| Name | Type | Required | Description |
|---|---|---|---|
parcels | [Parcel!]!▾ | Required | Parcels created for the delivery |
items | [CollectionItem!]!▾ | Required | Items assigned to the new parcel |
Step 3 — Add track & trace#
Once the parcel is created, attach a track & trace number and URL to the items using addTrackTraceToItems.
Input: AddTrackTraceToItemsInput!
| Name | Type | Required | Description |
|---|---|---|---|
track_trace_number | String! | Required | The carrier-issued tracking number (e.g. "3SPOST12345678"). |
track_trace_url | String! | Required | The full URL where the customer can track the shipment. |
items | [String!]! | Required | List of CollectionItem IDs to assign the track & trace to. |
Returns: AddTrackTraceToItemsPayload
| Name | Type | Required | Description |
|---|---|---|---|
parcels | [Parcel!]!▾ | Required | Parcels carrying the updated track & trace |
items | [CollectionItem!]!▾ | Required | Items the track & trace was attached to |
Notes#
- A single order can have multiple deliveries — use the correct
delivery_idmatching the items you are shipping. - The same item IDs are used in both
createParcelForDeliveryandaddTrackTraceToItems. track_trace_urlshould be the direct tracking page URL, not just the carrier's homepage.- See Queries → parcel to fetch the full parcel details after creation.