Hosted Verification

Create a hosted verification session that generates a URL for your end-users. They complete identity verification on a Dokai-hosted page (document upload, selfie, liveness check) and you receive the result via webhook or polling.

Requires: Starter plan or higher with kyc_verification feature enabled.

How it works

1

Create a session via POST /v1/verify/session. You receive a unique URL and session ID.

2

Redirect your end-user to the URL. They upload their identity document and take a selfie.

3

Dokai processes the verification (face match + liveness detection) automatically.

4

Receive the result via webhook (verification.completed / verification.failed) or poll the session status.

Create a session

POST/v1/verify/session

Send as application/json.

ParameterTypeRequiredDescription
webhook_urlstringNoHTTPS URL to receive a POST callback when verification completes. Domain must be whitelisted in Dashboard > Webhooks.
document_typestringNoExpected document type. Auto-detected if omitted.
document_brandstringNoExpected regional variant. Auto-detected if omitted.

Examples

curl -X POST https://api.dokai.dev/v1/verify/session \
  -H "Authorization: Bearer dk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook_url": "https://hooks.example.com/dokai",
    "document_type": "identity_card"
  }'

Create session response

Returns 201 Created with the session details and hosted URL.

201 Created
{
  "id": "ver_abc123",
  "url": "https://app.dokai.dev/verify/eyJhbGci...",
  "status": "pending",
  "expires_at": "2026-03-12T10:30:00Z"
}
FieldTypeDescription
idstringUnique session identifier. Use this to poll for status.
urlstringThe hosted verification URL. Redirect your end-user here.
statusstringAlways pending on creation.
expires_atstringISO 8601 timestamp. Session expires after 24 hours.

Check session status

GET/v1/verify/session/:id

Poll this endpoint to check the status of a hosted verification session. Once the status is verified, unverified, or failed, the full result is available.

cURL
curl https://api.dokai.dev/v1/verify/session/ver_abc123 \
  -H "Authorization: Bearer dk_live_your_api_key"
200 OK — completed
{
  "id": "ver_abc123",
  "status": "verified",
  "type": "hosted",
  "face_match": {
    "matched": true,
    "score": 0.92,
    "threshold": 0.363
  },
  "liveness": {
    "passed": true,
    "score": 0.78,
    "checks": {
      "texture": 0.85,
      "frequency": 0.80,
      "reflection": 0.72,
      "sharpness": 0.92,
      "color": 0.75
    }
  },
  "identity": {
    "name": "AHMAD BIN IBRAHIM",
    "id_number": "901215-08-5523"
  },
  "created_at": "2026-03-11T10:30:00Z",
  "expires_at": "2026-03-12T10:30:00Z"
}

Session statuses

StatusDescription
pendingSession created, waiting for user to start.
document_uploadedUser uploaded their document, selfie pending.
processingBoth images submitted, verification in progress.
verifiedIdentity verified. Face matched and liveness passed.
unverifiedVerification completed but identity could not be confirmed (face mismatch or liveness failed).
failedAn error occurred during verification (e.g. no face detected).
expiredSession expired before completion (24-hour TTL).

Webhook events

If you provided a webhook_url when creating the session, Dokai will POST the result to your endpoint when verification completes.

EventDescription
verification.completedVerification finished with status verified or unverified.
verification.failedVerification encountered an error (no face detected, processing failure).

Webhook payloads are signed with X-Dokai-Signature. See the Webhooks guide for signature verification details.