The Metrics API exposes three endpoints that together cover every analytics need in StockManager: a lightweight dashboard summary for at-a-glance KPIs, a comprehensive business analytics object that covers revenue trends, product performance, inventory health, and vendor stats for any custom date range, and a never-sold products report for identifying dead stock. Every endpoint requires an active session; no elevated role is needed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/InnoDev69/StockManager/llms.txt
Use this file to discover all available pages before exploring further.
Dashboard Summary
GET /api/stats
Returns a compact set of current-state indicators intended for the main dashboard widgets. All values reflect the live database at the moment of the request — no date range parameter is accepted. Auth: any authenticated session. ResponseTotal number of product records in the
items table, regardless of status.Count of active items where
quantity <= min_quantity and quantity > 0.Number of sale transactions (
sells rows) recorded today (server local date).Top 10 items closest to or below their minimum quantity threshold, sorted ascending by current stock.
Count of items with an
expiration_date within the next 7 days.Sum of
quantity × price for all active (status = 1) items, rounded to two decimal places.Analytics
GET /api/metrics
Returns a rich analytics object covering KPIs, time-series data, product rankings, heatmaps, inventory forecasting, and vendor performance for a specified period. Whenfrom and to are both provided they take precedence over period.
Auth: any authenticated session.
Number of trailing days to analyze. Accepted values:
7, 30, 90, 365. Defaults to 7. Ignored when from and to are both supplied.Period start date in
YYYY-MM-DD format. Must be paired with to.Period end date in
YYYY-MM-DD format. Must be paired with from. When both from and to are set they override period.Core revenue and sales KPIs for the requested period, each accompanied by a percentage change relative to the equivalent preceding period.
Day-by-day breakdown of revenue and sale counts across the requested range.
Best-selling products ranked by units sold during the period.
7-element array (index
0 = Monday … index 6 = Sunday) containing the total sale count for each weekday during the period.24-element array (index
0 = 00:00 … index 23 = 23:00) with the total sale count for each hour of day.Sales intensity matrix combining weekday and hourly distributions.
Up to 20 active products sorted by
daysRemaining ascending — the items most at risk of running out. Only products with at least one unit sold during the period appear here.Subset of
inventoryForecast containing only items with status == "danger" (3 days or fewer of stock remaining).Human-readable summary derived from the period’s data.
Side-by-side revenue figures for current and previous periods.
Real-time inventory alert counts.
Moving-average smoothing of the daily revenue series.
Per-vendor performance data for the period (structure mirrors internal
get_vendors_metrics output).Aggregate inventory snapshot at the time of the request.
Echo of the resolved date range used for the query.
Dead Stock Report
GET /api/never-sold
Returns every active product (status = 1) that has never appeared in any sale detail record — i.e., has zero historical sales of any kind, not just within a date range. Useful for identifying obsolete or unattractive stock.
Auth: any authenticated session.
Response
Active products with no sales history, sorted by
quantity descending (highest stock first).This endpoint scans the entire
details table for any historical appearance of each product. A product that was sold once and then returned still appears as “sold” and will not appear in this list.