Documentation/API reference/Endpoints/
POST /v1/cards
Register one of your cards, or update it
Registers a card your institution issued, or updates it, by its card_token (your card processor's token for the card). A card event (POST /v1/card-authorizations) is accepted only for a registered card, so register each card when it is issued, and send its status when you change it (see the Cards guide).
A card belongs to one of your customers (customer_ref, required for a new card): a card never creates a customer, and a card keeps its customer and its data_classification for good. Never send a full card number: a card_token or masked_pan that holds one (13 to 19 digits that pass the Luhn check, with or without spaces or hyphens) is refused and nothing is stored. masked_pan carries at most the first six or eight digits and the last four, the rest masked with *, • or X.
status is ACTIVE, SUSPENDED or TERMINATED; a terminated card stays terminated. A status you set is yours: it is recorded and audited, and Underlayer sends you no webhook for it. A status Underlayer sets (a rule suspends or terminates the card; a person or an AI closure reinstates it) is sent to your webhook (cardStatusChanged). Making active a card that a monitoring alert still open suspended is your decision: it is done, and the answer warns you (OPEN_ALERT_SUSPENDED_CARD).
The same card_token with the same values changes nothing and answers changed: false, so no Idempotency-Key is needed. A card_token or customer_ref beginning EXAMPLE- is refused. Card registrations share the customer events' back-pressure, never the decisions' capacity.
Request body
A JSON object, at most 64 000 characters.
Example: A new virtual card (example references are refused)
{
"card_token": "EXAMPLE-CARD-0001",
"customer_ref": "EXAMPLE-CUST-0001",
"masked_pan": "411111******1111",
"card_type": "VIRTUAL_CARD",
"status": "ACTIVE",
"data_classification": "TEST"
}
Example: You suspended the card in your own system
{
"card_token": "EXAMPLE-CARD-0001",
"status": "SUSPENDED",
"data_classification": "TEST"
}
Request sample
curl -X POST "$UNDERLAYER_BASE_URL/v1/cards" \
-H "X-API-Key: $UNDERLAYER_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"card_token": "EXAMPLE-CARD-0001",
"customer_ref": "EXAMPLE-CUST-0001",
"masked_pan": "411111******1111",
"card_type": "VIRTUAL_CARD",
"status": "ACTIVE",
"data_classification": "TEST"
}
JSONimport os
import requests
response = requests.post(
os.environ["UNDERLAYER_BASE_URL"] + "/v1/cards",
headers={"X-API-Key": os.environ["UNDERLAYER_API_KEY"]},
json={
"card_token": "EXAMPLE-CARD-0001",
"customer_ref": "EXAMPLE-CUST-0001",
"masked_pan": "411111******1111",
"card_type": "VIRTUAL_CARD",
"status": "ACTIVE",
"data_classification": "TEST"
},
)
print(response.status_code, response.json())const response = await fetch(process.env.UNDERLAYER_BASE_URL + "/v1/cards", {
method: "POST",
headers: {
"X-API-Key": process.env.UNDERLAYER_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"card_token": "EXAMPLE-CARD-0001",
"customer_ref": "EXAMPLE-CUST-0001",
"masked_pan": "411111******1111",
"card_type": "VIRTUAL_CARD",
"status": "ACTIVE",
"data_classification": "TEST"
}),
});
console.log(response.status, await response.json());Written from the example on this page. UNDERLAYER_BASE_URL is https://api.underlayer.eu; UNDERLAYER_API_KEY is yours, given at onboarding.
Responses
| Status | Body | Description |
|---|---|---|
200 | CardResult | The card existed: it was updated ( |
201 | CardResult | The card was registered ( |
400 | ErrorBody | The body is not a JSON object, or the database refused the card with a
Correct the request; do not send it again unchanged. |
401 | ErrorBody | The key is missing, malformed (not |
403 | ErrorBody | The key is limited to allowed addresses and the request came from another one, the institution is not active, or this key may not send this data classification. |
413 | ErrorBody | The body is larger than the limit (64 000 bytes for payments, card events and customer events, 2 000 000 for a CDD import); a larger Content-Length is refused before the body is read and before the key is checked. Split it. |
429 | ErrorBody | Rate limited. Wait the seconds in |
500 | ErrorBody | The database refused the card with something other than a validation message, a fault on our side; |
503 | ErrorBody | The service cannot take the customer event or the card registration now; nothing was stored and your key was not judged. |
Examples of 201
Example: registered
{
"created": true,
"changed": true,
"warnings": [],
"card": {
"card_id": "00000000-0000-4000-8000-000000000051",
"card_token": "tok_7Hf2kQ9",
"customer_ref": "C-1001",
"masked_pan": "411111******1111",
"card_type": "VIRTUAL_CARD",
"status": "ACTIVE",
"data_classification": "TEST",
"updated_at": "2026-10-29T12:40:25.118402+00:00"
}
}
Examples of 400
Example: notJson
{
"error": "Body must be valid JSON",
"error_code": "BODY_NOT_JSON"
}
Example: notObject
{
"error": "Body must be a JSON object",
"error_code": "BODY_NOT_OBJECT"
}
Example: fullCardNumber
{
"error": "masked_pan holds a full card number: send at most the first six or eight digits and the last four, the rest masked",
"error_code": "FULL_PAN"
}
Example: unknownCustomer
{
"error": "customer_ref names no customer of this institution: register the customer first",
"error_code": "UNKNOWN_CUSTOMER"
}
Example: An EXAMPLE- reference, as in the request examples above
{
"error": "references beginning EXAMPLE- come from the documentation and are refused: send your own references",
"error_code": "EXAMPLE_ROW"
}
Examples of 401
Example: missing
{
"error": "Missing or malformed API key",
"error_code": "API_KEY_MISSING"
}
Example: invalid
{
"error": "Invalid or revoked API key",
"error_code": "API_KEY_INVALID"
}
Examples of 403
Example: addressNotAllowed
{
"error": "API key not allowed from this address",
"error_code": "API_KEY_ADDRESS_NOT_ALLOWED"
}
Example: institutionInactive
{
"error": "Institution is not active",
"error_code": "INSTITUTION_NOT_ACTIVE"
}
Example: classification
{
"error": "This API key may not submit TEST cards",
"error_code": "CLASSIFICATION_NOT_ALLOWED_FOR_KEY"
}
Examples of 413
Example: tooLarge
{
"error": "Request body too large",
"error_code": "BODY_TOO_LARGE"
}
Examples of 429
Example: failedAuthentications
{
"error": "Too many failed authentication attempts from this address; retry after the number of seconds in Retry-After",
"error_code": "TOO_MANY_FAILED_AUTHENTICATIONS"
}
Example: perKey
{
"error": "Too many requests for this API key; retry after the number of seconds in Retry-After",
"error_code": "RATE_LIMITED_KEY"
}
Example: perAddress
{
"error": "Too many requests from this address; retry after the number of seconds in Retry-After",
"error_code": "RATE_LIMITED_ADDRESS"
}
Examples of 500
Example: engine
{
"error": "Card registration error",
"error_code": "ENGINE_ERROR",
"code": "P0001"
}
Examples of 503
Example: busy
{
"error": "Service busy",
"error_code": "SERVICE_BUSY"
}
Example: keyCheck
{
"error": "Service unavailable",
"error_code": "SERVICE_UNAVAILABLE"
}
Example: settings
{
"error": "Service temporarily unavailable",
"error_code": "SERVICE_SETTINGS_UNUSABLE"
}
© 2026 Underlayer, Lithuania. info@underlayer.eu System status Privacy notice