Get Spending Report for Card
The spending report endpoint generates a detailed breakdown of transactions for a specific payment card within a defined date range. Results are organized by merchant category, each showing the total amount spent and its percentage of overall card spending. This makes it straightforward to analyze cardholder behavior, enforce budgets, or surface insights within a partner application.
Endpoint
POST /api/paymentCards/spendingReport
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 present a cardholder or account manager with a summary of how a payment card has been used over a period of time. It is well-suited for expense dashboards, monthly statements, and spend-control features where category-level aggregation (e.g., dining, travel, groceries) is more actionable than a raw transaction list. Both physical and virtual card IDs are accepted.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| paymentCardId | string | Yes | Unique identifier of the payment card to report on. Minimum length: 1 character. |
| dateFrom | string (date-time) | Yes | Start of the reporting period in ISO 8601 date-time format (e.g., 2025-01-01T00:00:00Z). |
| dateTo | string (date-time) | Yes | End of the reporting period in ISO 8601 date-time format (e.g., 2025-01-31T23:59:59Z). |
{
"paymentCardId": "card_abc123xyz",
"dateFrom": "2025-01-01T00:00:00Z",
"dateTo": "2025-01-31T23:59:59Z"
}Response
200 OK
| Field | Type | Description |
|---|---|---|
| categories | array | List of spending category objects. May be null if no transactions exist in the period. |
| categories[].category | string | Name of the merchant category (e.g., "Dining", "Travel", "Groceries"). Nullable. |
| categories[].amount | integer (int64) | Total amount spent in this category, expressed in the smallest currency unit (e.g., cents). |
| categories[].percentage | number (double) | Percentage of the card's total spending attributed to this category. |
| total | integer (int64) | Total amount spent across all categories for the requested period, in the smallest currency unit. |
{
"categories": [
{
"category": "Dining",
"amount": 15400,
"percentage": 30.8
},
{
"category": "Travel",
"amount": 22000,
"percentage": 44.0
},
{
"category": "Groceries",
"amount": 12600,
"percentage": 25.2
}
],
"total": 50000
}Error Codes
| Code | When it happens |
|---|---|
| 400 | Missing required fields (paymentCardId, dateFrom, or dateTo), invalid date-time format, or dateFrom is after dateTo |
| 401 | Token missing, expired, or invalid |
| 403 | Insufficient permissions to access spending data for the specified card |
| 404 | Payment card not found for the provided paymentCardId |
| 500 | Internal server error |
Common Mistakes
- Providing
dateFromafterdateTo— the date range must be chronologically ordered withdateFromearlier thandateTo. - Sending date strings without timezone information (e.g.,
2025-01-01T00:00:00with noZor offset) — always include a timezone designator to avoid ambiguous period boundaries. - Using a card display number instead of the internal
paymentCardId— the field requires the platform-assigned card ID, not the 16-digit PAN. - Expecting transaction-level detail in this response — this endpoint returns category aggregates only; use the transaction history endpoint for individual transaction records.
Related Endpoints
POST /api/paymentCards— Create a new payment card (physical, virtual, or burner)GET /api/paymentCards/{paymentCardId}— Retrieve details for a specific payment cardPOST /api/paymentCards/transactions— Retrieve individual transaction records for a card
Example
curl -X POST https://api.banking.netevia.dev/api/paymentCards/spendingReport \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"paymentCardId": "card_abc123xyz",
"dateFrom": "2025-01-01T00:00:00Z",
"dateTo": "2025-01-31T23:59:59Z"
}'