Get Payment Statistics (v1)
Method & Path
GET /api/v1/admin/payments/stats
Description
Retrieve payment statistics including total amounts and counts for all time, this month, this week, and today. Supports the same filtering options as the list payments endpoint.
Authentication
Required: Admin authentication with payments.view permission.
Headers
Authorization: Bearer <admin_token>
Content-Type: application/json
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | No | Filter by workspace ID |
paymentType | string | No | Filter by payment type (ai-tools, sms, storage, subscription) |
startDate | date | No | Start date for date range filter (ISO 8601 format) |
endDate | date | No | End date for date range filter (ISO 8601 format) |
isManual | boolean | No | Filter by manual/automatic payments (true for manual, false for automatic) |
Response 200 OK
{
"totalAmount": 10000.00,
"totalCount": 150,
"thisMonthAmount": 2000.00,
"thisMonthCount": 30,
"thisWeekAmount": 500.00,
"thisWeekCount": 8,
"todayAmount": 100.00,
"todayCount": 2
}
Response Fields
| Field | Type | Description |
|---|---|---|
totalAmount | number | Total payment amount (all time) matching filters |
totalCount | number | Total number of payments (all time) matching filters |
thisMonthAmount | number | Total payment amount from start of current month |
thisMonthCount | number | Number of payments from start of current month |
thisWeekAmount | number | Total payment amount from start of current week (Sunday) |
thisWeekCount | number | Number of payments from start of current week |
todayAmount | number | Total payment amount from start of current day |
todayCount | number | Number of payments from start of current day |
Common Errors
400 Bad Request: Invalid query parameters
401 Unauthorized: Missing or invalid authentication token
403 Forbidden: Admin does not have payments.view permission
500 Internal Server Error: Server error occurred while processing the request