Verify Identity

POST/v1/verify

Upload a document image and a selfie for instant KYC verification. The API parses the document, compares faces between the document photo and selfie, runs passive liveness detection, and returns a verification result.

Requires: Starter plan or higher with kyc_verification feature enabled.

Request

Send as multipart/form-data.

ParameterTypeRequiredDescription
documentfileYesIdentity document image. JPEG, PNG, or WebP. Max 10 MB.
selfiefileYesSelfie photo of the person. JPEG, PNG, or WebP. Max 10 MB.
document_typestringNoDocument category. Auto-detected if omitted.
document_brandstringNoRegional variant. Auto-detected if omitted.
scam_checkbooleanNoRun scam database check on the extracted identity. Defaults to false.

Examples

curl -X POST https://api.dokai.dev/v1/verify \
  -H "Authorization: Bearer dk_live_your_api_key" \
  -F "document=@mykad.jpg" \
  -F "selfie=@selfie.jpg" \
  -F "document_type=identity_card" \
  -F "document_brand=mykad"

Response

Returns 200 OK with the verification result.

200 OK
{
  "id": "ver_abc123",
  "status": "verified",
  "type": "api",
  "document_type": "identity_card",
  "document_brand": "mykad",
  "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"
  },
  "metadata": {
    "processing_time_ms": 2340,
    "document_parse_id": "parse_xyz789"
  },
  "created_at": "2026-03-11T10:30:00Z",
  "expires_at": "2026-03-12T10:30:00Z"
}

Response fields

FieldTypeDescription
idstringUnique verification session identifier
statusstringverified, unverified, or failed
face_matchobjectFace comparison result: matched (bool), score (0–1), threshold
livenessobjectPassive liveness result: passed (bool), score (0–1), checks (individual scores)
identityobject | nullExtracted identity: name, id_number, date_of_birth, nationality
metadataobjectProcessing details (time, model, linked document parse ID)
created_atstringISO 8601 timestamp
expires_atstringWhen the result will be purged

Liveness checks

The liveness.checks object contains individual scores for each anti-spoofing heuristic:

CheckDescription
textureSkin texture analysis (LBP). Real skin has rich texture; printed photos are uniform.
frequencyFrequency domain analysis (FFT). Detects moiré patterns from printed or screen-displayed photos.
reflectionSpecular reflection detection. Screens produce characteristic light reflections.
sharpnessDepth-of-field analysis (Laplacian). Natural photos have varying sharpness; reprints are uniformly blurred.
colorColor histogram analysis. Real skin has characteristic HSV distribution.

Retrieve a verification

GET/v1/verify/:id

Fetch a previously created verification result by its ID.

cURL
curl https://api.dokai.dev/v1/verify/ver_abc123 \
  -H "Authorization: Bearer dk_live_your_api_key"