Cancel a shipment
Cancelling stops a shipment you already requested. It is only possible before the driver has picked the parcel up.
Request
curl --request POST \
--url https://logistics.api.{{BASE_ENV_URL}}/v1/parcels/deliver/cancel \
--header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
"parcel_ids": ["3f2b1c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"]
}'| Field | Required | Notes |
|---|---|---|
parcel_ids | Yes | The platform IDs of the parcels to cancel. If several parcels were shipped together, send all of them in the same request. |
When you can cancel
Only while the parcel is in one of these states:
qualifiedforpickuponroutetopickuppickingup
Once the parcel has been picked up, the shipment can no longer be cancelled.
Cancelling may have a costCancelling a shipment that is already in progress can be charged, for example when a driver is already on the way. Ask your sales account manager for the conditions that apply to your account. Nothing is charged in sandbox.
Response
202 — the cancellation was accepted for processing, not carried out. Read the parcel back with Track parcels, or wait for the notification, before you tell your customer the order is cancelled. See Limits and reliability for why.
When it goes through, the parcel moves to requestercancel. That state is not final: you can update the parcel and ship it again, or delete it if you do not need it any more. See Parcels life cycle.
When it fails
| Status | Meaning |
|---|---|
401 | Missing or invalid access token. |
404 | One or more parcels were not found. |
409 | One or more parcels are in a state that does not allow cancelling — most often, already picked up. |
422 | Only some of the parcels of a delivery were sent. All the parcels shipped together must be cancelled together, in a single request. |
429 | Rate limited. Back off and retry. |
Updated 23 days ago
