Skip to main content

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.

Required scope: products:read

Grant 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

OK

Response Headers
    Content-Type