Get Spend Rules by Card
This endpoint returns all spend rules and velocity rules that are attached to a given payment card. The response includes amount limit rules, merchant category rules, merchant country rules, and velocity (time-windowed) rules. Use this endpoint to audit the spending controls in effect for any card before making changes or troubleshooting declined transactions.
Endpoint
GET /api/spendRules/v2/byCard
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 inspect the spending controls currently active on a payment card — for example, before adding or removing a rule, when diagnosing a declined transaction, or when displaying card restrictions in a partner-facing dashboard. This is the primary read endpoint for card-level spend rule management.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| paymentCardId | string | Yes | The unique identifier of the payment card whose spend rules should be retrieved. |
Response
200 OK
| Field | Type | Description |
|---|---|---|
| attachedSpendRules | array | List of spend rules attached to the card. Each item may be a base spend rule, an amount limit rule, a merchant category rule, or a merchant country rule. |
| attachedSpendRules[].id | string | Unique identifier of the spend rule. |
| attachedSpendRules[].name | string | Human-readable name of the spend rule. |
| attachedSpendRules[].version | string | Version string of the spend rule. |
| attachedSpendRules[].createdAt | string (date-time) | ISO 8601 timestamp when the rule was created. |
| attachedSpendRules[].updatedAt | string | ISO 8601 timestamp when the rule was last updated. |
| attachedSpendRules[].spendRuleType | integer | Rule type indicator: 0 = base, 1 = amount limit, 2 = merchant filter. |
| attachedSpendRules[].maximumAmount | object | Present on amount limit rules. Contains value (integer, in cents) and currencyCode (string, e.g. "USD"). |
| attachedSpendRules[].merchantCategoryAllowed | array of string | Present on merchant category rules. List of ISO merchant category codes that are explicitly allowed. |
| attachedSpendRules[].merchantCategoryBlocked | array of string | Present on merchant category rules. List of ISO merchant category codes that are blocked. |
| attachedSpendRules[].merchantCountryAllowed | array of string | Present on merchant country rules. List of ISO 3166 alpha-3 country codes that are explicitly allowed. |
| attachedSpendRules[].merchantCountryBlocked | array of string | Present on merchant country rules. List of ISO 3166 alpha-3 country codes that are blocked. |
| attachedVelocityRules | array | List of velocity rules attached to the card, which apply cumulative spending limits over a time window. |
| attachedVelocityRules[].id | string | Unique identifier of the velocity rule. |
| attachedVelocityRules[].name | string | Human-readable name of the velocity rule. |
| attachedVelocityRules[].velocityRuleWindow | integer | Time window for the rule: 0 = daily, 1 = weekly, 2 = monthly. |
| attachedVelocityRules[].cumulativeRule | object | The cumulative spend rule applied within the window (same structure as attachedSpendRules items). |
| attachedVelocityRules[].spendRules | array | Additional per-transaction spend rules bundled within this velocity rule. |
| attachedVelocityRules[].errors | array | Error details if the velocity rule could not be retrieved. Each item has path, code, and description fields. |
{
"attachedSpendRules": [
{
"id": "sr_abc123",
"name": "Max Per Transaction",
"version": "1",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-03-01T08:30:00Z",
"spendRuleType": 1,
"maximumAmount": {
"value": 50000,
"currencyCode": "USD"
},
"merchantCategoryAllowed": null,
"merchantCategoryBlocked": null,
"merchantCountryAllowed": null,
"merchantCountryBlocked": null
},
{
"id": "sr_def456",
"name": "Block Gambling",
"version": "1",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": null,
"spendRuleType": 2,
"maximumAmount": null,
"merchantCategoryAllowed": null,
"merchantCategoryBlocked": [
"BETTING_CASINO_GAMBLING",
"GOVERNMENT_LICENSED_ON_LINE_CASINO"
],
"merchantCountryAllowed": null,
"merchantCountryBlocked": null
}
],
"attachedVelocityRules": [
{
"id": "vr_ghi789",
"name": "Monthly Spend Cap",
"velocityRuleWindow": 2,
"cumulativeRule": {
"id": "sr_xyz001",
"name": "Monthly Max",
"version": "1",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": null,
"spendRuleType": 1,
"maximumAmount": {
"value": 500000,
"currencyCode": "USD"
},
"merchantCategoryAllowed": null,
"merchantCategoryBlocked": null,
"merchantCountryAllowed": null,
"merchantCountryBlocked": null
},
"spendRules": [],
"errors": null
}
]
}Error Codes
| Code | When it happens |
|---|---|
| 400 | paymentCardId is missing or malformed. |
| 401 | Token missing, expired, or invalid. |
| 403 | Insufficient permissions to view spend rules for this card. |
| 404 | No card found matching the provided paymentCardId. |
| 500 | Internal server error. |
Common Mistakes
- Omitting
paymentCardIdfrom the query string — the parameter is required even though the schema marks it without an explicitrequired: trueflag; the API will return an error or empty result without it. - Interpreting
maximumAmount.valueas a decimal dollar amount — values are in the smallest currency unit (cents for USD), so50000equals $500.00. - Assuming
merchantCategoryAllowedbeingnullmeans all categories are allowed — an empty or null allowed list combined with a non-empty blocked list means all categories are allowed except those explicitly blocked. - Confusing
velocityRuleWindowinteger codes:0= daily,1= weekly,2= monthly. - Using a card ID from a different partner's environment — card IDs are scoped to the partner; sandbox IDs will not work in production and vice versa.
Related Endpoints
GET /api/spendRules/v2/byProfile— Retrieve spend rules attached to a customer profile rather than a specific card.POST /api/spendRules/v2— Create a new spend rule.POST /api/spendRules/v2/attachToCard— Attach an existing spend rule to a payment card.DELETE /api/spendRules/v2/detachFromCard— Remove a spend rule from a payment card.
Example
curl -X GET "https://api.banking.netevia.dev/api/spendRules/v2/byCard?paymentCardId=card_abc123xyz" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"