AI integration guide

Give an AI coding assistant (Cursor or similar) enough current detail about Nexiel's APIs to write correct integration code on the first try, instead of guessing an endpoint shape from its training data. The field names, status values and error format below match the Nexiel Verify OpenAPI document.

A ready-to-use prompt

Copy the block below into your AI coding assistant to add Nexiel Age verification to a signup flow. It names the request and response fields of POST /v1/verify/sessions and GET /v1/verify/sessions/{sessionId} (see the Verify API reference), the host, the token exchange and the test wallet, so the assistant has no reason to invent any of them.

Prompt: add Nexiel Age verification to a signup flow
I need to add Nexiel Age verification (an EUDI wallet over-18 check) to my
app's signup flow. Nexiel Age is Nexiel Verify's POST /v1/verify/sessions
endpoint, called with "checkType": "age-verification".

Platform facts (from https://nexiel.eu/llms.txt):
- Base URL: https://compliance.nexiel.io. Do not use any other host.
- Keys: a Verify test key (client id starts nx-test-) runs in test mode and
  is free from https://dashboard.nexiel.io/test-keys. A live key (nx-live-)
  needs an approved business verification. The code is the same for both.
- Authentication: exchange the key for an access token with the OAuth 2.0
  client credentials grant at
  https://auth.nexiel.io/realms/nexiel/protocol/openid-connect/token
  (form fields grant_type=client_credentials, client_id, client_secret), and
  send it as "Authorization: Bearer <access_token>". Tokens last 300 seconds:
  cache the token, and request a new one when it expires or a call returns 401.
- The SDKs are coming to npm and PyPI. Call the REST API directly with fetch
  for now.

Environment variables (server-side only):
- NEXIEL_CLIENT_ID and NEXIEL_CLIENT_SECRET: the Verify key.

Implement:

1. A server-side helper that returns a valid access token, exchanging the
   key when there is no cached token or the cached one is within 30 seconds
   of expiry (the token response carries expires_in).

2. A server-side route "POST /signup/age-check/start" that:
   - Calls "POST https://compliance.nexiel.io/v1/verify/sessions" with JSON body
     { "clientId": "<our own reference for this integration>",
       "checkType": "age-verification" },
     header "Authorization: Bearer <access_token>", and header
     "Idempotency-Key: <a fresh UUID per attempt>". Reuse the same key when
     retrying the same attempt after a network error.
   - The response includes sessionId, livemode, authorizationRequestUri and
     expiresAt. Persist only sessionId and expiresAt against the in-progress
     signup record. Never store authorizationRequestUri beyond this response.
   - Return { sessionId, authorizationRequestUri, expiresAt } to the client.
     authorizationRequestUri is an "openid4vp://..." link: render it as a QR
     code on desktop and as a tappable link on mobile, so the user's EUDI
     wallet opens it. Use the project's QR library, or add a small one.

3. A poller that, once the QR code or link is shown, polls
   "GET https://compliance.nexiel.io/v1/verify/sessions/{sessionId}" through our
   own backend (never from the browser, so the key and token never reach the
   client) every few seconds while status is "pending" or "awaiting_redirect":
   - status "completed" and decision.booleanProofs.ageOver18 === true: let
     signup proceed.
   - status "completed" and decision.booleanProofs.ageOver18 === false: block
     signup with a clear "you must be 18 or older" message. Do not record
     anything about this attempt beyond what we already log for every signup.
   - status "expired" or "failed": show a retry action that starts a new
     session (step 2 again). A session in either state cannot be resumed.
   - Stop polling once expiresAt has passed, even without a final status.

4. Data handling, do not skip this: persist only sessionId, the boolean
   result (ageOver18) and a timestamp against the signup record. An
   age-verification check never returns a birthdate or name, so there is
   nothing else to store.

5. Error handling: a non-2xx response is JSON { "error": "<code>",
   "message": "<text>" }, with "retryAfterSeconds" on 429 responses. Branch on
   the error code, never on the message. Handle at least:
   - 401: request a new access token once, then retry the call.
   - 429: wait retryAfterSeconds (also in the Retry-After header) before
     retrying.
   - 400: our own request was malformed. Log it as a bug, never show it to
     the user as "verification failed".
   - 409 idempotency_request_in_progress: retry the same request, with the
     same Idempotency-Key, after Retry-After.
   - Network failures: retry with backoff and the same Idempotency-Key. Never
     treat a network error as a failed age check.

6. Testing: with a test key, collect a test PID at https://sandbox.nexiel.io
   (an adult and a minor are both available), then open
   https://sandbox.nexiel.io/present and paste the session's
   authorizationRequestUri to answer it.

Write this using [our actual stack, such as Next.js route handlers or
Express. Ask me which one if you are not sure, rather than assuming].

Why these details matter

  • sessionId, authorizationRequestUri, expiresAt, decision.booleanProofs.ageOver18, and the pending, awaiting_redirect, completed, failed and expired status values are the exact names in the Nexiel Verify OpenAPI document.
  • The host, the token endpoint and the 300-second token lifetime are stated outright. An assistant left to guess tends to invent a per-product host or treat the client secret as the bearer token. See Authentication.
  • The error envelope (error, message, and retryAfterSeconds on 429) is the one every Nexiel API returns. See Errors and Idempotency.
  • The “persist only the boolean” instruction matches what the API returns for an age-verification check: no birthdate or name field exists in that response.

Adapting this to a different flow

The same approach, field names from the reference docs, the platform facts and an explicit list of persisted fields, works for any other Nexiel integration:

  • Sanctions and PEP screening: take the request and response shape from the Screen API quickstart and reference, use a Screen key, and keep the POSSIBLE_MATCH human-review requirement intact rather than letting an assistant “simplify” it into an auto-clear.
  • AML identity verification: the same POST /v1/verify/sessions route, with checkType: "aml-identity", documented in the Verify API overview.
  • Agentic integrations that call Nexiel at runtime through MCP are covered by the Agent Toolkit docs. This page is for using a coding assistant to write ordinary integration code ahead of time.

Machine-readable steering: /llms.txt

For an AI assistant that reads a site's llms.txt automatically, Nexiel publishes one at nexiel.eu/llms.txt. It covers the same ground: the products, the base URL, test and live keys, the token exchange, the idempotency and error contracts, webhook signatures, the human-review rule for POSSIBLE_MATCH, the OpenAPI documents and a link to every docs page.