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
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace 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 monththisMonthCount(number): Number of expense records for current monththisWeekAmount(number): Total expense amount for current week (starting from Sunday)thisWeekCount(number): Number of expense records for current weektodayAmount(number): Total expense amount for todaytodayCount(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)