Get Spending Report for Department
This endpoint returns a categorized breakdown of spending activity for a specific department within a given date range. The response includes individual spend amounts and percentages per category, as well as the total spend across all categories. It is part of the Teams feature set, which allows business customers to organize users and track financial activity by department.
Endpoint
POST /api/teams/departments/{departmentId}/spend-report
Authentication
Bearer token required. Obtain via:
POST https://api.banking.netevia.dev/api/auth/v2
Include in header: Authorization: Bearer {token}
Token lifetime: 10 minutes. Refresh via POST /api/auth/refresh.
When to use
Use this endpoint when you need to generate a spending summary for a department over a specific period — for example, monthly expense reviews, budget reconciliation, or departmental cost reporting. This is particularly useful for business customers who have organized their authorized users into departments and want to analyze spend patterns by category.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| departmentId | integer (int32) | Yes | The unique identifier of the department for which to retrieve the spending report. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| dateFrom | string (date-time) | No | The start of the reporting period in ISO 8601 date-time format. |
| dateTo | string (date-time) | No | The end of the reporting period in ISO 8601 date-time format. |
{
"dateFrom": "2025-01-01T00:00:00Z",
"dateTo": "2025-01-31T23:59:59Z"
}Response
200 OK
| Field | Type | Description |
|---|---|---|
| categories | array | List of spending breakdowns by merchant category. Each item contains category, amount, and percentage. |
| categories[].category | string | The merchant category name (e.g., "Travel", "Office Supplies"). |
| categories[].amount | integer (int64) | Total amount spent in this category, expressed in the smallest currency unit (e.g., cents). |
| categories[].percentage | number (double) | This category's share of total department spending, as a decimal percentage (e.g., 0.35 for 35%). |
| total | integer (int64) | The total amount spent across all categories for the period, expressed in the smallest currency unit (e.g., cents). |
{
"categories": [
{
"category": "Travel",
"amount": 125000,
"percentage": 0.50
},
{
"category": "Office Supplies",
"amount": 75000,
"percentage": 0.30
},
{
"category": "Software & Subscriptions",
"amount": 50000,
"percentage": 0.20
}
],
"total": 250000
}Error Codes
| Code | When it happens |
|---|---|
| 400 | Missing required fields or validation error (e.g., invalid date format) |
| 401 | Token missing, expired, or invalid |
| 403 | Insufficient permissions to access this department's data |
| 404 | Department not found for the given departmentId |
| 500 | Internal server error |
Common Mistakes
- Providing
dateFromordateToin a non-ISO 8601 format; always use thedate-timeformat (e.g.,2025-01-01T00:00:00Z). - Using a
departmentIdthat does not belong to the authenticated business customer's organization, which will result in a 404 or 403 error. - Misinterpreting
amountandtotalvalues — these are expressed in the smallest currency unit (cents), so250000equals $2,500.00. - Omitting both
dateFromanddateTo, which may return no results or an unexpected date range depending on server defaults.
Related Endpoints
GET /api/teams/departments— List all departments for the business customer.POST /api/teams/departments/{departmentId}/transactions— Retrieve individual transactions for a department.POST /api/teams/spend-report— Retrieve a spending report across all teams (not scoped to a single department).
Example
curl -X POST https://api.banking.netevia.dev/api/teams/departments/42/spend-report \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dateFrom": "2025-01-01T00:00:00Z",
"dateTo": "2025-01-31T23:59:59Z"
}'