Overview
The Analytics API provides advanced business intelligence features including demand forecasting, FEFO (First Expired, First Out) ordering recommendations, top-selling products analysis, and notification alerts. All endpoints require authentication and Manager/Admin role. Access: All analytics endpoints require Private (Manager/Admin only) access.Demand Forecast
Get demand forecasting data for top products with 7-day projections. Access: Private (Manager/Admin only)Query Parameters
Number of products to include in forecast
Response
Array of product forecasts
Estimated daily consumption rate
Example Response
The forecast algorithm assumes steady consumption based on historical quantity changes. Critical trend is flagged when projected quantity falls below 10 units.
FEFO Ordering
Get First Expired, First Out (FEFO) ordering recommendations based on expiry dates. Access: Private (Manager/Admin only)Query Parameters
Number of items to return
Response
Array of items sorted by expiry date (nearest first)
Item ID
Product name
Product category
Stock Keeping Unit
Current quantity
Expiry date
Days until expiration
Urgency level:
critical (≤3 days), high (≤7 days), medium (≤14 days), or low (>14 days)Supplier name
Number of items returned
Example Response
Only non-expired items with quantity > 0 are included in FEFO ordering.
Top Selling Products
Get top-selling products based on sales velocity analysis. Access: Private (Manager/Admin only)Query Parameters
Number of products to return
Response
Array of top-selling products
Product ID
Product name
Product category
Stock Keeping Unit
Current stock quantity
Estimated units sold
Sales velocity (units per day)
Days since initial purchase
Number of products returned
Example Response
Sales velocity is calculated based on estimated consumption over time. Higher velocity indicates faster-moving products.
Notification Alerts
Get comprehensive notification-style alerts for inventory issues. Access: Private (Manager/Admin only)Query Parameters
Maximum number of alerts to return
Response
Array of alerts sorted by severity
Item ID
Alert type:
expired, expiring_soon, out_of_stock, or low_stockSeverity level:
critical, high, medium, or lowProduct name
Product category
Human-readable alert message
Alert timestamp
Total number of alerts
Example Response
Alert Types
| Type | Description | Severity |
|---|---|---|
expired | Product has passed expiry date | critical |
expiring_soon | Expires within 7 days | high (≤3 days), medium (4-7 days) |
out_of_stock | Quantity is 0 | high |
low_stock | Quantity less than 10 | high (below 5), medium (5-9) |