Get Spending Report for Card as XLSX File
The POST /api/paymentCards/spendingReportXl endpoint generates a detailed spending report in Excel (XLSX) format for a specified payment card. The report covers all transactions made with the card during a defined date range and is returned as a file download object containing Base64-encoded content. This endpoint is useful for financial analysis, auditing, and record-keeping.
Endpoint
POST /api/paymentCards/spendingReportXl
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 cardholder or authorized user needs an exportable spending summary for a specific payment card. It is particularly valuable for end-of-period reporting, expense reconciliation, or providing customers with a downloadable transaction history in a format compatible with spreadsheet applications.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| paymentCardId | string | Yes | The unique identifier of the payment card for which the report is generated. Minimum length: 1 character. |
| dateFrom | string (date-time) | Yes | Start of the reporting period in ISO 8601 date-time format (e.g., 2024-01-01T00:00:00Z). |
| dateTo | string (date-time) | Yes | End of the reporting period in ISO 8601 date-time format (e.g., 2024-01-31T23:59:59Z). |
{
"paymentCardId": "card-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dateFrom": "2024-01-01T00:00:00Z",
"dateTo": "2024-01-31T23:59:59Z"
}Response
200 OK
| Field | Type | Description |
|---|---|---|
| name | string | The suggested filename for the generated XLSX file (e.g., spending_report_January_2024.xlsx). May be null. |
| content | string | Base64-encoded binary content of the XLSX file. Decode and save with an .xlsx extension to open in a spreadsheet application. May be null. |
| contentType | string | MIME type of the file content (e.g., application/vnd.openxmlformats-officedocument.spreadsheetml.sheet). May be null. |
{
"name": "spending_report_January_2024.xlsx",
"content": "UEsDBBQABgAIAAAAIQDfpNJsWgEAACAFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAA...",
"contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}Error Codes
| Code | When it happens |
|---|---|
| 400 | Missing required fields (paymentCardId, dateFrom, or dateTo) or invalid date-time format |
| 401 | Token missing, expired, or invalid |
| 403 | Insufficient permissions to access the specified card |
| 404 | Payment card not found for the provided paymentCardId |
| 500 | Internal server error |
Common Mistakes
- Providing
dateFromordateToin a non-ISO 8601 format; always use thedate-timeformat such as2024-01-01T00:00:00Z. - Setting
dateFromlater thandateTo, which results in an empty or invalid report range. - Omitting
paymentCardIdor passing an empty string; the field has a minimum length of 1 character and is required. - Attempting to decode the
contentfield without Base64 decoding first; the XLSX binary is Base64-encoded in the response.
Related Endpoints
POST /api/paymentCards/spendingReport— Retrieve a spending report for a card in JSON format instead of XLSXGET /api/paymentCards/{paymentCardId}— Retrieve details for a specific payment cardGET /api/paymentCards— List all payment cards for the authenticated customer
Example
curl -X POST https://api.banking.netevia.dev/api/paymentCards/spendingReportXl \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"paymentCardId": "card-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"dateFrom": "2024-01-01T00:00:00Z",
"dateTo": "2024-01-31T23:59:59Z"
}'