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
409 — the shipment cannot be cancelled from its current state
409 — the shipment cannot be cancelled from its current state
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.422 — the request is well-formed but invalid
422 — the request is well-formed but invalid
Most commonly a
reasonCode that does not match the required pattern. The violations array in the problem response names the offending field.404 — no such shipment for this credential
404 — no such shipment for this credential
The shipment does not exist, or it belongs to another company.
Retrying safely
Reuse the sameIdempotency-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.