Record a physical cycle count for a bin
POST/bins/:binId/cycle-counts
Verifies a bin's physical contents against system records. If the counted quantity matches system quantity, records a clean CycleCountCompleted. A shortfall (counted < system) marks whichever StockUnits cover the difference fully Unlocated (not split into located/lost sub-quantities — kept simple by design) and publishes ItemUnlocated per unit touched. An overage (counted > system) is reported as a DiscrepancyDetected/CycleCountCompleted(discrepancy=true) pair for a separate receiving/audit process to reconcile — this endpoint does not itself create the extra stock. Each call with a new Idempotency-Key represents a new physical count event and is intentionally repeatable (recounting a bin is a normal operational action); a retry with the SAME Idempotency-Key replays the first answer and counts nothing again (a first answer of 409 concurrent-modification is not stored: that retry executes).
Request
Responses
- 200
- 400
- 404
- 409
- 422
- 500
Cycle count recorded and reconciled (discrepancy indicates whether counted quantity differed from system quantity).
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.
Malformed JSON body, binId path segment missing/empty, or the body omits countedQuantity (an explicit 0 is a valid empty-bin count; omitting the field is a client mistake). A missing or malformed Idempotency-Key header is also a 400 (idempotency-key-required / idempotency-key-invalid).
No bin exists with this id.
The Idempotency-Key was already used with a different method, path or body (idempotency-key-reused). Distinguishable from a business 409 by the problem type; a client bug, never retried blindly.
countedQuantity present but negative.
An unexpected internal error occurred.