Verification sessions

A session is one presentation request to one wallet. You create it with your API key, the wallet answers it directly to Nexiel, and your backend reads the decision.

The lifecycle

  1. Your backend calls POST /v1/verify/sessions with a checkType and, optionally, a flow.
  2. You hand the wallet the request: a QR code or link (authorizationRequestUri), or the browser's Digital Credentials API (dcApi.requests).
  3. The wallet fetches and checks the signed request, asks the user, and posts an encrypted answer to Nexiel.
  4. Nexiel verifies the answer and records a decision. You read it with GET /v1/verify/sessions/{sessionId} or receive verify.session.completed by webhook.

Signed requests and encrypted responses

Every session request is signed under your own relying-party access certificate. The wallet fetches it by reference from requestUri as a signed request object (RFC 9101), and identifies you by the x509_hash: client identifier of that certificate (clientId in the response), with your registration certificate attached. The wallet encrypts its answer (direct_post.jwt, ECDH-ES with A128GCM or A256GCM) to a key generated for that one request, so disclosed claims are never readable in transit. A plaintext answer is refused.

Requests are built to the OpenID4VC High Assurance Interoperability Profile (HAIP) 1.0, section 5.1 for redirects and section 5.2 for the Digital Credentials API. Self-certification against the OpenID Foundation's HAIP verifier tests is in progress for section 5.1. The OpenID Foundation has no verifier test plan for the Digital Credentials API yet. Live sessions require a real access certificate and registration: see relying party registration.

Test-mode sessions are signed with Nexiel TEST certificates, created for you on your first session and also manageable through /v1/verify/rp-identity or the dashboard. Live mode refuses every TEST and self-signed certificate. For live, Nexiel generates your key and gives you the certificate signing request to send to an access certificate authority authorised by your Member State.

Cross-device: a QR code

The default flow ("flow": "cross_device"). Render authorizationRequestUri as a QR code on a computer, and the user scans it with the wallet on their phone. After answering, the wallet receives only a redirect_uri saying where to send the user next, never the outcome:

POST /v1/verify/sessions/{sessionId}/responses (the wallet's reply)
{
  "redirect_uri": "https://compliance.nexiel.io/v1/verify/wallet-return"
}

The hosted verification page

Instead of rendering the QR code yourself, send the user to hostedUrl, returned for every cross_device session. The page, in your branding and on your custom domain when you have one, says who is asking and for what, shows the QR code and wallet link, and follows the session until it ends. The session's read token travels in the URL fragment, which never reaches a server, so give the URL only to the user being verified.

To bring the user back, add successUrl and cancelUrl when you create the session: https URLs of your own, checked like redirectUri. The page sends the user to successUrl when the session completes, and to cancelUrl when it fails, expires or is cancelled. In live mode it does so by itself. In test mode it shows a button naming the destination instead, so a test key cannot turn the page into an unattended redirect. A test-mode page also offers to open the session in the sandbox wallet.

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions   -H "Authorization: Bearer $NEXIEL_ACCESS_TOKEN"   -H "Idempotency-Key: $(uuidgen)"   -H "Content-Type: application/json"   -d '{"clientId": "my-shop", "checkType": "age-verification", "successUrl": "https://shop.example.eu/verified", "cancelUrl": "https://shop.example.eu/checkout", "metadata": {"orderId": "ord_8213"}}'

The page returns the user without the outcome. Read the decision from your backend before you act on it.

Same-device: a redirect

On a phone, the wallet runs on the same device as your page, so there is no QR code to scan. Create the session with "flow": "same_device" and an https redirectUri (without a fragment), then open authorizationRequestUri directly:

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions \
  -H "Authorization: Bearer $NEXIEL_ACCESS_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"clientId": "my-shop", "checkType": "age-verification", "flow": "same_device", "redirectUri": "https://shop.example.eu/verified"}'

Once the wallet has answered, it returns the user to your redirectUri with a one-time #response_code=... in the URL fragment. Until your page or backend presents that code, the session reports awaiting_redirect and releases no decision. This binding stops a wallet response from being attached to a session someone else started. Send the code from that page with the session's X-Nexiel-Verify-Session-Token, or from your backend with your access token:

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions/{sessionId}/redirect-return \
  -H "X-Nexiel-Verify-Session-Token: <sessionToken>" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"responseCode": "<response_code from the URL fragment>"}'
POST /v1/verify/sessions/{sessionId}/redirect-return
{
  "sessionId": "f1be0a07-e161-4827-a4c3-3337952859ff",
  "status": "completed"
}

A wrong code returns 403 and does not use up the session. If no code arrives within 10 minutes of the wallet's answer, the session fails. Treat the response code as a secret: remove it from the address bar once read, and never log it.

Browser wallets: the Digital Credentials API

Browsers that support the W3C Digital Credentials API reach the user's wallet themselves, on the same device or on a nearby phone, with no QR code and no redirect. This is the recommended way to verify on a computer. Create the session with "flow": "dc_api" and the origin of the page that will call the browser:

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions \
  -H "Authorization: Bearer $NEXIEL_ACCESS_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"clientId": "my-shop", "checkType": "age-verification", "flow": "dc_api", "origin": "https://shop.example.eu"}'

The response carries dcApi.requests instead of a wallet link. Pass them to the browser from a click handler on a page at that origin, then send the credential it returns, unchanged, to Nexiel with the session token:

const credential = await navigator.credentials.get({ digital: { requests: session.dcApi.requests } });
await fetch(`https://compliance.nexiel.io/v1/verify/sessions/${session.sessionId}/dc-api-response`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Nexiel-Verify-Session-Token': session.sessionToken,
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({ protocol: credential.protocol, data: credential.data }),
});

The request is signed like a redirect request and names your page in expected_origins, so a wallet refuses it anywhere else. The answer is encrypted (dc_api.jwt) to a key made for that one request and bound to your page's origin, so a response captured on another site is rejected. Each answer can be used once. For checks an ISO mdoc can answer, sessions also offer the ISO/IEC 18013-7 Annex C protocol (org-iso-mdoc) whenever your service holds the CWT form of its registration certificate (rc-wrp+cwt), which the request carries as requestInfo.euWrprc. Import it beside the JWT form. TEST certificates come in both forms.

Each origin must first be on your service's list, in the dashboard or with PUT /v1/verify/rp-identity/services/{serviceId}/dc-api-origins. Transaction-bound checks (strong customer authentication and signing approval) use the redirect flows only. In test mode, the sandbox wallet can stand in for the browser's wallet prompt. The drop-in Verify widget, coming to npm, detects the API and falls back to a QR code for wallets the browser cannot reach.

Metadata

metadata holds your own reference for the session, such as an order or customer id: up to 20 keys, each key up to 40 characters and each value a string of up to 500. It is returned when you create, read or list the session, sent in every verify.session.* webhook, included in your data export and deleted with the session. It is never returned to a request made with the session token. Do not put personal data in it, such as names, dates of birth, email addresses or document numbers: use your own opaque identifiers.

Session statuses

  • pending: waiting for the wallet. decision is null.
  • awaiting_redirect: a same-device wallet answered, and the decision is held until your page returns the response code.
  • completed: the decision is recorded. Sends verify.session.completed.
  • failed: the wallet's answer was rejected, with a stable reason in verify.session.failed.
  • expired: no completed answer within 10 minutes of creation. Sends verify.session.expired.

A wallet that refuses the request (the user chose not to share) fails the session at once with reason wallet_declined, so your page need not wait for it to expire.

Cancelling a session

When the user gives up on your own page, end the session with its session token. It fails at once with reason user_cancelled, sends verify.session.failed, and no wallet answer can complete it afterwards. The hosted page's Cancel button does the same.

curl -s -X POST https://compliance.nexiel.io/v1/verify/sessions/{sessionId}/cancel   -H "X-Nexiel-Verify-Session-Token: <sessionToken>"   -H "Idempotency-Key: $(uuidgen)"
POST /v1/verify/sessions/{sessionId}/cancel
{
  "status": "failed",
  "cancelUrl": "https://shop.example.eu/checkout",
  "autoReturn": true
}

Calling it again reports the session as it is, and a session that already failed or expired is reported unchanged. A completed session, or one waiting for its same-device redirect, returns 409. A wrong token returns 404, as for an unknown session. cancelUrl and autoReturn appear when the session has return URLs.

Session tokens

sessionToken is returned once, when the session is created. Your frontend can use it in the X-Nexiel-Verify-Session-Token header to read that one session's status, finish a same-device redirect, submit a Digital Credentials API answer, or cancel the session, without your access token. It is safe in a browser: it proves nothing about your identity and reads no other session. A read with the token returns the session's progress only (status and finished), never its decision: the person being verified must not see their own screening result. Read the decision from your backend with your access token, or from the verify.session.completed webhook. Creating sessions always needs your access token, server-side.

Reading results

GET /v1/verify/sessions/{sessionId} returns the session with its decision once completed. GET /v1/verify/sessions lists your sessions in the key's mode, newest first, filtered by status, checkType and creation time. It answers with the list envelope: data, hasMore and nextCursor. The sessions field it also returns is a deprecated copy of data.

Reading a session never hands over an evidence pack, so you can poll freely. When decision.evidencePackStatus reads available, claim the pack once with POST /v1/verify/sessions/{sessionId}/evidence-pack/claim and an Idempotency-Key, or choose push delivery.