Shipment states
The usual state sequence is QUEUED, LABELLED, IN_TRANSIT, then DELIVERED. RETURNED and CANCELLED are also terminal states. Terminal means no further processing is expected for that shipment. It does not mean successful delivery: only DELIVERED represents delivery success.
A create response with QUEUED is asynchronous acceptance. LABELLED indicates a label exists, not that the carrier has possession. IN_TRANSIT means the carrier is processing the parcel. RETURNED is terminal and unsuccessful, so do not count it as delivered in reconciliation reports.
State events may arrive out of order. Compare the event revision integer with the last applied revision for that shipment and apply only a strictly newer revision. Duplicate event IDs are separately deduplicated for 14 days as specified in Webhooks.