Skip to main content

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​

Reservation created.

Response Headers
    Idempotency-Replayed

    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.

    Location

    URI of the newly created Reservation.