Analytics
Pull business metrics and reports. All analytics endpoints accept a days parameter to control the time window.
Endpoints
GET/analytics/dashboardRevenue, orders, customers summary
GET/analytics/revenueDaily revenue breakdown
GET/analytics/top-productsBest-selling products
GET/analytics/customersCustomer statistics
Common parameters
| Parameter | Default | Description |
|---|---|---|
| days | 30 | Time window in days (max: 365) |
Dashboard - GET /analytics/dashboard
{
"success": true,
"data": {
"period_days": 30,
"revenue": {
"total": 48750.50,
"orders": 312,
"avg_order_value": 156.25
},
"customers": {
"total": 1840,
"new_in_period": 47
},
"products": {
"total": 234
}
}
}
Revenue - GET /analytics/revenue
Returns daily revenue data points for charting.
[
{ "date": "2026-06-01", "revenue": 1850.00, "orders": 12 },
{ "date": "2026-06-02", "revenue": 2100.50, "orders": 14 }
]
Top products - GET /analytics/top-products
Additional parameter: limit (default: 10, max: 50)
[
{
"product_id": "uuid",
"name": "Widget Pro",
"sku": "WDGPRO-1234",
"total_sold": 450,
"total_revenue": 22455.00
}
]