Skip to main content

Get Income Stats (v1)

Method & Path

GET /api/v1/client/workspace/:workspaceId/incomes/stats

Description

Get income statistics for the workspace including total amount, count, and period-based aggregations.

Authentication

Required: Workspace authentication. User must be authenticated as Workspace Owner or Staff with financial permissions.

Headers

Authorization: Bearer <workspace_token>
Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Response 200 OK

{
"totalAmount": 50000.00,
"totalCount": 150,
"thisMonthAmount": 5000.00,
"thisMonthCount": 15,
"thisWeekAmount": 1200.00,
"thisWeekCount": 3,
"todayAmount": 500.00,
"todayCount": 1
}

Response Fields

  • totalAmount (number): Total income amount (all time)
  • totalCount (number): Total number of income records (all time)
  • thisMonthAmount (number): Total income amount for current month
  • thisMonthCount (number): Number of income records for current month
  • thisWeekAmount (number): Total income amount for current week (starting from Sunday)
  • thisWeekCount (number): Number of income records for current week
  • todayAmount (number): Total income amount for today
  • todayCount (number): Number of income records for today

Common Errors

401 Unauthorized: Missing or invalid authentication token

403 Forbidden: User does not have permission to view financial statistics

404 Not Found: Workspace not found

500 Internal Server Error: Server error occurred while processing the request

Notes

  • All amounts are calculated in the workspace's currency
  • Date calculations use UTC timezone
  • Week starts on Sunday (00:00:00 UTC)