Skip to main content

Get Product Stock Coverage

GET 

/api/reporting/products/:product/stock-coverage

Daily Average Consumption (DAC) and Days of Stock reconstructed as a 12-month monthly time series for a product. No history is stored for either metric, so both are rebuilt from source ledgers: DAC at each month is gross units sold over the trailing sales-history window divided by that window length; on-hand at each month is the running balance of stock movements up to that month; Days of Stock is on-hand divided by DAC (null when DAC is 0, i.e. coverage is effectively infinite).

Authentication: Requires Bearer token (scope: reports)

Path parameter:

  • product: the product ID

Query parameter:

  • months: span of the series - an integer count of trailing months (e.g. 12, 24) or 'all' for the product's full ledger history (capped at 60 months). Default: 12.

Response fields:

  • buckets: 12 month labels (YYYY-MM), oldest first
  • window_days: the trailing DAC window length in days
  • dac / units_sold / on_hand / days_of_stock: parallel arrays aligned to buckets (units_sold is the raw units sold that calendar month; dac is the trailing-window daily average) (days_of_stock entries are null where DAC is 0)
  • current: the latest bucket's dac, on_hand and days_of_stock

Request

Responses

OK

Response Headers
    Content-Type