Skip to main content
Cancellation is an idempotent write. It requires an Idempotency-Key and a machine-readable reason code.

The reason code

reasonCode is an uppercase machine code of 2–48 characters matching ^[A-Z][A-Z0-9_]{1,47}$ — for example CUSTOMER_REQUESTED. It is a stable value your systems and DropHub’s can both reason about, not free text for a human to read.

When cancellation is refused

A shipment that has already reached a terminal state (DELIVERED, DELIVERY_FAILED, or CANCELLED) cannot be cancelled. Read the shipment back to see where it actually is.
Most commonly a reasonCode that does not match the required pattern. The violations array in the problem response names the offending field.
The shipment does not exist, or it belongs to another company.
Cancellation racing a state change is normal, not exceptional. Handle 409 by re-reading the shipment and reporting its real state rather than retrying the cancel.

Retrying safely

Reuse the same Idempotency-Key when retrying a cancellation you are unsure completed. An exact replay returns the original outcome instead of attempting a second cancellation. A new key for the same intent is a new request — see Idempotency and ETags.