shipments:write. The body is optional; the response is the shipment, now CANCELLED.
The reason
Send one if you have something more specific to record:reason is an uppercase machine code matching ^[A-Z][A-Z0-9_]{1,47}$ — a stable value both systems can reason about, not free text for a human to read. It defaults to MERCHANT_REQUESTED.
When it is refused
409 — a driver already has it
409 — a driver already has it
The shipment has been assigned, picked up, delivered, failed, or already cancelled. Read the shipment back to see where it actually is.
422 — the reason is malformed
422 — the reason is malformed
reason did not match the pattern. The violations array 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 merchant.
Retrying safely
Cancellation is idempotent on the shipment id, so an uncertain retry replays the original outcome rather than attempting a second cancellation. You do not need to send anIdempotency-Key; see Idempotency and ETags if you want to supply your own.