Recognize documents and selfies from an image array
POST /kyc/process
Description
The method identifies, selects, and recognizes documents and selfies from an array of images. It allows uploading multiple files, performing OCR, and saving the results into a session. A JWT token is required in the header or in the request body.
Request Format
- HTTP method:
POST - URL:
/kyc/process - Content-Type:
multipart/form-data - Authorization: required
Request Parameters
| Parameter | Type | Where passed | Required | Description |
|---|---|---|---|---|
| token | string | Header, form-data | ✅* | Permanent user token. If a temporary token is not provided in the «token» header, then this parameter is required in the body |
| images | array | form-data | ✅ | Array of images (files) |
| sessionId | string | form-data | ❌ | Binding to an existing session. A new session will be created if not provided |
| schemaId | string | form-data | ❌ | Identifier of the KYC process schema |
| captcha | string | form-data | ❌ | Captcha, if required |
| mode | string | form-data | ❌ | Execution mode: ‘async’ or ‘sync’ (default ‘sync’) |
| clientKey | string | form-data | ❌ | Key for locating the session |
| ocr | boolean | form-data | ❌ | Perform OCR on documents (default true) |
*One of the token passing options is required.*
Request Example (cURL)
curl -X POST "https://api.enface.ai/kyc/process" -H "Authorization: Bearer jwt.temporary.token" -F "images=@/path/to/passport.jpg" -F "images=@/path/to/selfie.jpg" -F "sessionId=00000000-0000-0000-0000-000000000000" -F "schemaId=schema-001" -F "ocr=true" -F "mode=sync" Response Examples
Success (200 OK)
{
"sessionId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000",
"status": "success",
"spent": 136.945,
"results": [
{
"spent": 8.779,
"status": "success",
"type": "document",
"docName": "UK - Passport (2006)",
"image": "url",
"imageFull": "url",
"checks": [
{
"caption": "fraud",
"items": [
{
"caption": "isEdited",
"status": "success"
}
]
}
],
"ocr": {
"fields": [
{
"conf": "high",
"title": "Surname",
"value": "DOE"
}
],
"status": "success"
},
"errors": [
"[document] text fields not visible"
]
}
],
"createdAt": "2025-05-21T08:15:46.972Z",
"isClientNew": false
} Success (selfie & doc):
{
"sessionId": "10000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000",
"status": "success",
"spent": 36.11,
"results": [
{
"status": "success",
"type": "passport",
"spent": 4.453,
"errors": [],
"docName": "UK - Passport (2006)",
"checks": [
{
"caption": "fraud",
"items": [
{
"status": "success",
"caption": "isEdited"
},
{
"status": "success",
"caption": "isDisplay"
},
{
"status": "success",
"caption": "isPrinted"
}
]
}
],
"ocr": {
"status": "success",
"fields": [
{
"title": "Surname",
"value": "DOE",
"conf": "high"
}
]
},
"image": "url_to_passport_image",
"imageFull": "url_to_full_passport_image"
},
{
"status": "success",
"type": "selfie",
"spent": 4.664,
"errors": [],
"docName": "UK - Passport (2006)",
"checks": [
{
"caption": "fraud",
"items": [
{
"status": "success",
"caption": "isEdited"
}
]
}
],
"faceSelfie": "url_to_selfie_image",
"faceDoc": "url_to_face_document_image",
"withDoc": "passport",
"image": "url_to_selfie_image",
"imageFull": "url_to_full_selfie_image"
},
{
"status": "success",
"type": "faces",
"spent": 0.004,
"errors": [],
"checks": [
{
"caption": "Face matching",
"items": [
{
"status": "success",
"caption": "selfie with passport & passport",
"value": "92%",
"images": [
"url_to_selfie_with_passport_image",
"url_to_passport_image"
]
},
{
"status": "success",
"caption": "selfie & passport",
"value": "83%",
"images": [
"url_to_selfie_image",
"url_to_passport_image_for_selfie_comparison"
]
}
]
}
]
}
],
"createdAt": "2025-05-21T08:15:46.975Z",
"isClientNew": false
} Error (400 Invalid schema / No image attached)
{
"message": "invalid schema",
"status": "error"
} Error (failed)
{
"sessionId": "00000000-0000-0000-0000-000000000000",
"clientId": "null",
"status": "failed",
"spent": 261.569,
"results": [
{
"status": "failed",
"type": "document",
"spent": 0,
"errors": [
"[system] exception"
],
"ocr": {
"status": "idle",
"fields": []
}
}
],
"createdAt": "2025-05-21T08:15:46.980Z",
"isClientNew": true
} Change KYC Session Status
POST /kyc/session/status/change
Description
The method changes the status of the current KYC session. A JWT token is required in the header.
Request Format
- HTTP method:
POST - URL:
/kyc/session/status/change - Content-Type:
application/json - Authorization: required
Request Parameters
| Parameter | Type | Location | Required | Description |
|---|---|---|---|---|
| token | string | Header | ✅ | User JWT token |
Request Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| token | string | ✅ | User JWT token |
| sessionId | string | ✅ | KYC session identifier |
| status | string | ✅ | New session status |
Request Example (cURL)
curl -X POST "https://api.enface.ai/kyc/session/status/change" -H "Content-Type: application/json" -H "Authorization: Bearer jwt.temporary.token" -d '{
"token": "jwt.temporary.token",
"sessionId": "00000000-0000-0000-0000-000000000000",
"status": "success"
}' Response Examples
Success (200 OK)
{
"status": "ok",
"message": "Session status updated with true of false result"
} Error (400 Bad Request)
{
"message": "invalid schema",
"status": "error"
}