# Underlayer client API: the integration file for AI coding tools > Real-time payment and card decisioning, decision look-up and CDD intake for e-money and payment institutions. This one file is written for an AI coding tool (Claude Code, Cursor, Codex and the like) that a developer asks to build or change a client system's integration with the Underlayer client API. It holds everything an integration needs: the address, headers and keys, every operation with its fields, values and examples, the answers, idempotency and retries, the webhook signature check, the strict rules and the steps that check an integration in the sandbox. It is generated from `openapi.yaml` (version `2026-11-17`) and the guides; where the two seem to differ, `openapi.yaml` is the contract. ## 0. How to work from this file 1. Read sections 1 and 2 before you write any code. 2. Build and test against the developer's **sandbox institution** only, with `TEST` data (section 6). 3. Take the base address, the API key, the webhook secret and the data classification from configuration: `UNDERLAYER_BASE_URL`, `UNDERLAYER_API_KEY`, `UNDERLAYER_WEBHOOK_SECRET` and `UNDERLAYER_DATA_CLASSIFICATION`. If one is not configured, ask the developer; never invent one. 4. Copy field names and values from section 3 exactly. Where the developer's request needs something section 3 does not have, say so. 5. Finish with the sandbox check steps (section 6) and report each result. ## 1. Strict rules - **Do not rename fields or values.** Send every field name exactly as this file lists it, in `snake_case` (`external_transaction_id`, never `externalTransactionId` or `transactionId`), and every coded value exactly as listed (`SEPA`, `OUTGOING`, `TEST`, `CARD_AUTHORIZATION`, `LOGIN_SUCCESS`; `Business` and `Individual` as written). Do not translate, abbreviate, pluralise or re-case them. Map your system's own names to these in one place; never the reverse. - **Do not add fields.** A payment or card event ignores a field it does not list, so a misspelt field is lost without an error; a card registration or a CDD row with a field it does not list is refused (`UNKNOWN_FIELD`). Send only the fields of this file. - **Do not invent endpoints, values or answers.** Everything the API takes and answers is below; if the developer asks for something this file does not have, say so instead of guessing. - **The data classification is named twice differently:** `data_classification` on payments, cards, card events and customer events; `classification` on a CDD import. Read its value from `UNDERLAYER_DATA_CLASSIFICATION`: `TEST` in the sandbox, `PRODUCTION` when the developer goes live. Never hard-code it. - **Keep the base address, the API key and the webhook secret out of the code.** Read them from configuration (`UNDERLAYER_BASE_URL`, `UNDERLAYER_API_KEY`, `UNDERLAYER_WEBHOOK_SECRET`), from the developer's secret store in production; never hard-code, print, log or commit them, and never put them in a test fixture or an error message. - **Use your own references.** References that begin `EXAMPLE-` (every example below uses them) are refused on purpose: a copied example never creates data. - **Never send a full card number.** A card is named by the card processor's token (`card_token`); a `masked_pan` holds at most the first six or eight digits and the last four. - **Send dates and times in ISO 8601** (`2026-09-01`, `2026-09-01T09:15:00Z`) and amounts as JSON numbers or decimal strings with at most two decimals ("Value formats" below). - Settle only `RELEASED`. A `2xx` answer is never an approval by itself. - Retry safely: the same `source_system` and `external_transaction_id` (and `Idempotency-Key`) for a payment, the same `Idempotency-Key` for a card event. - Never retry a `4xx` other than `429` unchanged; wait at least `Retry-After` on a `429` or `503`. - Read an error by its HTTP status and `error_code` (Errors), never by its words. - Ignore answer fields you do not know: new ones are added within v1 (Versioning and changelog). - Read times in answers as ISO 8601 date-times: they carry microseconds and a zone offset (`2026-09-01T09:15:01.102345+00:00`), so parse them, never compare or cut them as text. - Verify every webhook's signature on the raw body before you parse it. ## 2. Address, headers and keys ### The base address Every path below is appended to `$UNDERLAYER_BASE_URL`, for example `$UNDERLAYER_BASE_URL/v1/transactions`. Every request and answer is JSON over HTTPS. The base address is the server of `openapi.yaml`, the same for sandbox and production keys: this file names it only by its placeholder. The API key, not the address, decides which institution a request is for; during integration it is the key of the developer's **sandbox institution**: As in the test and live modes of payment APIs, your test data and your real data live apart: | Institution | Takes | Figures count | |---|---|---| | Production | `PRODUCTION` data only. A `TEST`, `SCALE_TEST` or `DEMO` payment, card event or CDD file is refused (`400`). | Its production records. | | Sandbox | Any data classification its keys allow. | Everything it holds: it is all test data. | Each institution has its own keys. Build and test your integration against your sandbox institution; switch to the production institution's key when you go live. An institution never goes from production to sandbox. A platform administrator of Underlayer can empty a sandbox's test data before a new round of tests (its settings, people and keys stay). ### Headers | Header | Sent with | Value | |---|---|---| | `X-API-Key` | Every request but `GET /v1/health`. | `$UNDERLAYER_API_KEY`: `.`, for example `ak_0123456789abcdef.<48 hexadecimal characters>`. Only a hash of the secret is stored; a lost key cannot be shown again, issue a new one. A key may be limited to allowed IP addresses and ranges: from any other address it answers `403` (`API key not allowed from this address`). | | `Content-Type` | Every `POST`. | `application/json`. Every body is a JSON object, UTF-8. | | `Idempotency-Key` | `POST /v1/card-authorizations`: **required**. | 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 `card_token`, `event_type`, `amount` and `currency` answers the card event's first decision with `duplicate: true`; with another of them it is refused `409`. Requests with the same key wait for each other, so a concurrent repeat answers the card event's first decision too. | | `Idempotency-Key` | `POST /v1/transactions`: optional, recommended. | Your unique key for this payment, unique within your institution (for example a UUID). Optional: a payment is also recognised by `source_system` + `external_transaction_id` without it. A repeated key creates nothing new and answers `duplicate: true` with the payment's current decision, which may have moved on since you sent it (from AI_INVESTIGATION to RELEASED or BLOCKED, for example). A repeat must be the same payment: one whose compared fields differ from the earlier one's is refused `409` and nothing is stored. Requests with the same key wait for each other, so a concurrent repeat answers the first request's decision. (A card event's `Idempotency-Key` is required, and a repeat there answers the card event's first decision: see `POST /v1/card-authorizations`.) | Every answer carries `X-Request-Id`, an identifier our server makes for that request: log it with the request and quote it when you contact Underlayer. ### Keys and secrets | Placeholder | What it holds | Where it comes from | |---|---|---| | `UNDERLAYER_BASE_URL` | The base address of the API: the server of `openapi.yaml`. | The same for sandbox and production keys; the key decides the institution. | | `UNDERLAYER_API_KEY` | The API key, `.`. | Issued by an administrator of the institution on the *API and webhooks* screen and shown once. | | `UNDERLAYER_WEBHOOK_SECRET` | The webhook signing secret. | Set on the *API and webhooks* screen and shown once. | | `UNDERLAYER_DATA_CLASSIFICATION` | The data classification every request sends: `TEST` in the sandbox, `PRODUCTION` live. | The developer's configuration; the key must allow the value (`403` otherwise). | #### The API key Every client endpoint takes one header: ```http X-API-Key: . ``` The key is `ak_` and 16 hexadecimal characters, a dot, and 48 hexadecimal characters. The health route (`GET /v1/health`) is the only endpoint that needs no key. The key decides your institution. Nothing in a request can choose another one: every payment, card event, customer and decision look-up is your institution's own, and a payment of another institution answers `404` and is never read. #### Rotating a key 1. Issue the new key. 2. Switch every caller to it. 3. Revoke the old key. A request with a revoked key answers `401` (`Invalid or revoked API key`). Revoke a key at once if it may have leaked. 20 failed authentications from one address within 10 minutes refuse that address for 10 minutes, a right key included (Rate limits and back-pressure). ## 3. Operations | | Operation | What it does | |---|---|---| | 3.1 | `POST /v1/transactions` | Submit a payment for real-time monitoring and get its decision | | 3.2 | `GET /v1/transactions/{id}/decision` | Read the current decision for one of your payments | | 3.3 | `POST /v1/cards` | Register one of your cards, or update it | | 3.4 | `POST /v1/card-authorizations` | Decide a card or ATM authorisation in real time | | 3.5 | `POST /v1/customer-events` | Record something the customer did that is not a payment | | 3.6 | `POST /v1/cdd-ingest` | Send customer due diligence (CDD / KYC) records | | 3.7 | `GET /v1/health` | Liveness | Send a customer's CDD record (3.6) before the customer's payments, card registrations and customer events, and a card registration (3.3) before the card's events. ### 3.1. `POST /v1/transactions`: Submit a payment for real-time monitoring and get its decision Operation `submitPayment`. Header `X-API-Key`. Header `Idempotency-Key`: optional. Records the payment and its decision, then evaluates it with the institution's own monitoring rules and screens it against the sanctions lists in real time, within a budget of 12 seconds. A customer's PEP status is your own KYC determination, sent with the customer's record (`pep_determination`). If screening does not finish in time or fails, the payment is held for a person (`HUMAN_REVIEW`, `screening_timeout: true`): it is never released unscreened. When the server has no capacity left to hold it at once, the answer is `202` with `status: SCREENING` and `screening_timeout: true`, and the scheduled sweep holds it within minutes; poll the decision. A payment held this way is screened again in the background within minutes of its arrival: if that screening finds nothing it is released (`decision.released` to the webhook), otherwise it stays held with its alerts. A payment no person has acted on and that arrived less than an hour ago is the only one screened this way; any other stays with a person. - `200` with `status: RELEASED`: screened, nothing found, the payment may settle. - `202` with `status: BLOCKED`: **rejected, and final**: do not settle, and do with the funds what `rejection_action` says (`REJECT` or `FREEZE`); the decision does not change, except that a `FREEZE` can later be lifted to `REJECT` (`decision.freeze_lifted`). - `202` with any other status: **accepted for screening only; do not settle.** The decision changes later (a person, or your decision policy on the AI triage's recommendation); you are told by the decision webhook, or poll `GET /v1/transactions/{id}/decision`. - `200` with `duplicate: true`: this payment was already received (same `source_system` and `external_transaction_id`, or same `Idempotency-Key`); the answer is its current decision. Check `status`: a duplicate answers 200 whatever its status. A repeat must be the same payment: one whose `customer_ref`, `amount`, `currency`, `direction`, `channel` or `instant` differs from the first is refused `409`, and so is one whose `Idempotency-Key` names one payment and whose reference another; nothing is stored. - `202` with `status: POST_EVENT` and `post_event: true`: a payment your system **already executed** while Underlayer could not be reached, sent afterwards with `executed_during_outage: true` and the time it was executed in `transaction_timestamp`. It has no decision: Underlayer never holds, releases or rejects it. It is screened against the sanctions lists and evaluated by your monitoring rules after the event, as of the time it was executed, and any alert goes to your team. Accepted only when your institution's policy for payments while Underlayer cannot be reached is `SKIP_AND_CHECK_LATER` (Settings, Decision policies); not chosen, or `HOLD`, answers 400. A repeat answers `200` with `duplicate: true` and `status: POST_EVENT`. Fields not listed in the schema are ignored. Which fields are required depends on the channel (see `PaymentRequest`). **Request body:** `PaymentRequest`. #### `PaymentRequest` Required for every payment: external_transaction_id, customer_ref, channel, direction, amount, currency. Required by channel: SEPA also counterparty; SWIFT also origin_country and destination_country. Every amount, currency, country and card_present is checked before anything is stored, and a value of the wrong type is refused with a 400 naming the field. Codes are upper-cased: a currency must be three letters (Currency), a country a code of the platform's country list (Country). An external_transaction_id or customer_ref beginning EXAMPLE- (in any case) is refused. The session and device fields (ip_address, ip_country, device_id, device_timezone, device_utc_offset, session_id, initiation_channel, initiation, device_os, vpn_or_proxy, remote_access_detected) are optional and never refuse the payment: a malformed one is stored as nothing and named in the answer's warnings, a field left out says nothing. The payee fields (counterparty_account, counterparty_relationship, payee_verification, available_balance, balance_currency) are optional and refused (400) when malformed, like every other field. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `external_transaction_id` | yes | string | at least 1 characters | Your unique id for this payment within source_system. Sending it again returns the payment's current decision (duplicate). One beginning EXAMPLE- is refused (400). | | `source_system` | | string | default `API` | Which of your systems sent the payment. Part of the payment's identity together with external_transaction_id. | | `customer_ref` | yes | string | | Your customer reference, as in the CDD intake. An unknown one opens a provisional customer (KYC incomplete, risk High) unless your decision policy forbids it or today's limit is reached; then the answer is 400 unknown customer_ref. One beginning EXAMPLE- is refused (400). | | `customer_name` | | string | | Used only when the payment opens a provisional customer. | | `customer_type` | | string | one of `Business`, `Individual` | Used only when the payment opens a provisional customer (default Individual; another value counts as Individual). | | `customer_country` | | `Country` | see `Country` in "Value formats" | Used only when the payment opens a provisional customer (default XX, unknown). A code you send must be on the platform's country list, so XX itself is refused. | | `account_number` | | string | | The customer's account the payment was booked on; linked when it belongs to that customer, otherwise ignored. | | `channel` | yes | string | one of `SEPA`, `SWIFT`, `CARD`, `ATM` | The payment rail (case-insensitive). Decides which fields are required. | | `direction` | yes | string | one of `INCOMING`, `OUTGOING` | Incoming or outgoing for your customer (case-insensitive). | | `amount` | yes | `Amount` | see `Amount` in "Value formats" | Greater than zero, in currency, at most two decimals. Missing: 400 amount is required. Zero or negative: 400 amount must be greater than zero. Not a decimal number: 400 amount must be a decimal number such as 125.50 (no exponent, NaN or Infinity). | | `currency` | yes | `Currency` | see `Currency` in "Value formats" | ISO 4217 code, for example EUR. Missing or not three letters - 400 currency must be a three-letter ISO 4217 currency code such as EUR. | | `transaction_timestamp` | | `IsoDateTime` | see `IsoDateTime` in "Value formats" | When the payment happened. Default the time of receipt. | | `payment_type` | | string | | Your own payment type label. Default " ", for example "SEPA Outgoing". | | `origin_country` | | `Country` | see `Country` in "Value formats" | The country the money comes from. Required for SWIFT. | | `destination_country` | | `Country` | see `Country` in "Value formats" | The country the money goes to. Required for SWIFT. | | `counterparty` | | string | | Name of the other party. Required for SEPA. Screened against the sanctions lists. | | `counterparty_country` | | `Country` | see `Country` in "Value formats" | The other party's country. | | `counterparty_type` | | string | one of `INDIVIDUAL`, `LEGAL_ENTITY`, `FINANCIAL_INSTITUTION`, `GOVERNMENT`, `MERCHANT`, `OTHER` | Case-insensitive. | | `counterparty_sector_code` | | string | | A sector code from the platform's list (active codes only). Leave it out unless you were given the list. | | `payment_reference` | | string | | Free text of the payment (purpose). Rules can compare and group by it. | | `originator` | | string | | Sender's name (wires). Screened. | | `originator_bic` | | string | | | | `beneficiary` | | string | | Recipient's name (wires). Screened. | | `beneficiary_bic` | | string | | | | `intermediary_bank` | | string | | | | `card_reference` | | string | | Your card reference for a card payment. | | `card_present` | | boolean or string | | true or false (or the strings "true" / "false" in any case); anything else, yes, no, 1 and 0 included, answers 400 card_present must be true or false. | | `instant` | | boolean or string | | true for a SEPA Instant credit transfer (SCT Inst), which must be executed within ten seconds of the order; default false. Read like card_present (anything else answers 400 instant must be true or false). Only a SEPA payment can be one: true with another channel answers 400 instant is only for SEPA payments. | | `merchant_name` | | string | | | | `merchant_country` | | `Country` | see `Country` in "Value formats" | | | `mcc` | | string | | Four-digit merchant category code. | | `atm_id` | | string | | | | `atm_location` | | string | | | | `correlation_id` | | string | | Your own trace id, echoed in answers and webhooks. Default a random UUID. | | `data_classification` | | `DataClassification` | one of `PRODUCTION`, `TEST`, `SCALE_TEST`, `DEMO`; default `PRODUCTION`; see `DataClassification` in "Value formats" | | | `executed_during_outage` | | boolean or string | | true for a payment your system already executed while Underlayer could not be reached and sends afterwards; read like card_present (true, false, "true", "false"; anything else 400 executed_during_outage must be true or false). It then needs transaction_timestamp, the time it was executed (not later than five minutes after it is sent), and your institution's policy SKIP_AND_CHECK_LATER; the answer is 202 POST_EVENT, with no decision. Leave it out, or false, for every payment you send before it moves. | | `counterparty_account` | | string | at most 64 characters | The other party's account: the payee's on an outgoing payment, the payer's on an incoming one. Spaces are taken out and letters upper-cased; 1 to 34 letters and digits. A value shaped as an IBAN must begin with a known country code and pass the IBAN check (ISO 13616, mod 97). Anything else is refused (400 "% must be 1 to 34 letters and digits (spaces are taken out)", "% looks like an IBAN but does not begin with a known country code" or "% looks like an IBAN but its check digits are wrong"). | | `counterparty_relationship` | | string | one of `SELF`, `RELATED_PARTY`, `UNRELATED` | The other party's relationship to your customer, as you know it (SELF, the customer's own account elsewhere). Upper-cased on arrival; another value is refused (400 "% must be one of %"). | | `payee_verification` | | string | one of `MATCH`, `CLOSE_MATCH`, `NO_MATCH`, `NOT_POSSIBLE` | The Verification of Payee result your system got for this payment (Regulation (EU) 2024/886). Upper-cased on arrival; another value is refused (400 "% must be one of %"). | | `available_balance` | | `Amount` | see `Amount` in "Value formats" | The customer's available balance before this payment, in balance_currency. May be zero or negative. Stamped in EUR at the reference rate. | | `balance_currency` | | `Currency` | see `Currency` in "Value formats" | The currency of available_balance (default the payment's currency); not stored without available_balance. | | `ip_address` | | string | | The IP address the customer used, one IPv4 or IPv6 host address (203.0.113.10, 2001:db8::10; no prefix). Never refuses the payment: a malformed one is a warning. Our own IP-to-country lookup (DB-IP Lite) checks ip_country and fills it in when you send none. | | `ip_country` | | string | | The IP's country as your own geolocation found it, a code of the platform's country list. Yours wins; when ours disagrees the payment is marked ("IP country sent differs from our lookup"). Never refuses the payment. | | `device_id` | | string | | Your stable identifier of the customer's device (your device SDK's): 8 to 128 letters, digits or . _ : + / = -. Never refuses the payment. | | `device_timezone` | | string | | The device's IANA time zone, such as Europe/Vilnius. Its UTC offset at the payment's time is stored with it. Never refuses the payment. | | `device_utc_offset` | | string | | The device's UTC offset, +hh:mm or -hh:mm, -12:00 to +14:00 in quarter hours. With device_timezone, the zone's own offset is stored and a different one is a warning. Never refuses the payment. | | `session_id` | | string | | Your session id, 1 to 128 printable characters without spaces. Only its SHA-256 (with your institution) is stored, so rules can tell payments of one session apart from others. Never refuses the payment. | | `initiation_channel` | | string | one of `MOBILE_APP`, `WEB_BROWSER`, `API`, `BRANCH`, `PHONE`, `OTHER` | How the customer initiated the payment. Upper-cased on arrival. Never refuses the payment. | | `initiation` | | string | one of `CUSTOMER_INITIATED`, `STANDING_ORDER`, `SCHEDULED`, `DIRECT_DEBIT`, `MERCHANT_INITIATED`, `BULK_UPLOAD`, `STAFF_INITIATED`, `OTHER` | Who or what started the payment. Upper-cased on arrival. Never refuses the payment. | | `device_os` | | string | one of `ANDROID`, `IOS`, `WINDOWS`, `MACOS`, `LINUX`, `OTHER` | The device's operating system. No user agent is taken. Never refuses the payment. | | `vpn_or_proxy` | | boolean or string | | true when your tools saw a VPN, proxy or anonymiser (true, false, "true", "false"). Never refuses the payment. | | `remote_access_detected` | | boolean or string | | true when your tools saw remote-access software on the device during the session. Never refuses the payment. | **Example requests** (the `EXAMPLE-` references are refused: put your own in their place): An outgoing SEPA transfer (example references; never send them with a production key): ```json { "external_transaction_id": "EXAMPLE-TX-0001", "source_system": "CORE-BANKING", "customer_ref": "EXAMPLE-C-0001", "account_number": "EXAMPLE-ACC-0001", "channel": "SEPA", "direction": "OUTGOING", "amount": 1250, "currency": "EUR", "transaction_timestamp": "2026-09-01T09:15:00Z", "counterparty": "Example Supplier GmbH", "counterparty_country": "DE", "counterparty_type": "LEGAL_ENTITY", "origin_country": "LT", "destination_country": "DE", "payment_reference": "Invoice 2026-118", "data_classification": "TEST" } ``` The same transfer with the optional session, device and payee fields (see the Session and device data guide): ```json { "external_transaction_id": "EXAMPLE-TX-0002", "source_system": "CORE-BANKING", "customer_ref": "EXAMPLE-C-0001", "channel": "SEPA", "direction": "OUTGOING", "amount": 1250, "currency": "EUR", "transaction_timestamp": "2026-09-01T09:15:00Z", "counterparty": "Example Supplier GmbH", "counterparty_country": "DE", "counterparty_account": "DE89370400440532013000", "counterparty_relationship": "UNRELATED", "payee_verification": "MATCH", "available_balance": 4800, "balance_currency": "EUR", "ip_address": "203.0.113.10", "ip_country": "LT", "device_id": "dev-7f3a9c21", "device_timezone": "Europe/Vilnius", "session_id": "sess-5d1e0b", "initiation_channel": "MOBILE_APP", "initiation": "CUSTOMER_INITIATED", "device_os": "IOS", "vpn_or_proxy": false, "remote_access_detected": false, "data_classification": "TEST" } ``` **Answers:** **`200`** (body `PaymentDecision` or `PostEventPayment`). Released (`status: RELEASED`), or a replayed duplicate (`duplicate: true`, any status; `status: POST_EVENT` for a payment sent after an outage). **`202`** (body `PaymentDecision` or `PostEventPayment`). Accepted for screening only. The payment must not be settled: `status` is not `RELEASED`. With `status: BLOCKED` the payment is rejected and the decision is final: act on `rejection_action`. Or, with `status: POST_EVENT`, a payment your system already executed during an outage: checked after the event, never decided. **`400`** (body `ErrorBody`). The body is not a JSON object, or the database refused the payment with a `VALIDATION:` message, answered without its prefix. A value of the wrong type is refused this way, with the field's name. The messages are listed on the Errors page, "Payment refusals (400)"; `%` stands for the field or the value you sent: - institution is not active (`error_code` `INSTITUTION_NOT_ACTIVE`) - transaction_timestamp must be a date YYYY-MM-DD or a date-time YYYY-MM-DDThh:mm[:ss[.ffffff]] with an optional zone Z, +hh:mm or -hh:mm (no zone = UTC), such as 2026-09-01T14:30:00Z (`error_code` `INVALID_DATE_TIME`) - data_classification % is not accepted by the decisioning engine (`error_code` `INVALID_DATA_CLASSIFICATION`) - data_classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only (`error_code` `CLASSIFICATION_NOT_ACCEPTED`) - external_transaction_id is required (`error_code` `MISSING_EXTERNAL_TRANSACTION_ID`) - references beginning EXAMPLE- come from the documentation and are refused: send your own references (`error_code` `EXAMPLE_ROW`) - unknown channel % (`error_code` `INVALID_CHANNEL`) - channel % is disabled (`error_code` `CHANNEL_DISABLED`) - direction % is not supported on % (`error_code` `INVALID_DIRECTION`) - % is required (`error_code` `MISSING_FIELD`) - % must be a number (`error_code` `INVALID_NUMBER`) - % must be a decimal number such as 125.50 (no exponent, NaN or Infinity) (`error_code` `INVALID_DECIMAL`) - % may have at most two decimals (`error_code` `TOO_MANY_DECIMALS`) - % exceeds the largest supported amount, 999999999999.99 (`error_code` `AMOUNT_TOO_LARGE`) - % must be greater than zero (`error_code` `AMOUNT_NOT_POSITIVE`) - % must be a three-letter ISO 4217 currency code such as EUR (`error_code` `INVALID_CURRENCY`) - % must be a two-letter ISO 3166-1 alpha-2 country code such as LT (`error_code` `INVALID_COUNTRY`) - % must be true or false (`error_code` `INVALID_BOOLEAN`) - % must be one of % (`error_code` `INVALID_OPTION`) - % must be 1 to 34 letters and digits (spaces are taken out) (`error_code` `INVALID_ACCOUNT`) - % looks like an IBAN but does not begin with a known country code (`error_code` `INVALID_IBAN_COUNTRY`) - % looks like an IBAN but its check digits are wrong (`error_code` `INVALID_IBAN_CHECK_DIGITS`) - % is required for % payments (`error_code` `MISSING_CHANNEL_FIELD`) - instant is only for SEPA payments (`error_code` `INSTANT_NOT_SEPA`) - unsupported counterparty_type % (`error_code` `INVALID_COUNTERPARTY_TYPE`) - counterparty_sector_code % is unknown or retired (`error_code` `INVALID_COUNTERPARTY_SECTOR_CODE`) - unknown customer_ref % (`error_code` `UNKNOWN_CUSTOMER`) - transaction_timestamp is required when executed_during_outage is true: send the time your system executed the payment (`error_code` `OUTAGE_TIMESTAMP_REQUIRED`) - transaction_timestamp of a payment executed during an outage cannot be later than the time it is sent (`error_code` `OUTAGE_TIMESTAMP_IN_FUTURE`) - executed_during_outage is refused: your institution has not chosen its policy for payments while Underlayer cannot be reached (Settings, Decision policies), so every payment is decided in real time (`error_code` `OUTAGE_POLICY_NOT_CHOSEN`) - executed_during_outage is refused: your institution's policy is to hold payments while Underlayer cannot be reached, so send the payment without it and it is decided in real time (`error_code` `OUTAGE_POLICY_HOLD`) Correct the request; do not send it again unchanged. **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `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`** (body `ErrorBody`). The request repeats an earlier payment's reference or key but is not the same payment; nothing was stored. `this external_transaction_id or Idempotency-Key was already used for a payment with a different %: retry with the same body, or send a new payment with a new external_transaction_id and a new Idempotency-Key` (`%` names the fields that differ: `customer_ref`, `amount`, `currency`, `direction`, `channel`; never a value), or `the Idempotency-Key and the external_transaction_id name two different payments: retry with the key and the reference you sent the first time`. **`413`**: `PayloadTooLarge`, as 3.8 "Answers several endpoints share" says. **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The database refused the payment with something other than a validation message. `code` is the database's error code: for example `P0001`, no decision policy is in force for your institution. A value of the wrong type is never answered here: it is a 400, and a concurrent repeat waits for the first request and answers its decision. Retry the same request once (it is idempotent); if it fails again with the same code, contact Underlayer. **`503`**: `DecisionServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Example answers:** `200`: ```json { "duplicate": false, "transaction_id": "00000000-0000-4000-8000-000000000001", "decision_id": "00000000-0000-4000-8000-000000000002", "decision_ref": "DEC-2026-000123", "status": "RELEASED", "rejection_action": null, "decision_reason": "No monitoring rule triggered and no restriction requires review", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000003", "received_at": "2026-09-01T09:15:01.102345+00:00", "policy_version": "decision-policy-v1.6", "alert_id": null, "triggered_rules": [], "rules_evaluated": 9, "rules_deferred": 0, "tm_latency_ms": 41, "total_latency_ms": 63, "estimated_next_state": "final" } ``` `200`, Released; one session field was malformed and not stored (the payment is never refused for it): ```json { "duplicate": false, "transaction_id": "00000000-0000-4000-8000-000000000041", "decision_id": "00000000-0000-4000-8000-000000000042", "decision_ref": "DEC-2026-000126", "status": "RELEASED", "rejection_action": null, "decision_reason": "No monitoring rule triggered and no restriction requires review", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000043", "received_at": "2026-09-01T09:30:01.102345+00:00", "policy_version": "decision-policy-v1.6", "alert_id": null, "triggered_rules": [], "rules_evaluated": 9, "rules_deferred": 0, "tm_latency_ms": 40, "total_latency_ms": 61, "estimated_next_state": "final", "warnings": [ { "field": "device_timezone", "message": "device_timezone is not an IANA time zone name such as Europe/Vilnius: not stored" } ] } ``` `200`: ```json { "duplicate": true, "transaction_id": "00000000-0000-4000-8000-000000000001", "decision_id": "00000000-0000-4000-8000-000000000002", "decision_ref": "DEC-2026-000123", "status": "HUMAN_REVIEW", "rejection_action": null, "correlation_id": "6f1c2f9e-0000-4000-8000-000000000003", "received_at": "2026-09-01T09:15:01.102345+00:00", "policy_version": "decision-policy-v1.6" } ``` `202`, A payment sent with executed_during_outage true: ```json { "duplicate": false, "post_event": true, "status": "POST_EVENT", "transaction_id": "00000000-0000-4000-8000-000000000031", "transaction_ref": "RTX-2026-000321", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000033", "received_at": "2026-09-01T11:40:00.000000+00:00", "executed_at": "2026-09-01T09:15:00+00:00", "outage_payment_policy": "SKIP_AND_CHECK_LATER", "checks": { "sanctions_screening": "QUEUED", "monitoring_rules_queued": 9 }, "message": "Executed by your system before Underlayer checked it: Underlayer does not hold, release or reject it. It is screened and evaluated by your monitoring rules after the event, and any alert goes to your team." } ``` `202`: ```json { "duplicate": false, "transaction_id": "00000000-0000-4000-8000-000000000011", "decision_id": "00000000-0000-4000-8000-000000000012", "decision_ref": "DEC-2026-000124", "status": "AI_INVESTIGATION", "rejection_action": null, "decision_reason": "AI triage AIJ-2026-000045 queued", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000013", "received_at": "2026-09-01T09:20:00.000000+00:00", "policy_version": "decision-policy-v1.6", "alert_id": "00000000-0000-4000-8000-000000000014", "triggered_rules": [ "TM-003 v4" ], "rules_evaluated": 9, "rules_deferred": 0, "tm_latency_ms": 55, "total_latency_ms": null, "estimated_next_state": "RELEASED, HUMAN_REVIEW, HOLD or ESCALATED once the AI triage completes" } ``` `202`: ```json { "duplicate": false, "transaction_id": "00000000-0000-4000-8000-000000000021", "decision_id": "00000000-0000-4000-8000-000000000022", "decision_ref": "DEC-2026-000125", "status": "HUMAN_REVIEW", "rejection_action": null, "decision_reason": "Real-time screening could not complete - human review required", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000023", "received_at": "2026-09-01T09:25:00.000000+00:00", "policy_version": "decision-policy-v1.6", "alert_id": null, "triggered_rules": [], "rules_evaluated": 0, "rules_deferred": 0, "tm_latency_ms": null, "total_latency_ms": null, "estimated_next_state": "HUMAN_REVIEW", "screening_timeout": true } ``` **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `400` | `Body must be valid JSON` | `BODY_NOT_JSON` | | | | `400` | `Body must be a JSON object` | `BODY_NOT_OBJECT` | | | | `400` | `counterparty is required for SEPA payments` | `MISSING_CHANNEL_FIELD` | | The message % is required for % payments, as the caller receives it | | `400` | `amount may have at most two decimals` | `TOO_MANY_DECIMALS` | | The message % may have at most two decimals, for an amount of 10.123 | | `400` | `origin_country must be a two-letter ISO 3166-1 alpha-2 country code such as LT` | `INVALID_COUNTRY` | | The message % must be a two-letter ISO 3166-1 alpha-2 country code such as LT, for origin_country XX | | `400` | `references beginning EXAMPLE- come from the documentation and are refused: send your own references` | `EXAMPLE_ROW` | | An external_transaction_id or customer_ref beginning EXAMPLE- | | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `403` | `This API key may not submit TEST payments` | `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` | | | | `409` | `this external_transaction_id or Idempotency-Key was already used for a payment with a different amount: retry with the same body, or send a new payment with a new external_transaction_id and a new Idempotency-Key` | `IDEMPOTENCY_CONFLICT` | | | | `409` | `the Idempotency-Key and the external_transaction_id name two different payments: retry with the key and the reference you sent the first time` | `REFERENCE_KEY_MISMATCH` | | | | `500` | `Decisioning engine error` | `ENGINE_ERROR` | `P0001` | | ### 3.2. `GET /v1/transactions/{id}/decision`: Read the current decision for one of your payments Operation `readDecision`. Header `X-API-Key`. Path parameter `{id}`: The `transaction_id` or `decision_id` (a UUID) from the payment's answer, the `decision_ref` (`DEC--`), or your own `external_transaction_id`. Your own reference is looked up only when it is not a UUID; when two of your payments from different source systems share it, the answer is 409: use the transaction id or the decision reference. The authoritative, server-held decision. Poll it after a `202` if you do not use the decision webhook (every few seconds at first, then less often; a person may take hours). Every look-up is your institution's own: a payment of another institution answers 404 and is never read. The answer is never cached (`Cache-Control: no-store`). **Answers:** **`200`** (body `DecisionView` or `PostEventView`; header `Cache-Control`). The decision, or, for a payment sent after an outage, what it is (`status: POST_EVENT`, no decision). **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `ErrorBody`). The key is limited to allowed addresses and the request came from another one (or from no address the platform recorded), or the key belongs to an institution that is not active. **`404`** (body `ErrorBody`). No decision of your institution has this id or reference. **`409`** (body `ErrorBody`). More than one of your payments has this reference (from different source systems). **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The look-up failed on the server. Retry once; if it fails again, contact Underlayer with the `code`. **`503`**: `ServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `404` | `Decision not found` | `DECISION_NOT_FOUND` | | | | `409` | `More than one of your payments has this reference: use the transaction id or the decision reference` | `AMBIGUOUS_REFERENCE` | | | | `500` | `Lookup failed` | `LOOKUP_FAILED` | | | ### 3.3. `POST /v1/cards`: Register one of your cards, or update it Operation `registerCard`. Header `X-API-Key`. 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:** `CardRequest`. #### `CardRequest` One of your cards. Only these six fields are taken; any other is refused. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `card_token` | yes | string | pattern `^[A-Za-z0-9._:+/=-]+$`; at least 1 characters; at most 128 characters | Your card processor's token for the card; never the card number. The same token updates the same card. | | `customer_ref` | | string | | Required for a new card: your reference of the customer it belongs to. A card keeps its customer. | | `masked_pan` | | string | at most 32 characters | At most the first six or eight digits and the last four, the rest masked with *, • or X, for example 411111******1111. A full card number is refused. | | `card_type` | | string | one of `PHYSICAL_CARD`, `VIRTUAL_CARD` | A new card without it is PHYSICAL_CARD. | | `status` | | string | one of `ACTIVE`, `SUSPENDED`, `TERMINATED` | A new card without it is ACTIVE. A terminated card stays terminated. | | `data_classification` | | string | one of `PRODUCTION`, `TEST`, `SCALE_TEST`, `DEMO`; default `PRODUCTION` | Your key must allow it (403); a production institution takes PRODUCTION only. A card keeps the label it was registered with. | **Example requests** (the `EXAMPLE-` references are refused: put your own in their place): A new virtual card (example references are refused): ```json { "card_token": "EXAMPLE-CARD-0001", "customer_ref": "EXAMPLE-CUST-0001", "masked_pan": "411111******1111", "card_type": "VIRTUAL_CARD", "status": "ACTIVE", "data_classification": "TEST" } ``` You suspended the card in your own system: ```json { "card_token": "EXAMPLE-CARD-0001", "status": "SUSPENDED", "data_classification": "TEST" } ``` **Answers:** **`200`** (body `CardResult`). The card existed: it was updated (`changed: true`), or nothing differed (`changed: false`). **`201`** (body `CardResult`). The card was registered (`created: true`). **`400`** (body `ErrorBody`). The body is not a JSON object, or the database refused the card with a `VALIDATION:` message, answered without its prefix. The messages are listed on the Errors page, "Card registration refusals (400)"; `%` stands for the field or its value: - a card must be a JSON object (`error_code` `NOT_AN_OBJECT`) - institution is not active (`error_code` `INSTITUTION_NOT_ACTIVE`) - a card takes only card_token, customer_ref, masked_pan, card_type, status and data_classification (`error_code` `UNKNOWN_FIELD`) - % must be text (`error_code` `INVALID_FIELD_TYPE`) - card_token is required (`error_code` `MISSING_CARD_TOKEN`) - card_token holds a full card number: send your processor's token for the card, never its number (`error_code` `FULL_PAN`) - card_token must be 1 to 128 letters, digits or . _ : + / = - (`error_code` `INVALID_CARD_TOKEN`) - references beginning EXAMPLE- come from the documentation and are refused: send your own references (`error_code` `EXAMPLE_ROW`) - 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`) - masked_pan must be digits with the middle masked by *, • or X, such as 411111******1111 (`error_code` `INVALID_MASKED_PAN`) - card_type must be PHYSICAL_CARD or VIRTUAL_CARD (`error_code` `INVALID_CARD_TYPE`) - status must be ACTIVE, SUSPENDED or TERMINATED (`error_code` `INVALID_STATUS`) - data_classification must be PRODUCTION, TEST, SCALE_TEST or DEMO (`error_code` `INVALID_DATA_CLASSIFICATION`) - data_classification % is not accepted by this institution: a production institution takes PRODUCTION data only (`error_code` `CLASSIFICATION_NOT_ACCEPTED`) - customer_ref is required for a new card (`error_code` `MISSING_CUSTOMER_REF`) - customer_ref names no customer of this institution: register the customer first (`error_code` `UNKNOWN_CUSTOMER`) - a card keeps the data_classification it was registered with (`error_code` `CLASSIFICATION_CHANGED`) - a card keeps the customer it was registered for: register a new card for another customer (`error_code` `CUSTOMER_CHANGED`) - a terminated card stays terminated: register the replacement card under its own card_token (`error_code` `CARD_TERMINATED`) Correct the request; do not send it again unchanged. **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `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`**: `PayloadTooLarge`, as 3.8 "Answers several endpoints share" says. **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The database refused the card with something other than a validation message, a fault on our side; `code` is its error code. Retry once with the same body: the same `card_token` never makes a second card. Contact Underlayer with the `code` if it comes back. **`503`**: `EventServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Example answers:** `201`: ```json { "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" } } ``` **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `400` | `Body must be valid JSON` | `BODY_NOT_JSON` | | | | `400` | `Body must be a JSON object` | `BODY_NOT_OBJECT` | | | | `400` | `masked_pan holds a full card number: send at most the first six or eight digits and the last four, the rest masked` | `FULL_PAN` | | | | `400` | `customer_ref names no customer of this institution: register the customer first` | `UNKNOWN_CUSTOMER` | | | | `400` | `references beginning EXAMPLE- come from the documentation and are refused: send your own references` | `EXAMPLE_ROW` | | An EXAMPLE- reference, as in the request examples above | | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `403` | `This API key may not submit TEST cards` | `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` | | | | `500` | `Card registration error` | `ENGINE_ERROR` | `P0001` | | ### 3.4. `POST /v1/card-authorizations`: Decide a card or ATM authorisation in real time Operation `authorizeCard`. Header `X-API-Key`. Header `Idempotency-Key`: **required**. 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. **Request body:** `CardAuthorizationRequest`. #### `CardAuthorizationRequest` Checked before anything is stored. The currencies (currency, billing_currency, card_currency, balance_currency), merchant_country and the card codes (entry_mode, card_presence, card_txn_type, authorization_mode, terminal_capability, three_ds_result, cvv_result, pin_result) are upper-cased on arrival and stored upper-cased: a currency must be three letters (Currency), merchant_country a code of the platform's country list (Country), and a card code one of the values of its enum, the rule builder's values for the field (otherwise 400 "% must be one of %", naming the field and its values). event_type and data_classification are compared exactly as sent: send them in upper case. A card_token beginning EXAMPLE- (in any case) is refused. Fields not listed are ignored. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `event_type` | yes | string | one of `CARD_AUTHORIZATION`, `ATM_WITHDRAWAL`, `CARD_REFUND`, `CARD_REVERSAL` | Compared exactly as sent, so card_authorization is refused. A CARD_REFUND is answered REFUNDED and a CARD_REVERSAL REVERSED; neither is ever declined, and the institution's real-time card rules are evaluated on both. | | `card_token` | yes | string | at least 1 characters | The card's token as Underlayer holds it for your institution and this data classification. Missing or blank - 400 card_token is required. One beginning EXAMPLE- is refused (400). | | `amount` | yes | `Amount` | see `Amount` in "Value formats" | The transaction amount in currency, greater than zero, at most two decimals. Missing: 400 amount is required. Zero or negative: 400 amount must be greater than zero. Not a decimal number: 400 amount must be a decimal number such as 125.50 (no exponent, NaN or Infinity). | | `currency` | | `Currency` | see `Currency` in "Value formats" | ISO 4217 code of the transaction; upper-cased. Left out or empty - EUR. | | `event_time` | | `IsoDateTime` | see `IsoDateTime` in "Value formats" | When the event happened. Default the time of receipt. | | `billing_amount` | | `Amount` | see `Amount` in "Value formats" | The amount in the billing currency (what the card is charged), greater than zero. Default amount when the billing currency is the transaction currency, else amount converted at the euro reference rates of the event date (none without a rate). Stored with its EUR value at the reference rate, which the card rule templates compare. | | `billing_currency` | | `Currency` | see `Currency` in "Value formats" | Upper-cased. Default card_currency, else EUR. A transaction currency other than the billing currency is a foreign-currency transaction. | | `card_currency` | | `Currency` | see `Currency` in "Value formats" | The card's own currency; upper-cased. | | `merchant_name` | | string | | | | `merchant_id` | | string | | | | `mcc` | | string | | Four-digit merchant category code. Default 6011 for an ATM withdrawal; what you send is kept. | | `merchant_country` | | `Country` | see `Country` in "Value formats" | Upper-cased; must be on the platform's country list. | | `terminal_id` | | string | | | | `atm_id` | | string | | | | `entry_mode` | | string | one of `CHIP`, `MAGSTRIPE`, `CONTACTLESS`, `ECOMMERCE`, `MANUAL`, `TOKEN`, `MOTO`, `UNKNOWN` | Upper-cased on arrival. CHIP, MAGSTRIPE or CONTACTLESS make the card present; ECOMMERCE, MANUAL, TOKEN or MOTO not present. | | `card_presence` | | string | one of `CARD_PRESENT`, `CARD_NOT_PRESENT`, `UNKNOWN` | Upper-cased on arrival. Default derived from entry_mode; with no entry_mode that says otherwise an ATM withdrawal is CARD_PRESENT, anything else UNKNOWN. What you send is kept. | | `card_txn_type` | | string | one of `POS`, `ATM`, `REFUND`, `CREDIT`, `ECOMMERCE`, `QUASI_CASH` | Upper-cased on arrival. Default REFUND for a refund (any other value is refused for a refund), the original's for a reversal, ATM for an ATM withdrawal, ECOMMERCE for entry_mode ECOMMERCE, else POS. A CREDIT event is money in (stored Incoming, as a refund); a reversal takes the opposite direction of the event it reverses. | | `authorization_mode` | | string | one of `ONLINE`, `OFFLINE`; default `ONLINE` | Upper-cased on arrival. | | `terminal_capability` | | string | one of `CHIP_AND_PIN`, `MAGSTRIPE_ONLY`, `CONTACTLESS`, `UNKNOWN`; default `UNKNOWN` | Upper-cased on arrival. | | `cvv_result` | | string | one of `MATCH`, `NO_MATCH`, `NOT_PROVIDED` | Upper-cased on arrival. NO_MATCH declines the event (INVALID_CVV); MATCH and NOT_PROVIDED do not. Any other value, FAIL included, is refused (400 cvv_result must be one of MATCH, NO_MATCH, NOT_PROVIDED). | | `pin_result` | | string | one of `MATCH`, `NO_MATCH`, `NOT_PROVIDED` | Upper-cased on arrival. NO_MATCH declines the event (INVALID_PIN); MATCH and NOT_PROVIDED do not. Any other value, FAIL included, is refused (400 pin_result must be one of MATCH, NO_MATCH, NOT_PROVIDED). | | `three_ds_result` | | string | one of `AUTHENTICATED`, `NOT_AUTHENTICATED`, `ATTEMPTED`, `NOT_APPLICABLE` | Upper-cased on arrival. | | `acquirer` | | string | | | | `issuer_response` | | string | | | | `available_balance` | | `Amount` | see `Amount` in "Value formats" | The card's available balance at authorisation, in balance_currency. May be zero or negative (-12.50). The balance rule templates compare it in EUR at the reference rate of the event's date. | | `balance_currency` | | `Currency` | see `Currency` in "Value formats" | The currency of available_balance (ISO 4217); upper-cased. Default card_currency. Not stored without available_balance. | | `correlation_id` | | string | | Default a random UUID. | | `original_event_ref` | | string | | The event_ref answered for an approved authorisation or withdrawal of the same card that this refund or reversal undoes. Required for a CARD_REVERSAL, optional for a CARD_REFUND. Same currency, not dated before it; what is refunded and reversed against one event never exceeds its amount. Fields left out (merchant, terminal, entry_mode, card_presence, authorization_mode, terminal_capability, card_currency, billing_currency; for a reversal card_txn_type) are taken from it. Without billing_amount the billing amount is the original's in proportion to the amount, when the billing currency is the original's. | | `data_classification` | | string | default `PRODUCTION` | PRODUCTION, TEST, SCALE_TEST or DEMO, allowed by your key; compared exactly as sent. The card must have the same classification. | **Example requests** (the `EXAMPLE-` references are refused: put your own in their place): An e-commerce card payment (example references; an EXAMPLE- card token is refused): ```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" } ``` A reversal of an approved authorisation (original_event_ref is the event_ref answered for it): ```json { "event_type": "CARD_REVERSAL", "card_token": "EXAMPLE-CARD-0001", "amount": 49.9, "currency": "EUR", "original_event_ref": "CAE-2026-000321", "data_classification": "TEST" } ``` **Answers:** **`200`** (body `CardAuthorizationResult`). The decision (`APPROVED` or `DECLINED`; `REFUNDED` or `REVERSED` for a refund or reversal), or a replayed duplicate (`duplicate: true`). **`400`** (body `ErrorBody`). The body is not a JSON object, or the database refused the event with a `VALIDATION:` message, answered without its prefix. A missing `Idempotency-Key` and a value of the wrong type are refused this way. The messages are listed on the Errors page, "Card refusals (400)"; `%` stands for the field or its values: - 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`) - the Idempotency-Key may be at most 255 characters (`error_code` `IDEMPOTENCY_KEY_TOO_LONG`) - data_classification % is not accepted by the decisioning engine (`error_code` `INVALID_DATA_CLASSIFICATION`) - data_classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only (`error_code` `CLASSIFICATION_NOT_ACCEPTED`) - event_type must be CARD_AUTHORIZATION, ATM_WITHDRAWAL, CARD_REFUND or CARD_REVERSAL (`error_code` `INVALID_EVENT_TYPE`) - % is required (`error_code` `MISSING_FIELD`) - % must be a number (`error_code` `INVALID_NUMBER`) - % must be a decimal number such as 125.50 (no exponent, NaN or Infinity) (`error_code` `INVALID_DECIMAL`) - % may have at most two decimals (`error_code` `TOO_MANY_DECIMALS`) - % exceeds the largest supported amount, 999999999999.99 (`error_code` `AMOUNT_TOO_LARGE`) - % must be greater than zero (`error_code` `AMOUNT_NOT_POSITIVE`) - % must be a three-letter ISO 4217 currency code such as EUR (`error_code` `INVALID_CURRENCY`) - % must be a two-letter ISO 3166-1 alpha-2 country code such as LT (`error_code` `INVALID_COUNTRY`) - % must be one of % (`error_code` `INVALID_OPTION`) - card_token is required (`error_code` `MISSING_CARD_TOKEN`) - references beginning EXAMPLE- come from the documentation and are refused: send your own references (`error_code` `EXAMPLE_ROW`) - event_time must be a date YYYY-MM-DD or a date-time YYYY-MM-DDThh:mm[:ss[.ffffff]] with an optional zone Z, +hh:mm or -hh:mm (no zone = UTC), such as 2026-09-01T14:30:00Z (`error_code` `INVALID_DATE_TIME`) - unknown card_token (`error_code` `UNKNOWN_CARD`) - card_txn_type of a refund must be REFUND (`error_code` `INVALID_REFUND_TXN_TYPE`) - original_event_ref is required for a reversal: send the event_ref of the authorisation or withdrawal it reverses (`error_code` `MISSING_ORIGINAL_EVENT`) - original_event_ref must name an approved authorisation or withdrawal of this card (`error_code` `INVALID_ORIGINAL_EVENT`) - currency must be the currency of the original event (`error_code` `ORIGINAL_CURRENCY_MISMATCH`) - event_time cannot be before the original event (`error_code` `EVENT_BEFORE_ORIGINAL`) - amount exceeds what is left of the original event to refund or reverse (`error_code` `AMOUNT_EXCEEDS_ORIGINAL`) - billing_amount is required when billing_currency is not the billing currency of the original event (`error_code` `MISSING_BILLING_AMOUNT`) Correct the request; do not send it again unchanged. **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `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`** (body `ErrorBody`). The request repeats an earlier card event's `Idempotency-Key` but is not the same event; nothing was stored. `this Idempotency-Key was already used for a card event with a different %: retry with the same body, or send a new event with a new Idempotency-Key` (`%` names the fields that differ: `card_token`, `event_type`, `amount`, `currency`; never a value). **`413`**: `PayloadTooLarge`, as 3.8 "Answers several endpoints share" says. **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The database refused the event with something other than a validation message, a fault on our side; `code` is its error code. A value of the wrong type is never answered here (it is a 400), and neither is a concurrent request with the same `Idempotency-Key` (it waits for the first). Retry once with the same `Idempotency-Key`; contact Underlayer with the `code` if it comes back. **`503`**: `DecisionServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Example answers:** `200`: ```json { "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 } ``` **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `400` | `Body must be valid JSON` | `BODY_NOT_JSON` | | | | `400` | `Body must be a JSON object` | `BODY_NOT_OBJECT` | | | | `400` | `unknown card_token` | `UNKNOWN_CARD` | | | | `400` | `the Idempotency-Key header is required for card events: send a unique key for each event and the same key when you retry it` | `MISSING_IDEMPOTENCY_KEY` | | No Idempotency-Key header | | `400` | `cvv_result must be one of MATCH, NO_MATCH, NOT_PROVIDED` | `INVALID_OPTION` | | cvv_result FAIL is refused with the message % must be one of % | | `400` | `references beginning EXAMPLE- come from the documentation and are refused: send your own references` | `EXAMPLE_ROW` | | A card_token beginning EXAMPLE-, as in the request example above | | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `403` | `This API key may not submit TEST events` | `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` | | | | `409` | `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` | `IDEMPOTENCY_CONFLICT` | | | | `500` | `Authorization engine error` | `ENGINE_ERROR` | `P0001` | | ### 3.5. `POST /v1/customer-events`: Record something the customer did that is not a payment Operation `submitCustomerEvent`. Header `X-API-Key`. Records one customer event: a sign-in, a failed sign-in, a new device, a changed password, two-step sign-in, e-mail, phone, address or limit, an added or changed payee, an added card, or a card payment the customer confirmed in your app (`CARD_PAYMENT_CONFIRMATION`: a 3-D Secure challenge or an approval in the app, with the session and device data your app saw; a card event itself carries none). Nothing is decided and no rule runs on an event: it keeps the customer's device ledger and is shown on the customer's Digital activity tab (see the Customer events guide). The customer must already be yours (`customer_ref`): an event never creates a customer. An event is identified by `source_system` + `external_event_id`: sending it again answers the first answer with `duplicate: true` and stores nothing more, so no `Idempotency-Key` is needed. A repeat must be the same event: one whose `customer_ref` or `event_type` differs from the first is refused `409` and nothing is stored. `event_time` may be up to 400 days in the past, so you can send your customers' past sign-ins at go-live; it may not be later than the time it is sent. The session and device fields are read as on a payment: a malformed one is not stored and the answer carries `warnings` (it never refuses the event), a field left out says nothing. An `external_event_id` or `customer_ref` beginning `EXAMPLE-` is refused. The events take their own back-pressure, separate from payments and card events: a burst of sign-ins never takes the decisions' capacity. **Request body:** `CustomerEventRequest`. #### `CustomerEventRequest` One customer event. Codes are upper-cased on arrival. A field that belongs to one kind of event only (the payee fields, the card confirmation's fields, card_token, changed_by) is refused on another (400). The session and device fields are those of a payment, read the same way: a malformed one is not stored and named in `warnings`, never a refusal. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `external_event_id` | yes | string | at most 128 characters | Your reference of the event, unique with source_system: a repeat answers the first answer. Not blank; one beginning EXAMPLE- (in any case) is refused. | | `source_system` | | string | at most 64 characters | Your system that recorded the event. Default API. | | `customer_ref` | yes | string | | Your customer's reference, a customer of your institution already on file (an event never creates one). One beginning EXAMPLE- is refused. | | `event_type` | yes | string | one of `LOGIN_SUCCESS`, `LOGIN_FAILED`, `DEVICE_ADDED`, `PASSWORD_CHANGED`, `PASSWORD_RESET`, `MFA_CHANGED`, `EMAIL_CHANGED`, `PHONE_CHANGED`, `ADDRESS_CHANGED`, `PAYEE_ADDED`, `PAYEE_CHANGED`, `CARD_ADDED`, `LIMIT_CHANGED`, `CARD_PAYMENT_CONFIRMATION` | What happened. Upper-cased on arrival. | | `event_time` | | `IsoDateTime` | see `IsoDateTime` in "Value formats" | When the customer did it. Default the time of receipt. Not later than five minutes after it is sent, and not more than 400 days before. | | `changed_by` | | string | one of `CUSTOMER`, `STAFF`, `SYSTEM` | Who made a change (a change event only: not a sign-in or a card payment confirmation). A change your staff made is not a sign of account takeover. | | `outcome` | | string | one of `APPROVED`, `DECLINED` | CARD_PAYMENT_CONFIRMATION only, and required there: what the customer answered in your app. | | `confirmation_method` | | string | one of `THREE_DS_CHALLENGE`, `IN_APP_APPROVAL`, `OTHER` | CARD_PAYMENT_CONFIRMATION only. How the customer confirmed the card payment. | | `merchant_country` | | string | | CARD_PAYMENT_CONFIRMATION only. The merchant's country, a code of the platform's country list. | | `card_event_ref` | | string | | CARD_PAYMENT_CONFIRMATION only. The event_ref Underlayer answered for the card event this confirmation belongs to, when it was already sent. One the customer does not hold is not linked (a warning). | | `card_token` | | string | | CARD_ADDED and CARD_PAYMENT_CONFIRMATION only. The card on file the event is about. A token of no card of this customer is not linked (a warning); the token itself is not stored. | | `payee_name` | | string | at most 200 characters | PAYEE_ADDED and PAYEE_CHANGED only. The payee's name as the customer entered it. | | `payee_account` | | string | at most 64 characters | PAYEE_ADDED and PAYEE_CHANGED only. The payee's account, read as a payment's counterparty_account (an IBAN must pass its check; anything else is refused, 400). | | `payee_country` | | string | | PAYEE_ADDED and PAYEE_CHANGED only. The payee's country, a code of the platform's country list. | | `payee_type` | | string | one of `INDIVIDUAL`, `LEGAL_ENTITY`, `FINANCIAL_INSTITUTION`, `GOVERNMENT`, `MERCHANT`, `OTHER` | PAYEE_ADDED and PAYEE_CHANGED only. | | `ip_address` | | string | | The IP address of the customer's session, one IPv4 or IPv6 host address. Our own IP-to-country lookup fills ip_country in when you send none. Never refuses the event. | | `ip_country` | | string | | The IP's country as your own geolocation found it. Yours wins. Never refuses the event. | | `device_id` | | string | | Your stable identifier of the customer's device: 8 to 128 letters, digits or . _ : + / = -. Keeps the customer's device ledger. Never refuses the event. | | `device_timezone` | | string | | The device's IANA time zone, such as Europe/Vilnius. Never refuses the event. | | `device_utc_offset` | | string | | The device's UTC offset, +hh:mm or -hh:mm, -12:00 to +14:00 in quarter hours (with a time zone they must agree). Never refuses the event. | | `session_id` | | string | | Your session id; only its SHA-256 (with your institution) is stored, so a later payment can be tied to its sign-in. Never refuses the event. | | `initiation_channel` | | string | one of `MOBILE_APP`, `WEB_BROWSER`, `API`, `BRANCH`, `PHONE`, `OTHER` | Where the event happened. Never refuses the event. | | `device_os` | | string | one of `ANDROID`, `IOS`, `WINDOWS`, `MACOS`, `LINUX`, `OTHER` | The device's operating system. Never refuses the event. | | `vpn_or_proxy` | | boolean or string | | true when your tools saw a VPN, proxy or anonymiser. Never refuses the event. | | `remote_access_detected` | | boolean or string | | true when your tools saw remote-access software on the device. Never refuses the event. | | `correlation_id` | | string | at most 128 characters | Your own trace id. | | `data_classification` | | `DataClassification` | one of `PRODUCTION`, `TEST`, `SCALE_TEST`, `DEMO`; default `PRODUCTION`; see `DataClassification` in "Value formats" | | **Example requests** (the `EXAMPLE-` references are refused: put your own in their place): A sign-in from the customer's phone (example references are refused): ```json { "external_event_id": "EXAMPLE-EVENT-0001", "source_system": "MOBILE-APP", "customer_ref": "EXAMPLE-CUST-0001", "event_type": "LOGIN_SUCCESS", "event_time": "2026-09-02T18:01:07Z", "ip_address": "203.0.113.10", "device_id": "EXAMPLE-DEVICE-7F3A9C21", "device_timezone": "Europe/Vilnius", "session_id": "EXAMPLE-SESSION-0001", "initiation_channel": "MOBILE_APP", "device_os": "IOS", "data_classification": "TEST" } ``` A card payment the customer approved in the app (3-D Secure challenge): ```json { "external_event_id": "EXAMPLE-EVENT-0002", "customer_ref": "EXAMPLE-CUST-0001", "event_type": "CARD_PAYMENT_CONFIRMATION", "outcome": "APPROVED", "confirmation_method": "THREE_DS_CHALLENGE", "card_token": "EXAMPLE-CARD-0001", "merchant_country": "DE", "ip_address": "203.0.113.10", "device_id": "EXAMPLE-DEVICE-7F3A9C21", "data_classification": "TEST" } ``` **Answers:** **`200`** (body `CustomerEventResult`). A repeat of a recorded event (`duplicate: true`): the first answer's references and warnings; nothing more is stored. **`202`** (body `CustomerEventResult`). The event was recorded. Nothing is decided; `warnings` is present only when a session, device or card field was not used. **`400`** (body `ErrorBody`). The body is not a JSON object, or the database refused the event with a `VALIDATION:` message, answered without its prefix. The messages are listed on the Errors page, "Customer event refusals (400)"; `%` stands for the field or its values: - the body must be a JSON object (`error_code` `BODY_NOT_OBJECT`) - institution is not active (`error_code` `INSTITUTION_NOT_ACTIVE`) - external_event_id is required (`error_code` `MISSING_EXTERNAL_EVENT_ID`) - external_event_id must be at most 128 characters (`error_code` `EXTERNAL_EVENT_ID_TOO_LONG`) - source_system must be at most 64 characters (`error_code` `SOURCE_SYSTEM_TOO_LONG`) - customer_ref is required (`error_code` `MISSING_CUSTOMER_REF`) - references beginning EXAMPLE- come from the documentation and are refused: send your own references (`error_code` `EXAMPLE_ROW`) - event_type is required (`error_code` `MISSING_EVENT_TYPE`) - event_type must be one of % (`error_code` `INVALID_EVENT_TYPE`) - data_classification must be PRODUCTION, TEST, SCALE_TEST or DEMO (`error_code` `INVALID_DATA_CLASSIFICATION`) - event_time must be a date YYYY-MM-DD or a date-time YYYY-MM-DDThh:mm[:ss[.ffffff]] with an optional zone Z, +hh:mm or -hh:mm (no zone = UTC), such as 2026-09-01T14:30:00Z (`error_code` `INVALID_DATE_TIME`) - event_time cannot be later than the time the event is sent (`error_code` `EVENT_TIME_IN_FUTURE`) - event_time is more than 400 days in the past: older events are not accepted (`error_code` `EVENT_TIME_TOO_OLD`) - % applies only to CARD_PAYMENT_CONFIRMATION (`error_code` `FIELD_NOT_FOR_EVENT_TYPE`) - card_token applies only to CARD_ADDED and CARD_PAYMENT_CONFIRMATION (`error_code` `FIELD_NOT_FOR_EVENT_TYPE`) - % applies only to PAYEE_ADDED and PAYEE_CHANGED (`error_code` `FIELD_NOT_FOR_EVENT_TYPE`) - changed_by applies only to a change (%) (`error_code` `FIELD_NOT_FOR_EVENT_TYPE`) - changed_by must be CUSTOMER, STAFF or SYSTEM (`error_code` `INVALID_CHANGED_BY`) - outcome is required for CARD_PAYMENT_CONFIRMATION: APPROVED or DECLINED (`error_code` `MISSING_OUTCOME`) - outcome must be APPROVED or DECLINED (`error_code` `INVALID_OUTCOME`) - confirmation_method must be THREE_DS_CHALLENGE, IN_APP_APPROVAL or OTHER (`error_code` `INVALID_CONFIRMATION_METHOD`) - % must be a two-letter ISO 3166-1 alpha-2 country code such as LT (`error_code` `INVALID_COUNTRY`) - payee_name must be a text of at most 200 characters (`error_code` `INVALID_PAYEE_NAME`) - % must be 1 to 34 letters and digits (spaces are taken out) (`error_code` `INVALID_ACCOUNT`) - % looks like an IBAN but does not begin with a known country code (`error_code` `INVALID_IBAN_COUNTRY`) - % looks like an IBAN but its check digits are wrong (`error_code` `INVALID_IBAN_CHECK_DIGITS`) - payee_type must be INDIVIDUAL, LEGAL_ENTITY, FINANCIAL_INSTITUTION, GOVERNMENT, MERCHANT or OTHER (`error_code` `INVALID_PAYEE_TYPE`) - correlation_id must be a text of at most 128 characters (`error_code` `INVALID_CORRELATION_ID`) - data_classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only (`error_code` `CLASSIFICATION_NOT_ACCEPTED`) - unknown customer_ref % (`error_code` `UNKNOWN_CUSTOMER`) Correct the request; do not send it again unchanged. **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `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`** (body `ErrorBody`). The request repeats an earlier event's `source_system` and `external_event_id` but is not the same event; nothing was stored. `this source_system and external_event_id were already used for a customer event with a different %: retry with the same body, or send a new event with a new external_event_id` (`%` names the fields that differ: `customer_ref`, `event_type`; never a value). **`413`**: `PayloadTooLarge`, as 3.8 "Answers several endpoints share" says. **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The database refused the event with something other than a validation message, a fault on our side; `code` is its error code. Retry once with the same `source_system` and `external_event_id`: a repeat never stores a second event. Contact Underlayer with the `code` if it comes back. **`503`**: `EventServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Example answers:** `202`: ```json { "duplicate": false, "event_id": "00000000-0000-4000-8000-000000000041", "event_ref": "CEV-2026-000123", "event_type": "LOGIN_SUCCESS", "received_at": "2026-09-02T18:01:08.204719+00:00" } ``` **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `400` | `Body must be valid JSON` | `BODY_NOT_JSON` | | | | `400` | `Body must be a JSON object` | `BODY_NOT_OBJECT` | | | | `400` | `unknown customer_ref C-0042` | `UNKNOWN_CUSTOMER` | | | | `400` | `references beginning EXAMPLE- come from the documentation and are refused: send your own references` | `EXAMPLE_ROW` | | An EXAMPLE- reference, as in the request examples above | | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `403` | `This API key may not submit TEST events` | `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` | | | | `409` | `this source_system and external_event_id were already used for a customer event with a different event_type: retry with the same body, or send a new event with a new external_event_id` | `IDEMPOTENCY_CONFLICT` | | | | `500` | `Customer event engine error` | `ENGINE_ERROR` | `P0001` | | ### 3.6. `POST /v1/cdd-ingest`: Send customer due diligence (CDD / KYC) records Operation `ingestCdd`. Header `X-API-Key`. Creates or updates customers, their related parties and accounts, one row per customer. Each row is accepted or refused on its own: a refused row never stops the rest (its reason is in `errors`). An accepted row that changes the customer's CDD record creates a new CDD version; a row that changes nothing is counted as `unchanged`. The rows are processed in chunks of 500, each committed on its own. If the import fails half-way (500), the rows of the chunks before are already stored: send the whole file again, the stored rows come back as `unchanged`. In a row, a field you leave out keeps the stored value; a field you send empty or null clears it, except `full_name`, `customer_type` and `risk_rating`, which keep the stored value, and `country_of_residence`, `account_opening_date`, `expected_monthly_turnover`, `actual_monthly_turnover`, `pep_determination`, `pep_status` and `sanctions_status`, which cannot be cleared (the row is refused, `ROW_REFUSED`, database error 23502). A row whose `customer_ref` begins `EXAMPLE-` is refused (`EXAMPLE_ROW`): the examples here can never create a customer. **Request body:** `CddIngestRequest`. #### `CddIngestRequest` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `source_system` | yes | string | at least 1 characters | Which of your systems the data comes from; recorded on every version. | | `source_file` | | string or null | | A file name to show with the import. | | `classification` | | string | one of `PRODUCTION`, `TEST`, `DEMO`; default `PRODUCTION` | Note the name (not data_classification). Your key must allow it (403); SCALE_TEST is allowed on keys but refused by the CDD intake (400 classification must be PRODUCTION, TEST or DEMO). | | `rows` | yes | array of `CddRow` | at least 1 items; at most 50000 items | | #### `CddRow` One customer. A field outside this list (at any depth) refuses the row (UNKNOWN_FIELD). Required for a new customer: full_name, country_of_residence, account_opening_date. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `customer_ref` | yes | string | | Your unique customer reference. One beginning EXAMPLE- is refused (EXAMPLE_ROW). | | `full_name` | | string | | | | `customer_type` | | string | one of `Business`, `Individual` | Case-insensitive. A new customer without it is Business. | | `country_of_residence` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list (every ISO 3166-1 alpha-2 code and XK; XX is not), any case, upper-cased on arrival. Any other value rejects the row (INVALID_COUNTRY). | | `account_opening_date` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `risk_rating` | | string | one of `Low`, `Medium`, `High`, `Critical` | Case-insensitive. Any other value rejects the row (INVALID_RISK_RATING). A new customer without it is Not assessed, never Medium; a later row without it keeps the rating in force; a customer the payment feed created (High until its CDD record) becomes Not assessed when that record names none. Every monitoring alert of a Critical customer goes to an L2 case; your institution may send every AI result of a High customer to a person (its own review gate). | | `pep_determination` | | string | one of `NOT_PEP`, `PEP`, `PEP_FAMILY_OR_CLOSE_ASSOCIATE`, `FORMER_PEP`, `NOT_ASSESSED` | Your own KYC determination of whether the customer is a politically exposed person. Case-insensitive; spaces or hyphens may stand for the underscores. Any other value rejects the row (INVALID_PEP_STATUS). A new customer without it is NOT_ASSESSED, never NOT_PEP. PEP, PEP_FAMILY_OR_CLOSE_ASSOCIATE and FORMER_PEP are treated as a PEP: an EDD signal (your PEP review gate sends the AI's closure of the customer's alerts to a person); it never holds a payment. Each change is a CDD version. | | `pep_category` | | string | one of `HEAD_OF_STATE_OR_GOVERNMENT`, `MINISTER`, `PARLIAMENT`, `POLITICAL_PARTY`, `SUPREME_COURT`, `AUDIT_OR_CENTRAL_BANK`, `AMBASSADOR`, `ARMED_FORCES`, `STATE_OWNED_ENTERPRISE`, `INTERNATIONAL_ORGANISATION`, `REGIONAL_OR_LOCAL_GOVERNMENT`, `OTHER` | Only with PEP, PEP_FAMILY_OR_CLOSE_ASSOCIATE or FORMER_PEP: the public function. Case-insensitive. Otherwise, or another value, rejects the row (INVALID_PEP_DETAILS). | | `pep_country` | | string | pattern `^[A-Za-z]{2}$` | Only with PEP, PEP_FAMILY_OR_CLOSE_ASSOCIATE or FORMER_PEP (else INVALID_PEP_DETAILS): the country of the public function, a code of the platform's country list, any case. Any other value rejects the row (INVALID_COUNTRY). | | `pep_since` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `pep_until` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `pep_source` | | string | at most 100 characters | Where the determination came from (INVALID_PEP_DETAILS over 100 characters or with NOT_ASSESSED). Left out, the import's source_system is recorded whenever the row states a determination. | | `pep_status` | | boolean or string | | Older form of pep_determination: true is PEP, false is NOT_PEP. Sent with pep_determination, the two must agree (else INVALID_PEP_STATUS). | | `sanctions_status` | | string | one of `CLEAR`, `POTENTIAL_MATCH`, `CONFIRMED_MATCH`, `NOT_SCREENED` | The result of your own sanctions screening. Case-insensitive; spaces or hyphens may stand for the underscores. Any other value rejects the row (INVALID_SANCTIONS_STATUS). A new customer without it is NOT_SCREENED. Only CLEAR clears the customer: the other three are a sanctions concern for the AI review gates and QC sampling. | | `legal_form` | | string | | | | `registration_number` | | string | | | | `registration_country` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list (every ISO 3166-1 alpha-2 code and XK; XX is not), any case, upper-cased on arrival. Any other value rejects the row (INVALID_COUNTRY). | | `registration_date` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `tax_number` | | string | | | | `national_id` | | string | | | | `date_of_birth` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `place_of_birth` | | string | | | | `nationality` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list (every ISO 3166-1 alpha-2 code and XK; XX is not), any case, upper-cased on arrival. Any other value rejects the row (INVALID_COUNTRY). | | `id_document_type` | | string | | | | `id_document_number` | | string | | | | `id_document_country` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list (every ISO 3166-1 alpha-2 code and XK; XX is not), any case, upper-cased on arrival. Any other value rejects the row (INVALID_COUNTRY). | | `id_document_expiry` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `address` | | string or `CddAddress` | | | | `email` | | string | | | | `phone` | | string | | | | `website` | | string | | | | `business_sector` | | string | | | | `industry_category` | | string | | | | `industry_subcategory` | | string | | | | `nace_code` | | string | pattern `^[A-Ua-u]([0-9]{2}([.][0-9]{1,2})?)?$` | | | `sic_code` | | string | | | | `occupation` | | string | | | | `employer` | | string | | | | `purpose_of_account` | | string | | | | `source_of_funds` | | string | | | | `source_of_wealth` | | string | | | | `countries_of_operation` | | array of string | each item: pattern `^[A-Za-z]{2}$` | Codes of the platform's country list, any case; stored once each, upper-cased. Any other code rejects the row (INVALID_COUNTRIES_OF_OPERATION). | | `number_of_employees` | | integer or string | at least 0 | | | `annual_turnover` | | number or string | at least 0 | | | `annual_income` | | number or string | at least 0 | | | `expected_monthly_turnover` | | number or string | | | | `actual_monthly_turnover` | | number or string | | | | `expected_monthly_tx_count` | | integer or string | at least 0 | | | `max_single_payment` | | number or string | at least 0 | | | `relationship_status` | | string | | | | `relationship_end_date` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `effective_from` | | `IsoDateTime` | see `IsoDateTime` in "Value formats" | | | `note` | | string | | | | `related_parties` | | array of `CddRelatedParty` | | When present, the complete set of the customer's related parties (the earlier set is replaced). | | `accounts` | | array of `CddAccount` | | Accounts added or updated (by account_number); an account left out is kept. | #### `CddAddress` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `line` | | string | | | | `line1` | | string | | | | `line2` | | string | | | | `street` | | string | | | | `city` | | string | | | | `postal_code` | | string | | | | `postcode` | | string | | | | `region` | | string | | | | `state` | | string | | | | `country` | | string | | | #### `CddRelatedParty` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `full_name` | yes | string | | | | `role` | yes | string | one of `UBO`, `SHAREHOLDER`, `DIRECTOR`, `REPRESENTATIVE`, `AUTHORISED_SIGNATORY`, `OTHER` | | | `type` | | string | one of `NATURAL`, `LEGAL`; default `NATURAL` | | | `ownership_pct` | | number or string | at least 0; at most 100 | | | `date_of_birth` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `nationality` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list, any case; upper-cased. Any other value rejects the row (INVALID_RELATED_PARTIES). | | `country` | | string | pattern `^[A-Za-z]{2}$` | A code of the platform's country list, any case; upper-cased. Any other value rejects the row (INVALID_RELATED_PARTIES). | | `national_id` | | string | | | | `registration_number` | | string | | | | `email` | | string | | | | `phone` | | string | | | | `address` | | string or `CddAddress` | | | | `verified_at` | | `IsoDateTime` | see `IsoDateTime` in "Value formats" | | | `source` | | string | | Default the import's source_system. | #### `CddAccount` A new account needs currency and opened_date. An account held by another of your customers refuses the row. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `account_number` | yes | string | | | | `currency` | | string | pattern `^[A-Za-z]{3}$` | An ISO 4217 code, any case; upper-cased. A value that is not a code of the platform's ISO 4217 list (QZQ included) rejects the row (INVALID_ACCOUNTS). | | `opened_date` | | `IsoDate` | see `IsoDate` in "Value formats" | | | `account_type` | | string | default `Current` | | | `status` | | string | default `Active` | | | `balance` | | number or string | | | **Example requests** (the `EXAMPLE-` references are refused: put your own in their place): One business customer with its owners and account (example references, refused as EXAMPLE_ROW): ```json { "source_system": "CRM", "source_file": "onboarding-2026-09-01.json", "classification": "TEST", "rows": [ { "customer_ref": "EXAMPLE-C-0003", "full_name": "Example Logistics UAB", "customer_type": "Business", "country_of_residence": "LT", "account_opening_date": "2024-03-01", "risk_rating": "Medium", "pep_determination": "NOT_PEP", "registration_number": "304999999", "nace_code": "H49.41", "countries_of_operation": [ "LT", "LV", "PL" ], "expected_monthly_turnover": 250000, "related_parties": [ { "full_name": "Example Owner", "role": "UBO", "type": "NATURAL", "ownership_pct": 60, "nationality": "LT" } ], "accounts": [ { "account_number": "EXAMPLE-ACC-0003", "currency": "EUR", "opened_date": "2024-03-01" } ] } ] } ``` **Answers:** **`200`** (body `CddIngestResult`). The import ran. Check `rejected` and `errors`; an import whose every row was refused still answers 200. **`400`** (body `ErrorBody`). The body is not a JSON object, the envelope is incomplete, or the database refused the import before any row was read with a `VALIDATION:` message, answered without its prefix: - classification must be PRODUCTION, TEST or DEMO (`error_code` `INVALID_DATA_CLASSIFICATION`) - classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only (`error_code` `CLASSIFICATION_NOT_ACCEPTED`) The first answers a `classification` your key allows but the CDD intake does not take (`SCALE_TEST`); the second a `TEST` or `DEMO` classification sent to a production institution, which takes production data only. **`401`**: `Unauthorized`, as 3.8 "Answers several endpoints share" says. **`403`** (body `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 classification. **`413`**: `PayloadTooLarge`, as 3.8 "Answers several endpoints share" says. **`429`**: `TooManyRequests`, as 3.8 "Answers several endpoints share" says. **`500`** (body `ErrorBody`). The import could not start, failed part-way or could not finish; `code` is the database's error code (at the start, for example `42501`: the institution cannot receive a CDD import). After a failure part-way, send the whole file again (rows already stored come back `unchanged`). **`503`**: `ServiceUnavailable`, as 3.8 "Answers several endpoints share" says. **Example answers:** `200`: ```json { "ok": true, "batch_ref": "CDD-2026-000042", "inserted": 0, "updated": 0, "unchanged": 0, "rejected": 1, "errors": [ { "row": 1, "customer_ref": "EXAMPLE-C-0003", "reason": "EXAMPLE_ROW", "detail": "this row comes from the sample file: replace it with your own data" } ] } ``` **Error answers** (the body is `{"error": ..., "error_code": ...}`, with `code` on a server-side refusal; match the status and `error_code`, never the words): | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `400` | `Body must be valid JSON` | `BODY_NOT_JSON` | | | | `400` | `Body must be a JSON object` | `BODY_NOT_OBJECT` | | | | `400` | `source_system is required` | `MISSING_SOURCE_SYSTEM` | | | | `400` | `rows must be a non-empty array` | `MISSING_ROWS` | | | | `400` | `rows may not exceed 50000 per request` | `TOO_MANY_ROWS` | | | | `400` | `classification must be PRODUCTION, TEST or DEMO` | `INVALID_DATA_CLASSIFICATION` | | classification SCALE_TEST, which the key allows | | `403` | `API key not allowed from this address` | `API_KEY_ADDRESS_NOT_ALLOWED` | | | | `403` | `Institution is not active` | `INSTITUTION_NOT_ACTIVE` | | | | `403` | `This API key may not submit TEST customer data` | `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` | | | | `500` | `Could not start the CDD import` | `IMPORT_START_FAILED` | `42501` | | | `500` | `The CDD import failed` | `IMPORT_FAILED` | `57014` | | | `500` | `Could not finish the CDD import` | `IMPORT_FINISH_FAILED` | | | ### 3.7. `GET /v1/health`: Liveness Operation `health`. No API key. Answers `200 {"status":"ok"}` when the application server is up and serving its API routes. It needs no key, reads nothing from the request, makes no database call and is not rate limited. It does **not** say whether the database is reachable: a payment can still fail while this answers ok. **Answers:** **`200`** (body `Health`; header `Cache-Control`). The application server is up. **Example answers:** `200`: ```json { "status": "ok" } ``` ### 3.8. Answers several endpoints share The answers below are the same on every endpoint that gives them; each endpoint above names the ones it gives. #### `Unauthorized` Given by `POST /v1/transactions`, `GET /v1/transactions/{id}/decision`, `POST /v1/cards`, `POST /v1/card-authorizations`, `POST /v1/customer-events`, `POST /v1/cdd-ingest`. **`401`** (body `ErrorBody`). The key is missing, malformed (not `.`), unknown, revoked or wrong. Check the key; do not retry the same request. | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `401` | `Missing or malformed API key` | `API_KEY_MISSING` | | | | `401` | `Invalid or revoked API key` | `API_KEY_INVALID` | | | #### `PayloadTooLarge` Given by `POST /v1/transactions`, `POST /v1/cards`, `POST /v1/card-authorizations`, `POST /v1/customer-events`, `POST /v1/cdd-ingest`. **`413`** (body `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. | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `413` | `Request body too large` | `BODY_TOO_LARGE` | | | #### `TooManyRequests` Given by `POST /v1/transactions`, `GET /v1/transactions/{id}/decision`, `POST /v1/cards`, `POST /v1/card-authorizations`, `POST /v1/customer-events`, `POST /v1/cdd-ingest`. **`429`** (body `ErrorBody`; header `Retry-After`). Rate limited. Wait the seconds in `Retry-After`, then retry the same request. Limits are per server instance: 3 000 requests a minute per key (bursts of 1 000), 120 a minute per address for keys not yet seen, and 20 failed authentications per address within 10 minutes, after which the address is refused for 10 minutes, the right key included. | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `429` | `Too many failed authentication attempts from this address; retry after the number of seconds in Retry-After` | `TOO_MANY_FAILED_AUTHENTICATIONS` | | | | `429` | `Too many requests for this API key; retry after the number of seconds in Retry-After` | `RATE_LIMITED_KEY` | | | | `429` | `Too many requests from this address; retry after the number of seconds in Retry-After` | `RATE_LIMITED_ADDRESS` | | | #### `DecisionServiceUnavailable` Given by `POST /v1/transactions`, `POST /v1/card-authorizations`. **`503`** (body `ErrorBody`; header `Retry-After`). The service cannot take the payment or card event now; nothing was stored and your key was not judged. `Service busy`: every decision this server instance runs at once is taken, your institution already holds its share of them (known once the key is checked), or a request with the same API key and `Idempotency-Key` is still being decided here. It is answered at once, before anything is stored; wait the seconds in `Retry-After` (1). `Service unavailable`: the key could not be checked (the database did not answer three tries); wait `Retry-After` (5). `Service temporarily unavailable`: a setting of the service is unusable (no `Retry-After`). Retry the same request with back-off (for example 1 s, 2 s, 4 s ... up to a minute): a payment's `source_system` + `external_transaction_id` (and `Idempotency-Key`), and a card event's `Idempotency-Key`, make the retry safe: it never creates a second payment or card event (what a repeat answers is in the Idempotency and retries guide). | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `503` | `Service busy` | `SERVICE_BUSY` | | | | `503` | `Service unavailable` | `SERVICE_UNAVAILABLE` | | | | `503` | `Service temporarily unavailable` | `SERVICE_SETTINGS_UNUSABLE` | | | #### `ServiceUnavailable` Given by `GET /v1/transactions/{id}/decision`, `POST /v1/cdd-ingest`. **`503`** (body `ErrorBody`; header `Retry-After`). The service cannot take the request now; your key was not judged. `Service unavailable`: the key could not be checked (the database did not answer three tries); wait the seconds in `Retry-After` (5). `Service temporarily unavailable`: the service's rate-limit settings are unusable (no `Retry-After`). Retry with back-off (for example 1 s, 2 s, 4 s ... up to a minute); a retry with the same request is safe. | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `503` | `Service unavailable` | `SERVICE_UNAVAILABLE` | | | | `503` | `Service temporarily unavailable` | `SERVICE_SETTINGS_UNUSABLE` | | | #### `EventServiceUnavailable` Given by `POST /v1/cards`, `POST /v1/customer-events`. **`503`** (body `ErrorBody`; header `Retry-After`). The service cannot take the customer event or the card registration now; nothing was stored and your key was not judged. `Service busy`: every customer event and card registration this server instance records at once is taken (a pool of their own, never a payment's or a card event's), or your institution already holds its share of them (known once the key is checked). It is answered at once, before anything is stored; wait the seconds in `Retry-After` (1). `Service unavailable`: the key could not be checked (the database did not answer three tries); wait `Retry-After` (5). `Service temporarily unavailable`: a setting of the service is unusable (no `Retry-After`). Retry the same request with back-off: a customer event's `source_system` + `external_event_id` never make a second event, and a card's `card_token` never makes a second card. | Status | `error` | `error_code` | `code` | When | |---|---|---|---|---| | `503` | `Service busy` | `SERVICE_BUSY` | | | | `503` | `Service unavailable` | `SERVICE_UNAVAILABLE` | | | | `503` | `Service temporarily unavailable` | `SERVICE_SETTINGS_UNUSABLE` | | | ### 3.9. The answer objects The fields of the success answers above. Ignore a field you do not know: new ones are added within v1. #### `PaymentDecision` The answer to a payment. A duplicate replay carries only duplicate, transaction_id, decision_id, decision_ref, status, rejection_action, correlation_id, received_at, policy_version and, when the first request had any, warnings. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `duplicate` | yes | boolean | | true when this payment had already been received. | | `transaction_id` | | string | format uuid | | | `decision_id` | yes | string | format uuid | | | `decision_ref` | yes | string | | DEC--; quote it to the institution's analysts. | | `status` | yes | `DecisionStatus` | one of `RECEIVED`, `SCREENING`, `RELEASED`, `HOLD`, `AI_INVESTIGATION`, `HUMAN_REVIEW`, `BLOCKED`, `ESCALATED`, `FAILED`, `EXPIRED`; see `DecisionStatus` in "Value formats" | | | `rejection_action` | | `RejectionAction` | one of `REJECT`, `FREEZE`; see `RejectionAction` in "Value formats" | | | `decision_reason` | | string or null | | Why the decision is in this status, in fixed words of the engine. | | `correlation_id` | | string | | | | `received_at` | | string | format date-time | | | `policy_version` | | string | | The label of your institution's decision policy that applies to this payment, as the policy was named when it was put in force (for example decision-policy-v1.6; a policy changed later may carry a note after its label). Free text: show or log it, never parse it. | | `alert_id` | | string or null | format uuid | The alert a rule hit raised, if any. | | `triggered_rules` | | array of string | | The monitoring rule versions that fired. | | `rules_evaluated` | | integer | | | | `rules_deferred` | | integer | | Rules evaluated later by batch monitoring, not in real time: rules that need a longer history than the real-time check reads. On a payment already RELEASED (or otherwise final) what they find is an alert for your team; it never changes the payment's decision. | | `tm_latency_ms` | | integer or null | | | | `total_latency_ms` | | integer or null | | Set once the decision is final. | | `estimated_next_state` | | string | | What can happen next, in words. | | `screening_timeout` | | boolean | | Present and true when screening did not finish within its budget or failed; the payment is held for a person (with status SCREENING when the server had no capacity left to hold it at once: the scheduled sweep holds it within minutes). Never settle it until its decision is RELEASED: it is screened again in the background and released if nothing is found. | | `warnings` | | array of `ContextWarning` | | Present only when a session or device field was malformed and not stored: which field and why, in fixed words that never quote your value. The payment is decided as if the field had not been sent. | #### `ContextWarning` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `field` | yes | string | one of `ip_address`, `ip_country`, `device_id`, `device_timezone`, `device_utc_offset`, `session_id`, `initiation_channel`, `initiation`, `device_os`, `vpn_or_proxy`, `remote_access_detected` | | | `message` | yes | string | | Our own words, ending ': not stored' (or, for an offset that disagrees with the time zone, saying the zone's own offset is stored). Listed on the Errors page, 'Session and device warnings'. | #### `PostEventPayment` The answer to a payment sent with executed_during_outage true, and to its repeat. It has no decision: nothing holds, releases or rejects it. It is screened and evaluated by your monitoring rules after the event; any alert goes to your team. A repeat carries duplicate, post_event, status, transaction_id, transaction_ref, correlation_id, received_at, executed_at and, when the first request had any, warnings. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `duplicate` | yes | boolean | | | | `post_event` | yes | boolean | always `true` | | | `status` | yes | string | always `POST_EVENT` | Not a decision status: the payment is checked after the event, never decided. | | `transaction_id` | yes | string | format uuid | | | `transaction_ref` | | string | | RTX--. | | `correlation_id` | | string | | | | `received_at` | | string | format date-time | | | `executed_at` | | string | format date-time | The time your system executed it (transaction_timestamp). | | `outage_payment_policy` | | string | one of `SKIP_AND_CHECK_LATER` | Your institution's policy it was accepted under. | | `checks` | | object | | What was queued: sanctions_screening QUEUED, and monitoring_rules_queued, the number of your rules it is evaluated by after the event (batch-only rules read it in their nightly run). | | `message` | | string | | The same in words. | | `warnings` | | array of `ContextWarning` | | Present only when a session or device field was malformed and not stored: which field and why, in fixed words that never quote your value. The payment is decided as if the field had not been sent. | #### `DecisionView` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `decision_id` | | string | format uuid | | | `decision_ref` | | string | | | | `transaction_id` | | string | format uuid | | | `status` | | `DecisionStatus` | one of `RECEIVED`, `SCREENING`, `RELEASED`, `HOLD`, `AI_INVESTIGATION`, `HUMAN_REVIEW`, `BLOCKED`, `ESCALATED`, `FAILED`, `EXPIRED`; see `DecisionStatus` in "Value formats" | | | `rejection_action` | | `RejectionAction` | one of `REJECT`, `FREEZE`; see `RejectionAction` in "Value formats" | | | `freeze_lifted_at` | | string or null | format date-time | When the freeze of a payment rejected with FREEZE was lifted (every sanctions alert of the payment cleared as a false positive; rejection_action is then REJECT and decision.freeze_lifted was sent). null otherwise. | | `decision_reason` | | string or null | | | | `channel` | | string or null | | SEPA, SWIFT, CARD or ATM, as received. | | `direction` | | string or null | | INCOMING or OUTGOING, as received. | | `instant` | | boolean | | true when the payment was sent as an instant transfer (instant true). | | `correlation_id` | | string | | | | `triggered_rules` | | array of string | | | | `ai_decision` | | string or null | one of `LOW_RISK`, `UNCERTAIN`, `HIGH_RISK`, `AI_FAILURE`, `AI_TIMEOUT`, `AI_CANCELLED`, `AI_INVALID_RESULT`, `AI_MAX_RETRIES_EXCEEDED` | The AI triage's recommendation, as a risk view. Never a decision by itself. | | `ai_confidence` | | integer or null | | 0..100. | | `mandatory_review` | | boolean | | true when a person must decide; such a payment is never released automatically. | | `mandatory_review_reasons` | | array of string | | | | `policy_version` | | string | | The label of your institution's decision policy that applies to this payment (see PaymentDecision). Free text: never parse it. | | `decision_engine_version` | | string | | | | `received_at` | | string | format date-time | | | `held_at` | | string or null | format date-time | | | `ai_started_at` | | string or null | format date-time | | | `ai_completed_at` | | string or null | format date-time | | | `decided_at` | | string or null | format date-time | | | `released_at` | | string or null | format date-time | | | `expires_at` | | string or null | format date-time | When a hold expires under your decision policy (the payment then goes to a person, EXPIRED then HUMAN_REVIEW). It is set from the policy's hold period when the payment is received, whatever its status, and acts only while the payment is HOLD or HUMAN_REVIEW and no open case holds it: on any other status ignore it. | | `tm_latency_ms` | | integer or null | | | | `total_latency_ms` | | integer or null | | | #### `PostEventView` The look-up of a payment sent after an outage; it has no decision. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `post_event` | | boolean | always `true` | | | `status` | | string | always `POST_EVENT` | | | `transaction_id` | | string | format uuid | | | `transaction_ref` | | string | | | | `executed_at` | | string | format date-time | | | `received_at` | | string | format date-time | | #### `CardResult` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `created` | yes | boolean | | true when this call registered the card. | | `changed` | yes | boolean | | true when this call created or changed the card; false for a repeat. | | `card` | yes | `Card` | | | | `warnings` | yes | array of `CardWarning` | | | #### `Card` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `card_id` | yes | string | format uuid | Underlayer's id of the card. | | `card_token` | yes | string | | | | `customer_ref` | yes | string | | | | `masked_pan` | | string or null | | | | `card_type` | yes | string | one of `PHYSICAL_CARD`, `VIRTUAL_CARD` | | | `status` | yes | string | one of `ACTIVE`, `SUSPENDED`, `TERMINATED` | | | `data_classification` | yes | string | one of `PRODUCTION`, `TEST`, `SCALE_TEST`, `DEMO` | | | `updated_at` | yes | string | format date-time | | #### `CardWarning` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `code` | yes | string | one of `OPEN_ALERT_SUSPENDED_CARD` | | | `message` | yes | string | | Our own words. Listed on the Errors page, 'Card registration warnings'. | #### `CardAuthorizationResult` A duplicate replay carries only duplicate, event_id, event_ref, authorization_result, decline_reason and correlation_id. | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `duplicate` | yes | boolean | | | | `event_id` | yes | string | format uuid | | | `event_ref` | yes | string | | CAE--. | | `authorization_result` | yes | string | one of `APPROVED`, `DECLINED`, `REFUNDED`, `REVERSED` | REFUNDED for a refund and REVERSED for a reversal; neither is ever declined. | | `decline_reason` | | string or null | one of `CARD_TERMINATED`, `CARD_SUSPENDED`, `INVALID_CVV`, `INVALID_PIN`, `RULE_DECLINE`, `RULE_EVALUATION_ERROR` | RULE_EVALUATION_ERROR: a real-time card rule could not be evaluated and your decision policy declines the event for it (card_rule_error_action DECLINE, or no decision policy in force). The order: a refund or a reversal is never declined; then the card's status, cvv_result, pin_result, a REJECT rule; then a rule error. | | `flagged` | | boolean | | Always false: no card rule approves an event and flags it. Read rules_fired and alerts_generated. | | `rules_fired` | | array of `RuleFired` | | | | `alerts_generated` | | integer | | The alerts the rules that fired raised for the event. The alert raised for a rule that could not be evaluated is not counted here; rule_errors names that rule. | | `rule_errors` | | array of object | | Every real-time card rule that could not be evaluated for the event, or that fired but whose alert could not be recorded. Empty when every rule ran. The event is answered all the same, and an alert for a person is raised on it. | | `rule_error_handling` | | string or null | one of `APPROVE_AND_ALERT`, `DECLINE`, `ALERT_ONLY` | What a rule error did to the event; null when rule_errors is empty. APPROVE_AND_ALERT: your decision policy does not decline the event for it (the platform's default). DECLINE: your decision policy declines an approved authorisation or withdrawal for it (RULE_EVALUATION_ERROR), or no decision policy is in force. ALERT_ONLY: a refund or a reversal, never declined. A person reviews the event in every case. | | `correlation_id` | | string | | | | `latency_ms` | | integer | | | #### `RuleFired` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `rule_code` | | string | | | | `version_id` | | string | format uuid | | | `transaction_action` | | string | | ALERT_ONLY or REJECT. REJECT declines the event (RULE_DECLINE). | | `card_action` | | string or null | | NONE, SUSPEND_CARD or TERMINATE_CARD; carried out in the background. | #### `CustomerEventResult` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `duplicate` | yes | boolean | | true for a repeat of a recorded event: the first answer, nothing more stored. | | `event_id` | yes | string | format uuid | | | `event_ref` | yes | string | | CEV--. | | `event_type` | yes | string | | | | `received_at` | yes | string | format date-time | When Underlayer recorded the event (the first time, for a repeat). | | `warnings` | | array of `CustomerEventWarning` | | Present only when a session, device or card field was not used; a field left out says nothing. | #### `CustomerEventWarning` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `field` | yes | string | one of `ip_address`, `ip_country`, `device_id`, `device_timezone`, `device_utc_offset`, `session_id`, `initiation_channel`, `device_os`, `vpn_or_proxy`, `remote_access_detected`, `card_token`, `card_event_ref` | | | `message` | yes | string | | Our own words. Listed on the Errors page, 'Customer event warnings'. | #### `CddIngestResult` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `ok` | yes | boolean | always `true` | | | `batch_ref` | yes | string or null | | CDD--; the import as shown on the CDD import screen. | | `inserted` | yes | integer | | New customers. | | `updated` | yes | integer | | Existing customers whose CDD record changed (a new CDD version). | | `unchanged` | yes | integer | | Rows that changed nothing. | | `rejected` | yes | integer | | Rows refused. | | `errors` | yes | array of `CddRowError` | at most 100 items | The first 100 refused rows (rejected counts them all). | #### `CddRowError` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `row` | | integer | | 1-based position of the row in the request. | | `customer_ref` | | string or null | | | | `reason` | | string | one of `UNKNOWN_FIELD`, `MISSING_CUSTOMER_REF`, `EXAMPLE_ROW`, `MISSING_NAME`, `MISSING_COUNTRY_OF_RESIDENCE`, `MISSING_ACCOUNT_OPENING_DATE`, `INVALID_CUSTOMER_TYPE`, `INVALID_RISK_RATING`, `INVALID_SANCTIONS_STATUS`, `INVALID_PEP_STATUS`, `INVALID_PEP_DETAILS`, `INVALID_COUNTRY`, `INVALID_VALUE`, `INVALID_NACE_CODE`, `INVALID_COUNTRIES_OF_OPERATION`, `INVALID_RELATED_PARTIES`, `INVALID_ACCOUNTS`, `ACCOUNT_BELONGS_TO_ANOTHER_CUSTOMER`, `NEW_ACCOUNT_NEEDS_OPENED_DATE`, `NEW_ACCOUNT_NEEDS_CURRENCY`, `ROW_REFUSED` | See the Errors page, "CDD row reasons". | | `detail` | | string or null | | Which field and what is wrong, in fixed words; never the value you sent (except an account number you sent). | #### `Health` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `status` | yes | string | always `ok` | | ### 3.10. Value formats | Format | Type | Values | Rule | |---|---|---|---| | `IsoDate` | string | pattern `^[0-9]{4}-(0[1-9]\|1[0-2])-(0[1-9]\|[12][0-9]\|3[01])$` | A calendar date written YYYY-MM-DD. Other shapes are refused (01.09.2026 would otherwise be read as 9 January). | | `IsoDateTime` | string | pattern `^[0-9]{4}-(0[1-9]\|1[0-2])-(0[1-9]\|[12][0-9]\|3[01])(T([01][0-9]\|2[0-3]):[0-5][0-9](:[0-5][0-9]([.][0-9]{1,6})?)?(Z\|[+-](0[0-9]\|1[0-4]):[0-5][0-9])?)?$` | A date YYYY-MM-DD or a date-time YYYY-MM-DDThh:mm[:ss[.ffffff]] with an optional zone Z, +hh:mm or -hh:mm. No zone means UTC. Refused: a space instead of T, a lower-case t or z, 24:00, second 60, +0300 or +03, an impossible day. | | `Amount` | number or string | | A JSON number (1250.00), or a string of digits with a dot as the decimal separator ("1250.00"), at most 40 characters. At most two decimals (more are refused, never rounded); below 1000000000000 (the largest is 999999999999.99). In a string: no exponent, comma, NaN or Infinity. Greater than zero, except where the field may be zero or negative (available_balance). Anything else is refused with a 400 naming the field: "% is required", "% must be a number", "% must be a decimal number such as 125.50 (no exponent, NaN or Infinity)", "% may have at most two decimals", "% exceeds the largest supported amount, 999999999999.99" or "% must be greater than zero". | | `Currency` | string | pattern `^[A-Za-z]{3}$` | An ISO 4217 code such as EUR: three letters, upper-cased on arrival, that name a currency on the platform's ISO 4217 list. Anything else, three letters that name no currency (QZQ) included, is refused with a 400, "% must be a three-letter ISO 4217 currency code such as EUR". | | `Country` | string | pattern `^[A-Za-z]{2}$` | An ISO 3166-1 alpha-2 code such as LT, upper-cased on arrival. It must be on the platform's country list (every ISO 3166-1 alpha-2 code and XK; XX is not), otherwise the answer is a 400, "% must be a two-letter ISO 3166-1 alpha-2 country code such as LT". An empty value counts as absent. | | `DataClassification` | string | one of `PRODUCTION`, `TEST`, `SCALE_TEST`, `DEMO`; default `PRODUCTION` | What kind of data this is. Your key must allow it (403 otherwise), and a production institution takes PRODUCTION only (400 CLASSIFICATION_NOT_ACCEPTED). Only PRODUCTION data is triaged by the AI. TEST and DEMO, which only a sandbox takes, call no AI model, so a held payment goes to a person (HUMAN_REVIEW) and never waits in AI_INVESTIGATION; SCALE_TEST has no AI triage. | | `DecisionStatus` | string | one of `RECEIVED`, `SCREENING`, `RELEASED`, `HOLD`, `AI_INVESTIGATION`, `HUMAN_REVIEW`, `BLOCKED`, `ESCALATED`, `FAILED`, `EXPIRED` | Only RELEASED means the payment may settle. RELEASED and BLOCKED are final; every other status changes later. A BLOCKED payment always carries rejection_action, which says what to do with its funds (a rejected payment is never stored without one). RECEIVED: recorded, not yet screened; it normally changes within the same request. SCREENING: being screened; it normally changes within the same request, and when screening did not finish (screening_timeout) the sweep holds it within minutes. HOLD: held until what stopped it (a rule, a screening match, a country restriction) is decided. AI_INVESTIGATION: the AI triage is queued; your decision policy acts on its recommendation, or a person decides. HUMAN_REVIEW: with a person. ESCALATED: taken into a case; a person decides it there. EXPIRED: the hold period of your decision policy ran out while a person had the payment; it stays with a person. FAILED: no path sets it today; treat it as not released and quote the decision_ref to Underlayer. | | `RejectionAction` | string or null | one of `REJECT`, `FREEZE` | What to do with the funds of a rejected payment, set when status is BLOCKED and only then (null otherwise): a BLOCKED payment always has one. REJECT: do not execute it; money that came in goes back under your own procedure. FREEZE: the payment had a sanctions match that was confirmed, or not yet cleared as a false positive, when it was rejected; do not execute it and do not return the money: keep the funds where they are and handle them under your sanctions procedure, which reports a confirmed match. A FREEZE becomes REJECT once every sanctions alert of the payment is cleared as a false positive: the payment stays BLOCKED, decision.freeze_lifted is sent once and the decision's freeze_lifted_at says when. | ## 4. Statuses, idempotency, retries, 429 and 503 ### What a payment's answer means Within a budget of 12 seconds the payment is evaluated by your institution's own monitoring rules and screened against the sanctions lists. A customer's PEP status is your own KYC determination, sent with the customer's record (Customer data). Then: | Answer | Meaning | What your system does | |---|---|---| | `200`, `status: RELEASED` | Nothing found. | Settle. | | `202`, `status: BLOCKED` | Rejected, and final (a monitoring rule that rejects payments, or a country restriction). `rejection_action` says what to do with the funds. | **Do not settle.** `REJECT`: reject the payment, and return money that came in under your own procedure. `FREEZE`: a sanctions match was confirmed or not yet cleared; keep the funds where they are, return nothing and handle them under your sanctions procedure. | | `202`, any other status | Your institution's monitoring is still deciding: a person, or your decision policy on the AI triage's recommendation. | **Do not settle.** Wait for the decision webhook or poll the decision: it ends `RELEASED` or `BLOCKED`. | | `200`, `duplicate: true` | A repeat of a payment already received: its current decision. | Read `status`. | | `409` | The reference or the key of an earlier payment with another customer, amount, currency, direction or channel, or a key and a reference of two different payments. Nothing was stored. | Retry with the first body; a new payment needs a new reference and key (Idempotency and retries). | | `202`, `status: POST_EVENT` | A payment sent after an outage (Payments sent after an outage). | Nothing: it is checked after the event. | | `4xx` | Refused; nothing stored. | Correct the request (Errors, section 2). | If screening does not finish in time the payment is held for a person (`HUMAN_REVIEW`, `screening_timeout: true`): it is never released unscreened. It is screened again in the background within minutes, and released if nothing is found. Every status a decision can have, and what it means for the money: | Status | Meaning | The money | |---|---|---| | `RELEASED` | Nothing stops it. Final. | Settle. | | `BLOCKED` | Rejected. Final. It always carries `rejection_action` (`REJECT` or `FREEZE`). | As `rejection_action` says. | | `RECEIVED` | Recorded, not yet screened; it normally changes within the same request. | Hold. | | `SCREENING` | Being screened; it normally changes within the same request. When screening did not finish (`screening_timeout`), the scheduled sweep holds it within minutes. | Hold. | | `HOLD` | Held until what stopped it (a rule, a screening match, a country restriction) is decided. | Hold. | | `AI_INVESTIGATION` | The AI triage is queued; your decision policy acts on its recommendation, or a person decides. | Hold. | | `HUMAN_REVIEW` | With a person. | Hold. | | `ESCALATED` | Taken into a case; a person decides it there. | Hold. | | `EXPIRED` | The hold period of your decision policy ran out while a person had it; it stays with a person. | Hold. | | `FAILED` | No path sets it today. | Hold, and quote the `decision_ref` to Underlayer. | A status this table does not list is treated the same way: not released, hold the money (Versioning and changelog). ### What a card event's answer means | `event_type` | Answer | Can be declined? | |---|---|---| | `CARD_AUTHORIZATION` | `APPROVED` or `DECLINED` | Yes: the card's status, `cvv_result` or `pin_result` `NO_MATCH`, a rule that rejects, or a rule error under your decision policy. | | `ATM_WITHDRAWAL` | `APPROVED` or `DECLINED` | Yes, as an authorisation. Without `card_presence` it is card-present; without `mcc` it is 6011. | | `CARD_REFUND` | `REFUNDED` | Never. `original_event_ref` optional. | | `CARD_REVERSAL` | `REVERSED` | Never. `original_event_ref` required. | A decline is a `200` answer, not an error: its reason is in `decline_reason` (Errors, "Card declines"). ### Idempotency A network can fail after the request reached us and before the answer reached you. Every write of this API can be sent again safely, as long as you send it the same way. | Endpoint | What makes two requests the same | A repeat answers | |---|---|---| | `POST /v1/transactions` | The same `source_system` and `external_transaction_id`, or the same `Idempotency-Key`, within your institution. The key is optional. | `200`, `duplicate: true`, the payment's **current** decision (its status may have moved on). Nothing new is stored. A repeat must carry the first request's `customer_ref`, `amount`, `currency`, `direction`, `channel` and `instant` (left out is `false`), or it is refused `409`. | | `POST /v1/card-authorizations` | The same `Idempotency-Key` within your institution, only. The key is **required** (`400` without it), at most 255 characters. | `200`, `duplicate: true`, the card event's **first** decision. A repeat must carry the first request's `card_token`, `event_type`, `amount` and `currency`, or it is refused `409`. | | `POST /v1/customer-events` | The same `source_system` and `external_event_id` within your institution. No key is needed. | `200`, `duplicate: true`, the first answer. A repeat must carry the first request's `customer_ref` and `event_type`, or it is refused `409`. | | `POST /v1/cdd-ingest` | Rows are matched by `customer_ref`, accounts by `account_number`. | A row that changes nothing counts as `unchanged` and makes no new CDD version. | | `GET /v1/transactions/{id}/decision` | Read only. | The current decision. | A repeat is the same request sent again. Amounts are compared as numbers (`140` and `140.00` are one amount) and codes as we store them (`outgoing` and `OUTGOING` are one direction). A request that reuses a key or a reference with another body is refused `409` with `error_code` `IDEMPOTENCY_CONFLICT`, and its `error` names the fields that differ, never a value; nothing is stored. A payment whose `Idempotency-Key` belongs to one of your payments and whose `external_transaction_id` to another is refused `409` with `REFERENCE_KEY_MISMATCH`. A `409` is never retried unchanged: a retry sends the first body; a new payment or event needs a new reference and a new key. Two requests that are the same and arrive at the same moment wait for each other: the second answers like a repeat. When both reach the same server instance while the first is still being decided, the second is answered at once `503 Service busy` with `Retry-After: 1`; its retry is then answered like any repeat. ### When to retry | Answer | Retry? | |---|---| | `200`, `202` | No: it is the answer. | | `400`, `401`, `403`, `404`, `405`, `409`, `413` | Never unchanged: correct the request. | | `429` | Yes, after the seconds in `Retry-After`. | | `500` | Once, the same request. If the same `code` comes back, contact Underlayer. | | `503` | Yes, after `Retry-After` (1 s for `Service busy`, 5 s for `Service unavailable`), with back-off. A `503` without `Retry-After` (`SERVICE_SETTINGS_UNUSABLE`): with back-off from 1 s. | | A bare `502` or `504`, or a `5xx` answer that is not JSON | Yes, with back-off: it comes from our hosting provider. | The status decides first: a `4xx` of the rows above is never retried unchanged, even when its body is not JSON. Back off by doubling the wait (1 s, 2 s, 4 s ... up to a minute), never less than `Retry-After`. Always retry with the same body, the same `external_transaction_id` and the same `Idempotency-Key`: a retry with a new reference is a new payment. When the first answer never arrived (a timeout, a dropped connection), the retry can be the request's first answer you see: `200` with `duplicate: true` for a payment, a card event or a customer event, `200` with `changed: false` for a card. That is the result of your request, not a failure: read it as the first answer. ### Rate limits (`429`) | Limit | When it applies | Answer | |---|---|---| | Failed authentications | 20 failed authentications from one address within 10 minutes. The address is refused for 10 minutes on every client endpoint, a right key included. | `429` `Too many failed authentication attempts from this address; retry after the number of seconds in Retry-After` | | Per API key | More than 3 000 requests a minute on one key, with bursts of 1 000, per server instance. | `429` `Too many requests for this API key; retry after the number of seconds in Retry-After` | | Per address, unknown key | More than 120 requests a minute from one address with a key the server instance has not yet seen authenticate. | `429` `Too many requests from this address; retry after the number of seconds in Retry-After` | The client address is the one our hosting provider saw. An IPv6 client is counted by its /64 network. Each server instance keeps its own counters: plan your traffic within the limits above, never above them. ### Back-pressure (`503`) and `Retry-After` Each server instance decides a fixed number of payments and card events at once, and one institution at most its share of them. Over that, the next request answers at once: ```http HTTP/1.1 503 Service Unavailable Retry-After: 1 Content-Type: application/json {"error":"Service busy","error_code":"SERVICE_BUSY"} ``` Nothing was stored. A repeat (the same key and `Idempotency-Key`) of a request still being decided answers the same. Retry the same request after `Retry-After`, with back-off: the payment's own reference and the `Idempotency-Key` make the retry safe (Idempotency and retries). Customer events (Customer events) have a pool of their own (one institution at most its share of it), so a burst of sign-ins never takes the payments' decisions; over it they answer the same `503 Service busy`, and their `source_system` + `external_event_id` make the retry safe. When the API key itself cannot be checked the answer is `503 {"error":"Service unavailable","error_code":"SERVICE_UNAVAILABLE"}` with `Retry-After: 5`; it is not a key error and does not count as a failed authentication. ### Body size (`413`) A body larger than 64 000 bytes (payments, card events, customer events) or 2 000 000 bytes (CDD) is refused with `413` before it is read and before the key is checked. Split a large CDD file into several requests. ## 5. Webhooks A payment that is not released at once is decided later: by a person, or by your decision policy on the AI triage's recommendation. Set your webhook address and its secret on the *API and webhooks* screen, and every status change of a payment decision is posted to it. A change Underlayer makes to one of your cards is posted to the same address, signed the same way (`card.suspended`, `card.terminated`, `card.reinstated`; Cards). A delivery leaves within seconds of the change, whoever made it: our API's answer, a person on the screens, your decision policy on an AI triage, or a scheduled check. A retry follows the schedule below. The changes the API's own answer makes are posted too, so a delivery can repeat what the answer already told you. A payment sent in real time is first set to `SCREENING`, so it gets `decision.screening`, then one delivery per status the answer reaches: a payment released at once gets `decision.screening` and `decision.released`; one held gets `decision.hold`, followed by `decision.human_review` when the same answer passes it to a person or `decision.blocked` when a rule rejects it. Act on each change once, whichever reaches you first, the answer or the delivery: key what you do by the payment's `decision_id` and the delivery's event type (`X-Underlayer-Event`), never by its status alone: a `decision.freeze_lifted` is a new instruction for a payment that stays `BLOCKED` (below). A repeated delivery is recognised by `X-Underlayer-Idempotency-Key`. A delivery is queued only while a webhook address is set: a change made while none is set is never sent, so poll the decision for those. ### `decisionStatusChanged`: A payment decision changed status `POST` to your webhook address. Sent to the institution's webhook URL (set on the API and webhooks screen) on every status change of a payment decision after it was received: `decision.screening`, `decision.released`, `decision.hold`, `decision.ai_investigation`, `decision.human_review`, `decision.blocked`, `decision.escalated`, `decision.expired`, `decision.failed`; and `decision.freeze_lifted` when a rejected payment's freeze is lifted (below). A card's status change has a webhook of its own (`cardStatusChanged`). **A freeze lifted.** A payment rejected with `rejection_action` `FREEZE` stays rejected. When every sanctions alert of the payment is later cleared as a false positive, its `rejection_action` becomes `REJECT` and `decision.freeze_lifted` is sent once, with `status` `BLOCKED` and `rejection_action` `REJECT`: the funds may now be handled as for any rejected payment (money that came in goes back under your own procedure). It is sent only for a payment that was rejected with `FREEZE`, never twice, and never while another of its sanctions alerts is confirmed or still awaiting a decision. The decision's `freeze_lifted_at` says when. **Verify every delivery.** `X-Underlayer-Signature` is `sha256=` and the hexadecimal HMAC-SHA256, keyed with the webhook secret, of `.` (the timestamp in Unix seconds, a dot, the body exactly as received). Refuse a delivery whose signature does not match or whose timestamp is too old. Nothing is sent unsigned: without a secret the delivery is skipped. **Delivery.** The webhook URL's host name must resolve to public internet addresses only: a delivery is not sent to a name that resolves to a private, loopback, link-local or other reserved address, and the connection goes to the address that was checked. A redirect is not followed. Answer any 2xx within 10 seconds. Otherwise (a 3xx included) the delivery is retried after 1 minute, 5 minutes, 15 minutes, 1 hour, 4 hours, 12 hours and 24 hours, and marked failed after 8 attempts. A delivery can arrive more than once and out of order: de-duplicate by `X-Underlayer-Idempotency-Key` and order by `occurred_at`; when in doubt, read the decision. | Header | Value | |---|---| | `X-Underlayer-Event` | decision., or decision.freeze_lifted | | `X-Underlayer-Delivery` | The delivery's id (the same on every attempt). (format uuid) | | `X-Underlayer-Idempotency-Key` | :, the same on every attempt. | | `X-Underlayer-Timestamp` | Unix seconds when this attempt was signed. | | `X-Underlayer-Signature` | sha256= | #### `DecisionWebhookEvent` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `event_type` | yes | string | | decision., or decision.freeze_lifted (a rejected payment's freeze lifted: status BLOCKED, rejection_action REJECT) | | `delivery_id` | yes | string | format uuid | | | `attempt` | yes | integer | at least 1 | | | `decision_id` | yes | string | format uuid | | | `decision_ref` | yes | string | | | | `transaction_id` | yes | string | format uuid | | | `status` | yes | `DecisionStatus` | one of `RECEIVED`, `SCREENING`, `RELEASED`, `HOLD`, `AI_INVESTIGATION`, `HUMAN_REVIEW`, `BLOCKED`, `ESCALATED`, `FAILED`, `EXPIRED`; see `DecisionStatus` in "Value formats" | | | `rejection_action` | | `RejectionAction` | one of `REJECT`, `FREEZE`; see `RejectionAction` in "Value formats" | | | `reason` | | string or null | | | | `correlation_id` | | string | | | | `occurred_at` | yes | string | format date-time | | Example payload: ```json { "event_type": "decision.released", "delivery_id": "00000000-0000-4000-8000-000000000051", "attempt": 1, "decision_id": "00000000-0000-4000-8000-000000000012", "decision_ref": "DEC-2026-000124", "transaction_id": "00000000-0000-4000-8000-000000000011", "status": "RELEASED", "rejection_action": null, "reason": "Released by analyst after review", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000013", "occurred_at": "2026-09-01T10:02:17+00:00" } ``` ### `cardStatusChanged`: Underlayer changed the status of one of your cards `POST` to your webhook address. Sent to the institution's webhook URL, signed and delivered exactly as `decisionStatusChanged` (the same secret, headers, retries and verification), each time Underlayer changes the status of one of your cards: `card.suspended` and `card.terminated` (a monitoring rule acted on a card event; `reason_code` `RULE`) and `card.reinstated` (the card is active again: `PERSON`, a person reinstated it; `PERSON_CLEARING`, a person cleared the last alert that suspended it; `AI_CLOSURE`, the AI triage closed that alert and your decision policy lets such a closure reinstate a card). Apply the status in your card processor; when in doubt, keep the card suspended and ask your team. A change that changes nothing, and a status you set yourself (`POST /v1/cards`), send nothing. The payload never carries a card number: the card is named by your `card_token`. `X-Underlayer-Idempotency-Key` is `card:`, the same on every attempt. De-duplicate by it and order by `occurred_at`. | Header | Value | |---|---| | `X-Underlayer-Event` | The event type. (one of `card.suspended`, `card.terminated`, `card.reinstated`) | | `X-Underlayer-Delivery` | The delivery's id (the same on every attempt). (format uuid) | | `X-Underlayer-Idempotency-Key` | card:, the same on every attempt. | | `X-Underlayer-Timestamp` | Unix seconds when this attempt was signed. | | `X-Underlayer-Signature` | sha256= | #### `CardWebhookEvent` | Field | Required | Type | Values | Meaning | |---|---|---|---|---| | `event_type` | yes | string | one of `card.suspended`, `card.terminated`, `card.reinstated` | | | `delivery_id` | yes | string | format uuid | | | `attempt` | yes | integer | at least 1 | | | `card_id` | yes | string | format uuid | | | `card_token` | yes | string | | Your token of the card. | | `status` | yes | string | one of `ACTIVE`, `SUSPENDED`, `TERMINATED` | The card's new status. | | `previous_status` | yes | string | one of `ACTIVE`, `SUSPENDED` | | | `action` | yes | string | one of `SUSPEND_CARD`, `TERMINATE_CARD`, `UNSUSPEND_CARD` | | | `reason_code` | yes | string | one of `RULE`, `PERSON`, `PERSON_CLEARING`, `AI_CLOSURE` | | | `rule_code` | | string | | The rule that acted, when a rule did. | | `alert_ref` | | string | | The alert that suspended the card, or whose clearing reinstated it. | | `card_event_ref` | | string | | The card event the rule acted on (the event_ref answered for it). | | `correlation_id` | | string | | | | `occurred_at` | yes | string | format date-time | | Example payload: ```json { "event_type": "card.suspended", "delivery_id": "00000000-0000-4000-8000-000000000061", "attempt": 1, "card_id": "00000000-0000-4000-8000-000000000051", "card_token": "tok_7Hf2kQ9", "status": "SUSPENDED", "previous_status": "ACTIVE", "action": "SUSPEND_CARD", "reason_code": "RULE", "rule_code": "RR-12", "card_event_ref": "CAE-2026-000311", "correlation_id": "6f1c2f9e-0000-4000-8000-000000000071", "occurred_at": "2026-10-29T12:41:02.530917+00:00" } ``` ### Check the signature of every delivery 1. Take the raw body exactly as received, before parsing it. 2. Compute the HMAC-SHA256, keyed with your webhook secret, of `.`. 3. Compare it, in constant time, with the hexadecimal value after `sha256=` in `X-Underlayer-Signature`. 4. Refuse a delivery whose signature does not match, or whose timestamp is more than five minutes from your clock (older, or later: clocks drift both ways). Each attempt is signed afresh, so a retry is never older than that. Nothing is sent unsigned: without a secret the delivery is skipped. Keep the secret in `UNDERLAYER_WEBHOOK_SECRET` (it is shown once, on the *API and webhooks* screen, and begins `whsec_`). Read the raw body before any JSON parser runs: a body parsed and serialised again no longer matches its signature. The two functions below do exactly this, with five minutes either way as the limit. Node.js: ```js import { createHmac, timingSafeEqual } from "node:crypto"; /** * True only for a delivery Underlayer signed with your webhook secret in the last five minutes. * rawBody: the body exactly as received (a Buffer), before any JSON parsing. * headers: the request headers with lower-case names (Node's req.headers). */ export function verifyUnderlayerWebhook(rawBody, headers, secret, nowSeconds = Math.floor(Date.now() / 1000)) { const timestamp = headers["x-underlayer-timestamp"]; const signature = headers["x-underlayer-signature"]; if (typeof timestamp !== "string" || !/^[0-9]{1,12}$/.test(timestamp)) return false; if (Math.abs(nowSeconds - Number(timestamp)) > 300) return false; if (typeof signature !== "string" || !/^sha256=[0-9a-f]{64}$/.test(signature)) return false; const expected = createHmac("sha256", Buffer.from(secret, "utf8")) .update(timestamp + ".", "utf8") .update(rawBody) .digest(); const given = Buffer.from(signature.slice("sha256=".length), "hex"); return given.length === expected.length && timingSafeEqual(given, expected); } ``` Python: ```python import hashlib import hmac import re import time def verify_underlayer_webhook(raw_body: bytes, headers, secret: str, now=None) -> bool: """True only for a delivery Underlayer signed with your webhook secret in the last five minutes. raw_body: the body exactly as received (bytes), before any JSON parsing. headers: a case-insensitive mapping of the request headers (Flask's request.headers, Django's request.headers). """ timestamp = headers.get("X-Underlayer-Timestamp") or "" signature = headers.get("X-Underlayer-Signature") or "" if not re.fullmatch(r"[0-9]{1,12}", timestamp): return False now = int(time.time()) if now is None else now if abs(now - int(timestamp)) > 300: return False if not re.fullmatch(r"sha256=[0-9a-f]{64}", signature): return False expected = hmac.new(secret.encode("utf-8"), timestamp.encode("ascii") + b"." + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature[len("sha256="):]) ``` Answer `401` to a delivery that fails the check and do nothing else with it. ### Answer it Answer any `2xx` within 10 seconds, then do your work. Otherwise (a redirect included) the delivery is retried after 1 minute, 5 minutes, 15 minutes, 1 hour, 4 hours, 12 hours and 24 hours, and marked failed after 8 attempts. A delivery can come twice or out of order: de-duplicate by `X-Underlayer-Idempotency-Key`, order by `occurred_at`, and when in doubt read the decision (`GET /v1/transactions/{id}/decision`). ### Your webhook address An `https` address of a public host name: no IP address, port, user name or fragment, and no internal or local name. A name that resolves to a private, loopback or other reserved address is not delivered to, and a redirect is not followed. ## 6. Sandbox check steps Run these against the **sandbox institution**, with its key, `TEST` data and references of the client's own (a test prefix of its system). Each step says what a correct integration sees. They create test data in the sandbox only; a platform administrator of Underlayer can empty a sandbox before a new round. **Only with `TEST`.** Refuse to run these steps unless `UNDERLAYER_DATA_CLASSIFICATION` is `TEST`, and send `TEST` on every write (the classification field of each `POST`; the two `GET`s carry none). The base address is the same for both institutions and no answer names the environment: what tells them apart is that a production institution refuses `TEST` data (`400`, `error_code` `CLASSIFICATION_NOT_ACCEPTED`). Step 2's example may be refused for its `EXAMPLE-` references before its classification is read; from step 3 on, on that answer stop and tell the developer that the key is a production key. A `TEST` record that is accepted proves the key belongs to a sandbox. **No test values for a held or rejected payment.** No amount, name or reference makes the sandbox hold, reject or freeze a payment on purpose: a payment is held when the institution's own rules or screening stop it. Test the branches for `HOLD`, `HUMAN_REVIEW`, `BLOCKED` with `REJECT` and `FREEZE`, `screening_timeout`, a declined card and the webhooks against stubbed answers taken from section 3, and leave a live hold to step 9. **What they need.** `UNDERLAYER_BASE_URL`, `UNDERLAYER_API_KEY` and `UNDERLAYER_DATA_CLASSIFICATION`. `UNDERLAYER_WEBHOOK_SECRET` is needed only for the live part of step 9; the other steps test the signature check with a secret made up for the test. **Who runs them.** Steps 1 to 8 send requests: the AI tool runs them and reports each answer. Steps 9 to 12 test the code; the part of step 9 marked **for the developer** needs a public address, a secret set on a screen and a person. **Your own values.** Where a step sends an example of section 3, replace every value that begins `EXAMPLE-` with one of your own (not only the references, which are refused: `account_number`, `merchant_id`, `device_id`, `session_id` too), give `account_number` the account of step 3, and send the time of the run instead of the example's event and payment times (a CDD row's dates, such as when the account was opened, may stay as they are). **Running them again.** Keep the customer and the account of step 3 for every run. Give the payment, the card, the card event and the customer events a new part in their references each run (for example the run's date and time, kept apart by a letter, as in `20261118T2046`: a `card_token` with 13 or more digits in a row can be refused as a card number): sent again with the same references, step 4 answers `duplicate: true`, step 7's card `changed: false` and step 8's event `duplicate: true`, which is right for a repeat but not what a first run expects. **Step 1. The service answers.** No key is needed: ```sh curl -sS "$UNDERLAYER_BASE_URL/v1/health" ``` Expect `200` and `{"status":"ok"}`. **Step 2. The key works, and an example creates nothing.** Save the first example request of 3.1 unchanged as `example-payment.json` and send it: ```sh curl -sS -i -X POST "$UNDERLAYER_BASE_URL/v1/transactions" -H "X-API-Key: $UNDERLAYER_API_KEY" -H "Content-Type: application/json" --data @example-payment.json ``` Expect `400` with `error_code` `EXAMPLE_ROW` (its words: `references beginning EXAMPLE- come from the documentation and are refused: send your own references`): nothing is stored. Match the code, not the words. A `401` means the key is not the one issued. A `403` says why in its `error_code`: `CLASSIFICATION_NOT_ALLOWED_FOR_KEY` (the key may not send `TEST` data), `API_KEY_ADDRESS_NOT_ALLOWED` (the key is limited to addresses, and this one is not among them) or `INSTITUTION_NOT_ACTIVE`. After a `401` or a `403`, stop and ask the developer: 20 failed authentications from one address within 10 minutes refuse that address for 10 minutes. **Step 3. A customer.** Send a CDD file (3.6's example with your own `customer_ref` and `account_number`, `classification: TEST`). Expect `200` with `inserted: 1` (`updated` or `unchanged` on a later run) and `rejected: 0`; read `errors` when it is not 0. **Step 4. A payment.** Send 3.1's example with your own `external_transaction_id` and the customer of step 3, `data_classification: TEST`. Expect `200` with `status: RELEASED`, or `202` with another status. Check that your code settles only `RELEASED`, acts on `rejection_action` for `BLOCKED` (final) and holds every other status. Then check on the *Customers* screen, or ask the developer to, that no provisional customer was opened: the answer does not say so. **Step 5. The same payment again.** Send exactly the same request. Expect `200`, `duplicate: true`, the same `decision_id` and no second payment. **Step 6. The decision look-up.** Ask for the payment of step 4 by your own reference, URL-encoded: ```sh curl -sS -i "$UNDERLAYER_BASE_URL/v1/transactions//decision" -H "X-API-Key: $UNDERLAYER_API_KEY" ``` Expect `200` with the payment's current `status`. A reference that is a UUID is read as Underlayer's own id, so when your references are UUIDs ask by the `decision_ref` or `transaction_id` of step 4's answer instead. **Step 7. Cards (if the client issues them).** Register a card (3.3's example with your own `card_token` and the customer of step 3): expect `201`, then `200` with `changed: false` when it is sent again. Send a card authorisation (3.4) with a new `Idempotency-Key`: expect `200` with `APPROVED` or `DECLINED`; the same key again answers `duplicate: true`; the same request without the header answers `400`. **Step 8. Customer events (if the client sends them).** Send a `LOGIN_SUCCESS` (3.5) with your own `external_event_id`: expect `202`; the same event again answers `200` with `duplicate: true`. Then send a second sign-in with its own `external_event_id` and `device_timezone: "GMT+3"`: expect `202` and a `warnings` entry whose `field` is `device_timezone`. A malformed session field is never refused. **Step 9. Webhooks.** Unit-test the signature check first, with a secret made up for the test: a body signed as section 5 says passes; the same body with one character changed, a signature under another secret and a timestamp ten minutes old all fail. The rest of this step is **for the developer**: they set the sandbox webhook address (a public HTTPS address) and secret on the *API and webhooks* screen; when a sandbox payment is held (a `202` answer whose status is neither `BLOCKED` nor `POST_EVENT`), a person of the client's team decides it on the screens, and they check that the endpoint receives the delivery, verifies it, answers `2xx` within 10 seconds and acts once on a repeat of the same `X-Underlayer-Idempotency-Key`. Report this part as left for the developer. **Step 10. Retries.** Unit-test the client with stubbed answers: a `429`, or a `503` with `Retry-After: 1`, is retried with the same body and the same `Idempotency-Key`, no sooner than `Retry-After`; a `400`, `401`, `403`, `404`, `409` or `413` is never retried unchanged. **Step 11. No unknown fields.** Compare the field names the code sends with the tables of section 3: a name that is not there is a bug (a payment would ignore it without a word). **Step 12. No secrets in the code or the logs.** Search the change for the key, the secret and the base address: they come from configuration only, and no log line prints them. Going live is the developer's decision, not the AI tool's: it is a change of configuration (the production institution's key and `UNDERLAYER_DATA_CLASSIFICATION=PRODUCTION`), never of code.