Documentation

Documentation/API reference/Endpoints/

POST /v1/cdd-ingest

Send customer due diligence (CDD / KYC) records

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

A JSON object, at most 2 000 000 characters and 50 000 rows.

Example: One business customer with its owners and account (example references, refused as EXAMPLE_ROW)

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

Request sample

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

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

The import ran. Check rejected and errors; an import whose every row was refused still answers 200.

400ErrorBody

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
  • classification % is accepted only by a sandbox institution: a production institution takes PRODUCTION data only

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.

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

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

503ErrorBody

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.

Examples of 200

Example: sampleRowRefused

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

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: noSource

{
  "error": "source_system is required",
  "error_code": "MISSING_SOURCE_SYSTEM"
}

Example: noRows

{
  "error": "rows must be a non-empty array",
  "error_code": "MISSING_ROWS"
}

Example: tooManyRows

{
  "error": "rows may not exceed 50000 per request",
  "error_code": "TOO_MANY_ROWS"
}

Example: classification SCALE_TEST, which the key allows

{
  "error": "classification must be PRODUCTION, TEST or DEMO",
  "error_code": "INVALID_DATA_CLASSIFICATION"
}

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 customer data",
  "error_code": "CLASSIFICATION_NOT_ALLOWED_FOR_KEY"
}

Examples of 413

Example: tooLarge

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

Examples of 429

Example: failedAuthentications

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

Example: perKey

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

Example: perAddress

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

Examples of 500

Example: start

{
  "error": "Could not start the CDD import",
  "error_code": "IMPORT_START_FAILED",
  "code": "42501"
}

Example: failed

{
  "error": "The CDD import failed",
  "error_code": "IMPORT_FAILED",
  "code": "57014"
}

Example: finish

{
  "error": "Could not finish the CDD import",
  "error_code": "IMPORT_FINISH_FAILED",
  "code": null
}

Examples of 503

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