跳转到内容

活体检测

活体检测服务有两个步骤。

1 集成 SDK

Android

2 活体检测 V1

代码示例:

curl --location --request POST 'https://api.ekycpro.com/v1/picturelive' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-API-Key: AbcdEfgh' \
--data-urlencode 'img=BASE64_ENCODE_VALUE'

成功响应示例:

{
"status": "OK",
"message": {
"live_score": 100
}
}

成功响应示例(detail = 1):

{
"status": "OK",
"message": {
"is_liveness": true,
"live_score": 100,
"reason": "success"
}
}

多个人脸示例(detail = 1):

{
"status": "OK",
"message": {
"is_liveness": false,
"live_score": 0,
"reason": "multiple faces"
}
}

无活体人脸示例(detail = 1):

{
"status": "OK",
"message": {
"is_liveness": false,
"live_score": 0,
"reason": "no liveness face"
}
}

闭眼示例(detail = 1):

{
"status": "OK",
"message": {
"is_liveness": false,
"live_score": 0,
"reason": "eyes closed"
}
}

年龄不满意示例(detail = 1):

{
"status": "OK",
"message": {
"is_liveness": false,
"live_score": 0,
"reason": "age dissatisfaction"
}
}

图像错误响应示例:

{
"status": "FAIL",
"message": "check input image and retry"
}

请求参数错误响应示例:

{
"status": "INVALID_REQUEST",
"message": "check request params"
}

图像格式错误响应示例:

{
"status": "IMAGE_INVALID_FORMAT",
"message": "image format not support"
}

图像超过 2M 错误响应示例:

{
"status": "IMAGE_INVALID_SIZE",
"message": "image larger than 2M"
}

服务器错误响应示例:

{
"status": "INNER_ERROR",
"message": "Inner error, please retry later"
}

请求 URL

POST https://api.ekycpro.com/v1/picturelive

请求参数:

参数描述
imgstring,Base64 编码的图像,来自实时视频的图片
countrystring国家缩写。墨西哥:MX,印度:IN,泰国:TH,印度尼西亚:ID
detail可选string,当 detail=1 时返回不通过的原因

默认响应描述:

参数描述
status状态码
messagelive_score:活体检测分数[0-100]

详细响应描述

参数描述
status状态码
messageis_liveness:活体检测是否通过
live_score:活体分数[0-100]
reason:success、eyes closed、no liveness face、face incomplete、face dark、face blur、no face detected、multiple faces

状态码:

状态消息
OKcharge,识别成功
FAILcharge,图像错误
INVALID_REQUESTfree,请求参数错误
IMAGE_INVALID_FORMATfree,不支持的图像格式,仅支持 PNG、JPG、JPEG、BMP 格式
IMAGE_INVALID_SIZEfree,图像大小应在 base64 编码后小于 2M
INNER_ERRORfree,系统错误