Cancel a transfer — synchronously pre-release, through RELEASING once allocated.
POST/v1/transfers/:transferId/cancellation
The operator cancel of the transfer saga (ADR 0022). Pre-release states (DRAFT/PROPOSED/APPROVED/ALLOCATING) cancel synchronously: 200 with state CANCELLED, no hold exists. ALLOCATED answers 202 with state RELEASING: the saga outboxes TransferAllocationReleaseRequested in the same transaction and inventory-storage resolves the origin reservation; its TransferStockAllocationReleased fact (outcome RELEASED or ALREADY_RESOLVED — both settle) completes the cancel to CANCELLED. A retried cancel is idempotent on the saga state: RELEASING answers 202 again, CANCELLED answers 200 again. PICKED onwards and UNFULFILLABLE refuse with 409 cancel-refused — the stock is physically in motion or the saga already closed. An unknown transfer is 404; a missing reason is 422 invalid-cancel. A body with an unknown field or malformed JSON is 400 invalid-request. Idempotent per the required Idempotency-Key header like every keyed write: same key and same request replays the stored answer (Idempotency-Replayed: true) when that answer is final for the request, a different request under the same stored key is 409 idempotency-key-reused. A stored answer is kept for 24 hours: past that window the key is free again (the same request executes once more, a different one is a NEW request). Replay classes (ADR 0024): a FINAL refusal (invalid-cancel, cancel-refused) is stored and replayed; a RETRYABLE refusal (transfer-not-found — the transfer arrives by another request) is not stored, the key is released and a retry executes; a 5xx is never stored.
Request
Responses
- 200
- 202
- 400
- 404
- 409
- 422
- 503
Cancelled synchronously (a pre-release state, or a replay of an already-settled cancel).
Response Headers
Present, with the value true, only when the answer is a replay of an earlier request with the same Idempotency-Key.
Accepted for compensation: state RELEASING — the origin hold is being released; the saga settles to CANCELLED on inventory-storage's TransferStockAllocationReleased fact.
Response Headers
Present, with the value true, only when the answer is a replay of an earlier request with the same Idempotency-Key.
RFC 9457 problem+json error on a keyed route. A 4xx answer produced by the handler is stored, so a replay carries Idempotency-Replayed: true; a 400 refused by the key check itself is not stored and carries no such header.
Response Headers
Present, with the value true, only when the answer is a replay of an earlier request with the same Idempotency-Key.
RFC 9457 problem+json error.
RFC 9457 problem+json conflict. Problem type idempotency-key-reused means the Idempotency-Key was already used with a different request (method, path or body) within the 24-hour window a stored answer is kept for; any other type is a business conflict.
RFC 9457 problem+json error.
RFC 9457 problem+json error.