Skip to main content

Approve a transfer proposal and start the allocation saga.

POST 

/v1/transfer-approvals

Takes a proposal snapshot (origin, destination, SKU, quantity, policy version) and validates it against the CURRENT fail-closed read models. On success the InterWarehouseTransfer saga persists through PROPOSED → APPROVED → ALLOCATING and, in the same transaction, enqueue TransferPlanApproved and TransferAllocationRequested into the transactional outbox; a relay publishes them to Kafka and inventory-storage's reply later drives the transfer to ALLOCATED or UNFULFILLABLE. Idempotent per the required Idempotency-Key header: replaying the same key with the same request replays the ORIGINAL stored answer (header Idempotency-Replayed: true) when that answer is final for the request — a success, or a FINAL refusal such as invalid-approval or proposal-expired; the same key with a different request is a 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). A RETRYABLE refusal (facts-incomplete, below-one-case: causes that clear when the event-fed planning facts change) is NOT stored — the key is released and a retry under it executes again (replay classes, ADR 0024). Fail-closed validation failures return 422: the origin or the destination is missing or stale in the planning snapshot (the problem detail names the site and the stale fact), is disabled for its role, or the demand and capacity checks fail. Stale facts of any other site do not matter. When no site has complete fresh facts at all the answer is the same 422 facts-incomplete; unusable (unreadable) read models return 503. Other 422 problem types: invalid-approval (the request fails the use case's checks), below-one-case (the origin cannot send one whole case of a CASE-level SKU) and proposal-expired. Other 503 types: saga-unavailable (no saga persistence), config-incomplete (TRANSFER_PICK_PATH_ID / TRANSFER_PICK_CPT_OFFSET unset), pack-levels-unavailable and approval-unavailable. A body with an unknown field or malformed JSON is 400 invalid-request. Answers are stored and replayed by their problem type's replay class (ADR 0024): FINAL and OUTCOME refusals replay, RETRYABLE ones release the key, and a 5xx is never stored.

Request​

Responses​

The persisted saga state (200, not 201: a replay of the same idempotency key returns the original transfer).

Response Headers
    Idempotency-Replayed

    Present, with the value true, only when the answer is a replay of an earlier request with the same Idempotency-Key.