Skip to main content

Get Expense Stats (v1)

Method & Path

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

Description

Get expense 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": 30000.00,
"totalCount": 100,
"thisMonthAmount": 3000.00,
"thisMonthCount": 10,
"thisWeekAmount": 800.00,
"thisWeekCount": 2,
"todayAmount": 200.00,
"todayCount": 1
}

Response Fields

  • totalAmount (number): Total expense amount (all time)
  • totalCount (number): Total number of expense records (all time)
  • thisMonthAmount (number): Total expense amount for current month
  • thisMonthCount (number): Number of expense records for current month
  • thisWeekAmount (number): Total expense amount for current week (starting from Sunday)
  • thisWeekCount (number): Number of expense records for current week
  • todayAmount (number): Total expense amount for today
  • todayCount (number): Number of expense 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)