Documentation/API reference/Endpoints/
POST /v1/card-authorizations
Decide a card or ATM authorisation in real time
Records the card event, evaluates the institution's active real-time card rules and answers APPROVED or DECLINED at once; alerts, card actions (suspend, terminate) and the AI triage follow in the background and the answer never waits for them.
A refund (CARD_REFUND) or a reversal (CARD_REVERSAL) is recorded and evaluated by the same rules, and answered REFUNDED or REVERSED: it is never declined. A reversal names the approved authorisation or withdrawal of the same card it undoes (original_event_ref, the event_ref answered for it); a refund may. What is refunded and reversed against one event never exceeds its amount.
The card must already be registered for your institution under the same data classification (POST /v1/cards, or the card file on the Data imports screen); otherwise the event is refused with unknown card_token. A card a rule suspends or terminates on this event is reported to your webhook (card.suspended, card.terminated; the cardStatusChanged webhook), seconds after the answer.
The Idempotency-Key header is required: a card event is recognised only by it. Without it the event is refused (400) before anything else is read. Send a unique key for each event and the same key when you retry: a repeated key answers the card event's first decision with duplicate: true, and two requests with the same key wait for each other, so a concurrent repeat answers the card event's first decision too. A repeat must be the same event: one whose card_token, event_type, amount or currency differs from the first is refused 409 and nothing is stored.
Currencies, merchant_country and the card codes are upper-cased on arrival and checked before anything is stored (see CardAuthorizationRequest): a value of the wrong type or outside its values is a 400 naming the field. event_type and data_classification are compared exactly as sent. cvv_result or pin_result NO_MATCH declines the event. A card_token beginning EXAMPLE- is refused.
Parameters
| Name | In | Description |
|---|---|---|
Idempotency-Key required | header | Required for card events: a card event is recognised only by this key. Send a unique key for each event (for example a UUID), at most 255 characters, and the same key when you retry it. Without it, or with a blank one, the event is refused (400) before anything else is read. A repeated key with the same |
Request body
A JSON object, at most 64 000 characters.
Example: An e-commerce card payment (example references; an EXAMPLE- card token is refused)
{
"event_type": "CARD_AUTHORIZATION",
"card_token": "EXAMPLE-CARD-0001",
"amount": 49.9,
"currency": "EUR",
"event_time": "2026-09-02T18:04:11Z",
"merchant_name": "Example Shop UAB",
"merchant_id": "EXAMPLE-MERCHANT-01",
"mcc": "5732",
"merchant_country": "LT",
"entry_mode": "ECOMMERCE",
"three_ds_result": "AUTHENTICATED",
"data_classification": "TEST"
}
Example: A reversal of an approved authorisation (original_event_ref is the event_ref answered for it)
{
"event_type": "CARD_REVERSAL",
"card_token": "EXAMPLE-CARD-0001",
"amount": 49.9,
"currency": "EUR",
"original_event_ref": "CAE-2026-000321",
"data_classification": "TEST"
}
Request sample
curl -X POST "$UNDERLAYER_BASE_URL/v1/card-authorizations" \
-H "X-API-Key: $UNDERLAYER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: <a unique key for this request>" \
--data-binary @- <<'JSON'
{
"event_type": "CARD_AUTHORIZATION",
"card_token": "EXAMPLE-CARD-0001",
"amount": 49.9,
"currency": "EUR",
"event_time": "2026-09-02T18:04:11Z",
"merchant_name": "Example Shop UAB",
"merchant_id": "EXAMPLE-MERCHANT-01",
"mcc": "5732",
"merchant_country": "LT",
"entry_mode": "ECOMMERCE",
"three_ds_result": "AUTHENTICATED",
"data_classification": "TEST"
}
JSONimport os
import requests
response = requests.post(
os.environ["UNDERLAYER_BASE_URL"] + "/v1/card-authorizations",
headers={"X-API-Key": os.environ["UNDERLAYER_API_KEY"], "Idempotency-Key": "<a unique key for this request>"},
json={
"event_type": "CARD_AUTHORIZATION",
"card_token": "EXAMPLE-CARD-0001",
"amount": 49.9,
"currency": "EUR",
"event_time": "2026-09-02T18:04:11Z",
"merchant_name": "Example Shop UAB",
"merchant_id": "EXAMPLE-MERCHANT-01",
"mcc": "5732",
"merchant_country": "LT",
"entry_mode": "ECOMMERCE",
"three_ds_result": "AUTHENTICATED",
"data_classification": "TEST"
},
)
print(response.status_code, response.json())const response = await fetch(process.env.UNDERLAYER_BASE_URL + "/v1/card-authorizations", {
method: "POST",
headers: {
"X-API-Key": process.env.UNDERLAYER_API_KEY,
"Content-Type": "application/json",
"Idempotency-Key": "<a unique key for this request>",
},
body: JSON.stringify({
"event_type": "CARD_AUTHORIZATION",
"card_token": "EXAMPLE-CARD-0001",
"amount": 49.9,
"currency": "EUR",
"event_time": "2026-09-02T18:04:11Z",
"merchant_name": "Example Shop UAB",
"merchant_id": "EXAMPLE-MERCHANT-01",
"mcc": "5732",
"merchant_country": "LT",
"entry_mode": "ECOMMERCE",
"three_ds_result": "AUTHENTICATED",
"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 | CardAuthorizationResult | The decision ( |
400 | ErrorBody | The body is not a JSON object, or the database refused the event 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. |
409 | ErrorBody | The request repeats an earlier card event's |
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 event with something other than a validation message, a fault on our side; |
503 | ErrorBody | The service cannot take the payment or card event now; nothing was stored and your key was not judged. |
Examples of 200
Example: approved
{
"duplicate": false,
"event_id": "00000000-0000-4000-8000-000000000031",
"event_ref": "CAE-2026-000321",
"authorization_result": "APPROVED",
"decline_reason": null,
"flagged": false,
"rules_fired": [],
"alerts_generated": 0,
"correlation_id": "6f1c2f9e-0000-4000-8000-000000000033",
"latency_ms": 18
}
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: validation
{
"error": "unknown card_token",
"error_code": "UNKNOWN_CARD"
}
Example: No Idempotency-Key header
{
"error": "the Idempotency-Key header is required for card events: send a unique key for each event and the same key when you retry it",
"error_code": "MISSING_IDEMPOTENCY_KEY"
}
Example: cvv_result FAIL is refused with the message % must be one of %
{
"error": "cvv_result must be one of MATCH, NO_MATCH, NOT_PROVIDED",
"error_code": "INVALID_OPTION"
}
Example: A card_token beginning EXAMPLE-, as in the request example 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 events",
"error_code": "CLASSIFICATION_NOT_ALLOWED_FOR_KEY"
}
Examples of 409
Example: differentBody
{
"error": "this Idempotency-Key was already used for a card event with a different amount: retry with the same body, or send a new event with a new Idempotency-Key",
"error_code": "IDEMPOTENCY_CONFLICT"
}
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": "Authorization engine 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