Get Spending report for the department

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

ParameterTypeRequiredDescription
departmentIdinteger (int32)YesThe unique identifier of the department for which to retrieve the spending report.

Request Body

FieldTypeRequiredDescription
dateFromstring (date-time)NoThe start of the reporting period in ISO 8601 date-time format.
dateTostring (date-time)NoThe 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

FieldTypeDescription
categoriesarrayList of spending breakdowns by merchant category. Each item contains category, amount, and percentage.
categories[].categorystringThe merchant category name (e.g., "Travel", "Office Supplies").
categories[].amountinteger (int64)Total amount spent in this category, expressed in the smallest currency unit (e.g., cents).
categories[].percentagenumber (double)This category's share of total department spending, as a decimal percentage (e.g., 0.35 for 35%).
totalinteger (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

CodeWhen it happens
400Missing required fields or validation error (e.g., invalid date format)
401Token missing, expired, or invalid
403Insufficient permissions to access this department's data
404Department not found for the given departmentId
500Internal server error

Common Mistakes

  • Providing dateFrom or dateTo in a non-ISO 8601 format; always use the date-time format (e.g., 2025-01-01T00:00:00Z).
  • Using a departmentId that does not belong to the authenticated business customer's organization, which will result in a 404 or 403 error.
  • Misinterpreting amount and total values — these are expressed in the smallest currency unit (cents), so 250000 equals $2,500.00.
  • Omitting both dateFrom and dateTo, 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"
  }'
Path Params
int32
required
Body Params
date-time
date-time
Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
string
enum
Defaults to application/json

Generated from available request content types

Allowed:
Response

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/plain
application/json
text/json