Documentation

Documentation/API reference/Endpoints/

POST /v1/customer-events

Record something the customer did that is not a payment

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

A JSON object, at most 64 000 characters.

Example: A sign-in from the customer's phone (example references are refused)

{
  "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"
}

Example: A card payment the customer approved in the app (3-D Secure challenge)

{
  "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"
}

Request sample

curl -X POST "$UNDERLAYER_BASE_URL/v1/customer-events" \
  -H "X-API-Key: $UNDERLAYER_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'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"
}
JSON
import os
import requests

response = requests.post(
    os.environ["UNDERLAYER_BASE_URL"] + "/v1/customer-events",
    headers={"X-API-Key": os.environ["UNDERLAYER_API_KEY"]},
    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"
    },
)
print(response.status_code, response.json())
const response = await fetch(process.env.UNDERLAYER_BASE_URL + "/v1/customer-events", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.UNDERLAYER_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "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"
  }),
});
console.log(response.status, await response.json());

Written from the example on this page. UNDERLAYER_BASE_URL is https://api.underlayer.eu; UNDERLAYER_API_KEY is yours, given at onboarding.

Responses

StatusBodyDescription
200CustomerEventResult

A repeat of a recorded event (duplicate: true): the first answer's references and warnings; nothing more is stored.

202CustomerEventResult

The event was recorded. Nothing is decided; warnings is present only when a session, device or card field was not used.

400ErrorBody

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
  • institution is not active
  • external_event_id is required
  • external_event_id must be at most 128 characters
  • source_system must be at most 64 characters
  • customer_ref is required
  • references beginning EXAMPLE- come from the documentation and are refused: send your own references
  • event_type is required
  • event_type must be one of %
  • data_classification must be PRODUCTION, TEST, SCALE_TEST or DEMO
  • 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
  • event_time cannot be later than the time the event is sent
  • event_time is more than 400 days in the past: older events are not accepted
  • % applies only to CARD_PAYMENT_CONFIRMATION
  • card_token applies only to CARD_ADDED and CARD_PAYMENT_CONFIRMATION
  • % applies only to PAYEE_ADDED and PAYEE_CHANGED
  • changed_by applies only to a change (%)
  • changed_by must be CUSTOMER, STAFF or SYSTEM
  • outcome is required for CARD_PAYMENT_CONFIRMATION: APPROVED or DECLINED
  • outcome must be APPROVED or DECLINED
  • confirmation_method must be THREE_DS_CHALLENGE, IN_APP_APPROVAL or OTHER
  • % must be a two-letter ISO 3166-1 alpha-2 country code such as LT
  • payee_name must be a text of at most 200 characters
  • % 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
  • % looks like an IBAN but its check digits are wrong
  • payee_type must be INDIVIDUAL, LEGAL_ENTITY, FINANCIAL_INSTITUTION, GOVERNMENT, MERCHANT or OTHER
  • correlation_id must be a text of at most 128 characters
  • data_classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only
  • unknown customer_ref %

Correct the request; do not send it again unchanged.

401ErrorBody

The key is missing, malformed (not <key_id>.<secret>), unknown, revoked or wrong. Check the key; do not retry the same request.

403ErrorBody

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.

409ErrorBody

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).

413ErrorBody

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.

429ErrorBody

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.

500ErrorBody

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.

503ErrorBody

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.

Examples of 202

Example: recorded

{
  "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"
}

Examples of 400

Example: notJson

{
  "error": "Body must be valid JSON",
  "error_code": "BODY_NOT_JSON"
}

Example: notObject

{
  "error": "Body must be a JSON object",
  "error_code": "BODY_NOT_OBJECT"
}

Example: unknownCustomer

{
  "error": "unknown customer_ref C-0042",
  "error_code": "UNKNOWN_CUSTOMER"
}

Example: An EXAMPLE- reference, as in the request examples above

{
  "error": "references beginning EXAMPLE- come from the documentation and are refused: send your own references",
  "error_code": "EXAMPLE_ROW"
}

Examples of 401

Example: missing

{
  "error": "Missing or malformed API key",
  "error_code": "API_KEY_MISSING"
}

Example: invalid

{
  "error": "Invalid or revoked API key",
  "error_code": "API_KEY_INVALID"
}

Examples of 403

Example: addressNotAllowed

{
  "error": "API key not allowed from this address",
  "error_code": "API_KEY_ADDRESS_NOT_ALLOWED"
}

Example: institutionInactive

{
  "error": "Institution is not active",
  "error_code": "INSTITUTION_NOT_ACTIVE"
}

Example: classification

{
  "error": "This API key may not submit TEST events",
  "error_code": "CLASSIFICATION_NOT_ALLOWED_FOR_KEY"
}

Examples of 409

Example: differentBody

{
  "error": "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",
  "error_code": "IDEMPOTENCY_CONFLICT"
}

Examples of 413

Example: tooLarge

{
  "error": "Request body too large",
  "error_code": "BODY_TOO_LARGE"
}

Examples of 429

Example: failedAuthentications

{
  "error": "Too many failed authentication attempts from this address; retry after the number of seconds in Retry-After",
  "error_code": "TOO_MANY_FAILED_AUTHENTICATIONS"
}

Example: perKey

{
  "error": "Too many requests for this API key; retry after the number of seconds in Retry-After",
  "error_code": "RATE_LIMITED_KEY"
}

Example: perAddress

{
  "error": "Too many requests from this address; retry after the number of seconds in Retry-After",
  "error_code": "RATE_LIMITED_ADDRESS"
}

Examples of 500

Example: engine

{
  "error": "Customer event engine error",
  "error_code": "ENGINE_ERROR",
  "code": "P0001"
}

Examples of 503

Example: busy

{
  "error": "Service busy",
  "error_code": "SERVICE_BUSY"
}

Example: keyCheck

{
  "error": "Service unavailable",
  "error_code": "SERVICE_UNAVAILABLE"
}

Example: settings

{
  "error": "Service temporarily unavailable",
  "error_code": "SERVICE_SETTINGS_UNUSABLE"
}

© 2026 Underlayer, Lithuania. info@underlayer.eu System status Privacy notice