Skip to main content

Get Stock Run-down for Forecast Lines

POST 

/api/inventory-forecasting/stock-rundown

Projects month-by-month ending stock for a set of forecast lines (up to 500 per request, each product once). Supply the demand, lead time, Min Stock Level and recommended order a forecast build returned; the projection starts from today's available stock minus open backorders in the chosen warehouse scope and lays in open purchase orders and warehouse transfers on their expected dates.

Required scope: purchase-orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Requires a Bearer token with the purchase-orders scope.

Body fields:

  • months (optional, integer: 3, 6, 12 or 24; default 6) — horizon
  • warehouse_id (optional, integer|null) — limit stock and supply to one warehouse; null = every planning warehouse
  • hold_safety_stock (optional, boolean) — treat stock below the Min Stock Level as unusable
  • hold_lead_time_stock (optional, boolean) — treat daily demand × lead time as unusable
  • include_recommended_orders (optional, boolean) — lay in each line's recommended order, arriving after its lead time (or on arrival_date)
  • lines (required, array, 1–500): product_id (required, distinct), supplier_product_id (optional), daily_average (required, ≥ 0), deseasonalized_daily_average (optional — when present, month demand follows the product's monthly seasonal pattern), leadtime (required, days), leadtime_source (optional), min_stock_level (optional), min_stock_level_ignored (optional), recommended_quantity (optional), arrival_date (optional, Y-m-d)

Each month cell returns starting, demand, arrivals and ending units (ending = starting − demand + arrivals) and a status: stockout (usable stock below zero on any day), below_reorder_point (dips below safety stock + lead-time demand), healthy, or no_demand. Supply with no expected date, or past it, is counted today and flagged. Each row explains its first stockout and lists supply that arrives after it, plus configuration gaps (no sales, no lead time, no Min Stock Level, undated or overdue supply).

Request​

Responses​

OK

Response Headers
    Content-Type