Dashboard Analytics
Admin and seller statistics for revenue, orders, users, products and activity.
Authentication
All Dashboard endpoints require ADMIN role.
Dashboard Endpoints
| Method | Endpoint | Description | Authentication Required |
|---|---|---|---|
| GET | /api/v1/admin/dashboard |
Get dashboard summary | Yes (Admin) |
| GET | /api/v1/admin/dashboard/revenue |
Get revenue analytics | Yes (Admin) |
| GET | /api/v1/admin/dashboard/orders |
Get order statistics | Yes (Admin) |
| GET | /api/v1/admin/dashboard/users |
Get user growth trends | Yes (Admin) |
| GET | /api/v1/admin/dashboard/top-products |
Get top selling products | Yes (Admin) |
| GET | /api/v1/admin/dashboard/activity |
Get recent activity feed | Yes (Admin) |
| GET | /api/v1/seller/dashboard |
Seller-scoped revenue, orders and top products | Yes (Seller) |
| GET | /api/v1/admin/queues |
Admin work queues | Yes |
| GET | /api/v1/seller/readiness |
Seller readiness | Yes |
Endpoint Details
1. Get Dashboard Summary
GET
/api/v1/admin/dashboard
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard' \
-H 'Authorization: Bearer <admin_token>'
Response
{
"revenue": { "total": "15420.50", "today": "1250.00" },
"orders": { "total": 342, "today": 15, "PENDING": 8 },
"users": { "total": 1250, "today": 5, "sellers": 45 },
"products": { "total": 3200, "outOfStock": 12, "lowStock": 28 },
"shops": { "total": 89, "pendingApproval": 3 }
}
2. Get Revenue Stats
GET
/api/v1/admin/dashboard/revenue
| Parameter | Type | Required | Description |
|---|---|---|---|
startDate |
string | No | Start date (YYYY-MM-DD) |
endDate |
string | No | End date (YYYY-MM-DD) |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard/revenue?startDate=2024-01-01&endDate=2024-12-31' \
-H 'Authorization: Bearer <admin_token>'
Response
{
"totalRevenue": "15420.50",
"totalOrders": 342,
"averageOrderValue": "45.09",
"dailyRevenue": [
{ "date": "2024-01-01", "revenue": "520.00" },
{ "date": "2024-01-02", "revenue": "380.00" }
],
"currency": "USD"
}
3. Get Order Stats
GET
/api/v1/admin/dashboard/orders
| Parameter | Type | Required | Description |
|---|---|---|---|
status |
string | No | Filter by order status (e.g., PENDING, PAID) |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard/orders?status=PENDING' \
-H 'Authorization: Bearer <admin_token>'
Response
{
"statusDistribution": {
"PENDING": 8, "CONFIRMED": 15, "paid": 120,
"delivered": 180, "CANCELED": 10, "received": 9
},
"recentOrders": [
{
"orderNumber": "ORD-20240707-0001-ABC123",
"status": "PENDING",
"total": "99.99",
"createdAt": "2024-07-07T10:30:00"
}
]
}
4. Get User Growth
GET
/api/v1/admin/dashboard/users
| Parameter | Type | Required | Description |
|---|---|---|---|
days |
int | No | Number of days to look back (default: 30) |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard/users?days=30' \
-H 'Authorization: Bearer <admin_token>'
Response
{
"totalUsers": 1250,
"newUsersInPeriod": 45,
"periodDays": 30,
"byUserType": { "customer": 1100, "seller": 45, "admin": 5, "super_admin": 1 },
"dailySignups": [
{ "date": "2024-06-07", "count": 3 },
{ "date": "2024-06-08", "count": 1 }
]
}
5. Get Top Products
GET
/api/v1/admin/dashboard/top-products
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of top products to return (default: 10) |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard/top-products?limit=10' \
-H 'Authorization: Bearer <admin_token>'
Response
[
{
"productId": "uuid",
"name": "Galaxy S24",
"sku": "SAMSUNG-S24-BLK",
"totalSales": 150,
"totalRevenue": "149985.00",
"stockQuantity": 50,
"rating": "4.50",
"status": "active"
}
]
6. Get Recent Activity
GET
/api/v1/admin/dashboard/activity
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of activities to return (default: 20) |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/dashboard/activity?limit=20' \
-H 'Authorization: Bearer <admin_token>'
Response
[
{
"id": "uuid",
"type": "order",
"summary": "Order ORD-20240707-0001-ABC123 created - $99.99",
"status": "PENDING",
"createdAt": "2024-07-07T10:30:00"
},
{
"id": "uuid",
"type": "user",
"summary": "New seller registered: seller@example.com",
"status": "verified",
"createdAt": "2024-07-07T09:15:00"
}
]
7. Seller dashboard
GET
/api/v1/seller/dashboard
curl -X 'GET' \
'http://localhost:8080/api/v1/seller/dashboard' \
-H 'Authorization: Bearer <seller_token>'
8. Admin work queues
GET
/api/v1/admin/queues
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/admin/queues' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <admin_token>'
Response
{
"queues": [
{
"key": "pending-orders",
"label": "Pending orders",
"count": 1,
"oldestAt": "2024-05-06T12:00:00",
"path": "/admin/orders"
}
]
}
9. Seller readiness
GET
/api/v1/seller/readiness
curl -X 'GET' \
'http://localhost:8080/api/v1/seller/readiness' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <seller_token>'
Response
{
"shopStatus": "ACTIVE",
"kycStatus": "VERIFIED",
"payoutEligible": true,
"payoutBlockedReason": "Policy violation",
"availablePayout": "25.00",
"currency": "USD",
"missingRequirements": [
"VERIFIED_EMAIL"
],
"nextAction": "CAPTURE",
"shopRejectionReason": "Policy violation",
"shopSuspendedReason": "Policy violation",
"kycRejectionReason": "Policy violation"
}
Error Handling
| Status Code | Description |
|---|---|
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |