Get Available Lots (FEFO)
GET/api/products/:productId/available-lots
Active FIFO layers available to CONSUME for a product in a given warehouse — only layers with remaining (unfulfilled) quantity are returned.
products:readGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Layers are ordered by the product's removal strategy: FEFO products list soonest-expiry first with undated lots last; FIFO products list by layer date. This drives the lot-override picker (LotConsumptionPanel) and its FEFO pre-fill on negative inventory events (fulfillment, transfer ship, decrease adjustment).
Authentication: Requires Bearer token.
Path params:
- productId: Product ID
Query params:
- warehouse_id (REQUIRED, integer, exists:warehouses,id): warehouse to scope available lots to. Returns 422 if missing.
Response (wrapped in {data}) — array of lots:
- fifo_layer_id (int): FIFO layer ID to reference in a lot_allocation override
- batch_number (string|null): lot/batch number
- expiry_date (date|null, YYYY-MM-DD): lot expiry date
- manufacture_date (date|null, YYYY-MM-DD): lot manufacture date
- available_quantity (float): remaining quantity available to consume from this layer
- fifo_layer_date (date|null, YYYY-MM-DD): the layer's FIFO date
- days_to_expiry (int|null): whole days until expiry (negative if already expired); null when undated
- is_expired (bool): whether the lot's expiry date is before today
- avg_cost (float): average unit cost of the layer
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.