Skip to main content

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

ParameterTypeRequiredDescription
workspaceIdstringNoFilter by workspace ID
paymentTypestringNoFilter by payment type (ai-tools, sms, storage, subscription)
startDatedateNoStart date for date range filter (ISO 8601 format)
endDatedateNoEnd date for date range filter (ISO 8601 format)
isManualbooleanNoFilter 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

FieldTypeDescription
totalAmountnumberTotal payment amount (all time) matching filters
totalCountnumberTotal number of payments (all time) matching filters
thisMonthAmountnumberTotal payment amount from start of current month
thisMonthCountnumberNumber of payments from start of current month
thisWeekAmountnumberTotal payment amount from start of current week (Sunday)
thisWeekCountnumberNumber of payments from start of current week
todayAmountnumberTotal payment amount from start of current day
todayCountnumberNumber 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