Face · Standard API · eKYC Core
Verify face video liveness
Verifies face liveness in uploaded videos and returns an is_live verdict with a liveness score, overall and per video.
Request
| Name | Type | Required | Description |
|---|---|---|---|
videos | []video | Required | array of video recording when liveness on SDK. Default 1 |
- If you use
id(resultidis returned from Upload File API), omit parameterframes,metadata. If you useframes,metadata, omit parameterid.
{
"videos": [
{
"id": string,
"metadata": string_json,
"frames": [
{
"base64": string,
"label": string,
"index": int,
"metadata": string_json,
},
{
"base64": string,
"label": string,
"index": int,
"metadata": string_json,
},
// other frames
],
},
{
"id": string,
"metadata": string_json,
"frames": [
{
"base64": string,
"label": string,
"index": int,
"metadata": string_json,
},
{
"base64": string,
"label": string,
"index": int,
"metadata": string_json,
},
// other frames
],
}
]
}
Which each video's parameters contains:
| key | type | required | description |
|---|---|---|---|
id | string | Optional | ID of video is returned from API Upload |
metadata | string_json | Optional | key-value string, key should be string, value should be string, int, float, bool. Example "{\"id\":\"123456789\",\"type\":1}" |
frames | []FrameData | Optional | list of video frames to be uploaded |
Which FrameData's parameters contains:
| key | type | required | description |
|---|---|---|---|
base64 | string | Optional | base64 encoded text of image data |
label | string | Optional | label of the image as described at Label table |
index | int | Optional | the index of this frame in the video |
metadata | string_json | Optional | key-value string, key should be string, value should be string, int, float, bool. Example "{\"id\":\"123456789\",\"type\":1}" |
Sample request
curl -X POST \
https://tv-staging.trustingsocial.com/api/v1/verify_face_video_liveness_sync \
-H 'Authorization: TV <YOUR ACCESS KEY>:<CREATED SIGNATURE>' \
-H 'X-TV-Timestamp: 2019-04-21T18:00:15+07:00' \
-H 'Content-Type: application/json' \
-d \
'
{
"videos": [
{
"id": "433331b5-e1d4-433f-84e6-2260ec6bee92"
},
{
"id": "3b4bf7b6-088b-4931-9279-9259f5c34fe3"
}
]
}
'
Response
data.is_live carries the verdict and data.score how likely it is that the face is live (0-1). In case the request processing has been finished, the HTTP status code will be 200, and the data.status is either "success" or "failure", depending on whether the request has been successfully processed or not.
{
"data": {
"status": string, "success" or "failure"
"is_live": bool, // the face is live or not
"score": float // how likely that the face is live (0-1)
"videos": [
{
"id": string, // ID of the video
"is_live": bool, // liveness result of this video only
"score": float // how likely that the face is live (0-1)
},
... // up to 3 images
],
"request_id": string // return request id to the client and can use request-id to check logs.
},
"errors": [
{
"code": string,
"message": string,
"detail": {
"field": string, // optional, which parameter is invalid.
... // any other information that can be useful for client
},
},
... // other errors
]
}
A live video comes back like this:
{
"data": {
"is_live": true,
"request_id": "93029850-924c-465a-baa6-27d843cbb1ba",
"score": 0.9999999862517992,
"status": "success",
"videos": [
{
"id": "c5c7d001-0c62-4b31-8714-3bc256a8635c",
"is_live": true,
"score": 1
}
]
}
}
Failure codes
If the data.status is "failure", the "errors" field will tell you why it failed.
| Error code | Description |
|---|---|
image_has_no_face | the input image has no faces |
In case of any other errors, the data field will be empty, and the server sends one of following HTTP status code with error code:
| HTTP code | Error code | Description |
|---|---|---|
401 | access_denied_exception | You are not authorized to perform the action. |
413 | image_too_large_exception | The input image size exceeds the allowed limit (15MB). |
415 | invalid_image_format_exception | The provided image format is not supported (JPG/PNG) |
400 | invalid_parameter_exception | Input parameter violates a constraint. |
400 | request_time_too_skewed | The X-TV-Timestamp header is expired, need a newer one. |
404 | image_not_found_exception | The image ID is not found in DB. |
408 | request_timeout_exception | Request takes too long to process |
429 | rate_limit_exception | The number of requests exceeded your throughput limit. |
500 | internal_server_error | Some unexpected error occurs while processing the request |
The codes above are the ones documented for this endpoint. Response errors on the Overview lists the codes for the eKYC Core surface as a whole — the two lists do not match on every endpoint.