Get Dashboard Stats
Retrieves key dashboard metrics including product counts, user statistics, and pending items.
Authentication
Bearer token with admin privileges
Requires: Admin role (requireAdmin middleware)
Response
Indicates if the request was successful
Dashboard statistics objectTotal number of active products in the system
Number of products with stock level of 5 or less
Total number of registered users
Number of pending technical consultations
{
"success": true,
"data": {
"totalProducts": 245,
"lowStockProducts": 12,
"totalUsers": 1523,
"recentSales": 487,
"pendingInquiries": 8
}
}
Get Sales Intelligence
GET /api/stats/intelligence
Retrieves comprehensive sales analytics including revenue metrics, trends, top products, and dead stock analysis.
Authentication
Bearer token with admin privileges
Requires: Admin role (requireAdmin middleware)
Response
Indicates if the request was successful
Sales intelligence data objectKey performance indicatorsTotal revenue for the current month (approved, sent, and delivered sales)
Number of products with stock level of 5 or less
Number of sales pending approval
Number of pending technical consultations
Chart data for visualizationDaily sales data for the last 30 daysDate in ISO format (YYYY-MM-DD)
Number of sales on that date
Total sales amount on that date
Top 5 selling products in the last 30 days Products with no sales activity in the last 90 daysDate of last sale (ISO format) or null if never sold
Number of days since last sale or creation
{
"success": true,
"data": {
"kpis": {
"grossRevenue": 45230.50,
"lowStockProducts": 12,
"pendingReview": 5,
"pendingSupport": 8
},
"charts": {
"salesTrend": [
{
"date": "2026-02-05",
"count": 15,
"total": 3250.75
},
{
"date": "2026-02-06",
"count": 18,
"total": 4120.00
}
],
"topProducts": [
{
"name": "RTX 4090 Graphics Card",
"quantity": 45
},
{
"name": "Intel Core i9-14900K",
"quantity": 38
}
]
},
"deadStock": [
{
"id": 123,
"name": "Old Keyboard Model",
"stock": 25,
"price": 45.99,
"lastSale": "2025-10-15T10:30:00Z",
"daysInactive": 142
}
]
}
}