/api/forecast_unitsX-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
{
"product_code": "string", // SKU or internal code
"forecast_period": int, // ≥1, number of months to predict
"data": [ // historical daily units sold; ≥45 rows recommended
{
"date": "YYYY-MM-DD", // ISO date; gaps auto-filled as 0
"sales_quantity": int // non-negative units sold
}
// … additional records …
]
}
// Example Request
{
"product_code": "38788",
"forecast_period": 6,
"data": [
{ "date": "2025-02-20", "sales_quantity": 11 },
{ "date": "2025-02-21", "sales_quantity": 12 },
{ "date": "2025-02-22", "sales_quantity": 6 },
{ "date": "2025-02-23", "sales_quantity": 5 },
{ "date": "2025-02-24", "sales_quantity": 14 },
{ "date": "2025-02-25", "sales_quantity": 13 },
{ "date": "2025-02-26", "sales_quantity": 12 },
{ "date": "2025-02-27", "sales_quantity": 13 },
{ "date": "2025-02-28", "sales_quantity": 12 },
{ "date": "2025-03-01", "sales_quantity": 7 },
// … at least 45 total entries …
{ "date": "2025-04-20", "sales_quantity": 8 }
]
}
// Example Response
{
"forecast_period": 6,
"forecasts": [
{
"product_code": "38788",
"best_algorithm": "Random Forest",
"evaluation_metrics": {
"RMSE": 1.00945,
"MAE": 0.98201,
"R2": 0.93241,
"average_daily_sales": 12.93465,
"Interpretation": "Random Forest selected (RMSE=1.01, MAE=0.98, R²=0.93)."
},
"forecast": {
"calendar": [
{"yyyy-mm": "2025-05", "value": 435.7681},
{"yyyy-mm": "2025-06", "value": 420.2209},
{"yyyy-mm": "2025-07", "value": 443.8330},
{"yyyy-mm": "2025-08", "value": 426.7841},
{"yyyy-mm": "2025-09", "value": 429.2683},
{"yyyy-mm": "2025-10", "value": 442.8731}
],
"business": [
{"yyyy-mm": "2025-05", "value": 362.2446},
{"yyyy-mm": "2025-06", "value": 347.6626},
{"yyyy-mm": "2025-07", "value": 378.9078},
{"yyyy-mm": "2025-08", "value": 345.6275},
{"yyyy-mm": "2025-09", "value": 364.3430},
{"yyyy-mm": "2025-10", "value": 377.9478}
]
}
}
],
"execution_time_seconds": 1.5340
}
Generate a one-shot, 6-month demand forecast at the SKU level (day-granular, calendar vs. business-day splits). The endpoint auto-benchmarks ARIMA, ETS, Prophet, TBATS, Random Forest, Gradient Boost, and Croston for intermittent demand, selects the best model by RMSE, and returns month-level unit forecasts with diagnostic metrics and run time.
• Replenishment Planning: Feed calendar forecasts into PO generation to balance stock-out vs. over-stock. • Workforce Scheduling: Use business-day forecasts for labour and picking slot planning. • Intermittent & Lumpy Items: Auto-select Croston when demand is sparse without custom code.
← Back to all routes