Verify Identity
POST
/v1/verifyUpload 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
document | file | Yes | Identity document image. JPEG, PNG, or WebP. Max 10 MB. |
selfie | file | Yes | Selfie photo of the person. JPEG, PNG, or WebP. Max 10 MB. |
document_type | string | No | Document category. Auto-detected if omitted. |
document_brand | string | No | Regional variant. Auto-detected if omitted. |
scam_check | boolean | No | Run 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
| Field | Type | Description |
|---|---|---|
id | string | Unique verification session identifier |
status | string | verified, unverified, or failed |
face_match | object | Face comparison result: matched (bool), score (0–1), threshold |
liveness | object | Passive liveness result: passed (bool), score (0–1), checks (individual scores) |
identity | object | null | Extracted identity: name, id_number, date_of_birth, nationality |
metadata | object | Processing details (time, model, linked document parse ID) |
created_at | string | ISO 8601 timestamp |
expires_at | string | When the result will be purged |
Liveness checks
The liveness.checks object contains individual scores for each anti-spoofing heuristic:
| Check | Description |
|---|---|
texture | Skin texture analysis (LBP). Real skin has rich texture; printed photos are uniform. |
frequency | Frequency domain analysis (FFT). Detects moiré patterns from printed or screen-displayed photos. |
reflection | Specular reflection detection. Screens produce characteristic light reflections. |
sharpness | Depth-of-field analysis (Laplacian). Natural photos have varying sharpness; reprints are uniformly blurred. |
color | Color histogram analysis. Real skin has characteristic HSV distribution. |
Retrieve a verification
GET
/v1/verify/:idFetch 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"