Get Department Spending Report as Excel File

Generate and download a department spending report as an Excel file for a specified date range.

Get Department Spending Report as Excel File

This endpoint generates a spending report for a specific department and returns it as an Excel file. The report covers all card and account spending activity within the department for the requested time period. It is intended for finance teams and department managers who need structured, exportable spending data.

Endpoint

POST /api/teams/departments/{departmentId}/spend-report-xl

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 a business customer needs to export department-level spending data into a spreadsheet for accounting, auditing, or budgeting purposes. It is useful for generating period-end reports or reconciling team expenditures against budget allocations. The returned file content can be decoded and saved as an .xlsx file.

Path Parameters

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

Request Body

FieldTypeRequiredDescription
dateFromstring (date-time)NoStart of the reporting period in ISO 8601 date-time format.
dateTostring (date-time)NoEnd of the reporting period in ISO 8601 date-time format.
{
  "dateFrom": "2024-01-01T00:00:00Z",
  "dateTo": "2024-01-31T23:59:59Z"
}

Response

200 OK

FieldTypeDescription
namestringThe filename of the generated Excel report (e.g., spend-report-dept-42.xlsx).
contentstringBase64-encoded content of the Excel file. Decode and save with an .xlsx extension.
contentTypestringMIME type of the file, typically application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
{
  "name": "spend-report-dept-42-2024-01.xlsx",
  "content": "UEsDBBQABgAIAAAAIQD...",
  "contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}

Error Codes

CodeWhen it happens
400Missing required fields or validation error (e.g., dateTo is before dateFrom)
401Token missing, expired, or invalid
403Insufficient permissions to access the specified department
404Department with the given departmentId not found
500Internal server error

Common Mistakes

  • Providing a dateTo value that is earlier than dateFrom, resulting in an empty or invalid report.
  • Forgetting to Base64-decode the content field before saving the file — the raw string is not a valid .xlsx file until decoded.
  • Using a departmentId that belongs to a different partner or business customer, which returns 403 or 404.
  • Omitting both dateFrom and dateTo when a bounded report is needed — the API may return all available data or an empty report depending on server defaults.

Related Endpoints

  • POST /api/teams/departments/{departmentId}/spend-report — Get the department spending report as JSON data instead of an Excel file.
  • GET /api/teams/departments — List all departments available for the authenticated business customer.
  • GET /api/teams/departments/{departmentId} — Retrieve details for a specific department.

Example

curl -X POST https://api.banking.netevia.dev/api/teams/departments/42/spend-report-xl \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dateFrom": "2024-01-01T00:00:00Z",
    "dateTo": "2024-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