Create a revocable reservation against usable inventory
POST/reservations
Binds a quantity of a SKU's usable inventory (on-hand minus existing reservations, drawn forward-first: a SKU's forward pick face before its reserve bins, then smaller usable first, bin id, stock unit id (ADR 0050), across whichever StockUnits have usable quantity) to a piece of demand identified by demandRef. The reservation is NOT permanently bound to one physical StockUnit — the specific units/quantities drawn from are recorded as Allocations, but a subsequent revoke-and-reserve cycle is free to draw from a different holding. This is what lets a failed physical pick be retried without stranding the order. The reservation expires automatically after a timeout if never confirmed or revoked. Idempotent (best-effort) by (demandRef, sku, quantity): retrying this call after a dropped response returns the existing ACTIVE reservation for the same demandRef, SKU and quantity instead of creating a second one (see REST_AUDIT.md's idempotency notes). One demandRef (e.g. an order) may hold several ACTIVE reservations at once -- one per line/SKU -- so a request for a different SKU or quantity under the same demandRef is always a new reservation. The optional lineNo (ADR 0036) names the order line the reservation is for: it is stored, returned, and also taken into account by the replay guard (two lines of one order with the same SKU and quantity stay two reservations when their lineNo differ). Replays of the same Idempotency-Key with an identical body still return the cached success (with Idempotency-Replayed: true); a refusal that depends on stock (insufficient-usable, concurrent-modification) is not cached: the same key executes again (ADR 0053). Adding lineNo to a key first used without it is a different request (409 idempotency-key-reused). When automated storage holds the SKU, one container covering the remainder after the forward faces is drawn first and every allocation names its container in containerId (ADR 0054).
Request
Responses
- 201
- 400
- 409
- 422
- 500
Reservation created.
Response Headers
Present, with the value true, ONLY when this response is a replay of the stored answer for the request's Idempotency-Key (the handler did not run again). The first execution of a key never carries it, and neither does a retry of a refusal that was not stored (ADR 0053: concurrent-modification and every refusal that depends on state that can change): that retry executes again.
URI of the newly created Reservation.
Malformed JSON body (including cases sent as null or a non-integer), SKU missing/empty, demandRef missing/empty, ownerRef malformed (invalid-owner-ref), both quantity and cases sent (quantity-and-cases-exclusive), lineNo present but outside 1..2147483647, or the Idempotency-Key header is absent (ADR 0018).
Requested quantity exceeds this SKU's currently usable inventory across all its StockUnits, or a racing request modified the same StockUnit first (ADR 0019 — re-fetch and retry). The same Idempotency-Key reused with a different method, path or body is also a 409 (idempotency-key-reused).
Neither quantity nor cases was sent, or the one sent is not a positive number.
An unexpected internal error occurred.