tencent cloud

人脸核身

动态与公告
产品动态
产品公告
产品简介
产品概述
产品优势
应用场景
购买指南
计费概述
购买方式
欠费说明
退费说明
接入文档
开始集成
活体人脸比对(纯 API)接入指引
活体人脸比对 (移动端H5) 接入指引
活体人脸比对 (App SDK) 接入指引
卡证活体人脸比对(移动端 H5)接入指引
卡证活体人脸比对(App SDK)接入指引
其他指引
API 文档
History
Introduction
API Category
Making API Requests
Selfie Verification (Pure API) APIs
Selfie Verification (App SDK) APIs
Identity Verification (App SDK) APIs
Identity Verification(Mobile HTML5) APIs
AI Face Shield (Pure API) APIs
Other APIs
Data Types
Error Codes
常见问题
联系我们
词汇表
eKYC 政策
隐私协议
数据处理和安全协议
服务等级协议

CompareFaceLiveness

PDF
聚焦模式
字号
最后更新时间: 2026-03-03 13:51:12

1. API Description

Domain name for API request: faceid.intl.tencentcloudapi.com.

This interface supports judgment of real person and photo comparison to verify the user's identity online. By passing the video and photo into the interface, it will first judge whether the person in the video is real. If yes, it judges whether the person in the video is the same one as the uploaded photo and returns authentication result.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CompareFaceLiveness.
Version Yes String Common Params. The value used for this API: 2018-03-01.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-hongkong, ap-singapore.
ImageBase64 Yes String Base64 string of the image for face comparison.
- The size of the Base64-encoded image data can be up to 3 MB. JPG and PNG formats are supported.
- Please use the standard Base64 encoding method (with = padding). Refer to RFC4648 for the encoding specification.
VideoBase64 Yes String Base64 string of the video for liveness detection.
- The size of the Base64-encoded video data can be up to 8 MB. MP4, AVI, and FLV formats are supported.
-Use standard Base64 encoding (with = padding), following RFC4648.
LivenessType Yes String Liveness detection type.
-Values:
ACTION is action mode.
SILENT is silent mode.
-Choose one of the two modes to pass in.
ValidateData No String Control the action sequence. Action types include: 1 (open mouth), 2 (blink), 3 (nod), 4 (shake head). Supports one or two actions.
-Required when the LivenessType parameter is set to ACTION.
-Single action example: "1".
-Multiple actions parameter passing example: "4,2".
-When the LivenessType parameter is set to SILENT, leave it blank.

3. Output Parameters

Parameter Name Type Description
Result String Business Error Codes.
-When the return value is "Success", it indicates that liveness detection and face comparison passed. Determined to be the same person.
-When the return value is "FailedOperation.CompareLowSimilarity", it indicates that liveness detection passed, but face comparison similarity is below 70. Determined not to be the same person.
-For other error cases, please refer to Liveness Face Comparison (API only) Error Codes
Description String The service result description
Sim Float This value indicates the similarity of face comparison. Value range: 0.00-100.00.
- The false acceptance rate for a threshold of 70 is 0.1%, and for a threshold of 80, it is 0.01%.
- This value is valid when the Result parameter is "Success" or "FailedOperation.CompareLowSimilarity".
BestFrameBase64 String The best screenshot photo from the video after verification, encoded in BASE64, in jpg format.
The optimal screenshot of the video after verification is the value encoded by BASE64, jpg format.
Note: This field may return "null", indicating that no valid value can be obtained.
Example values: "/9j/4AAQSk... (total length:142036)s97n//2Q=="
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Liveness detection and face comparison passed. Determined to be the same person.

Liveness detection and face comparison passed. Determined to be the same person.

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CompareFaceLiveness
<Common request parameters>

{
    "LivenessType": "SILENT",
    "ImageBase64": "iVBORw0KGg...s97n//2Q==",
    "VideoBase64": "AAAAGGZ0eX...AAwAAAAEecg=",
    "ValidateData": ""
}

Output Example

{
    "Response": {
        "Result": "Success",
        "Description": "Success",
        "Sim": 100,
        "BestFrameBase64": "/9j/4AAQSk...s97n//2Q==",
        "RequestId": "f89097ac-4003-4d73-acb3-696d4057b9eb"
    }
}

Example2 Liveness detection and face comparison failed. Determined not to be the same person.

Liveness detection and face comparison failed. Determined not to be the same person.

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CompareFaceLiveness
<Common request parameters>

{
    "ImageBase64": "iVBORw0KGg...s97n//2Q==",
    "VideoBase64": "AAAAGGZ0eX...AAwAAAAEecg=",
    "LivenessType": "ACTION",
    "ValidateData": "1"
}

Output Example

{
    "Response": {
        "Result": "FailedOperation.CompareLowSimilarity",
        "Description": "The comparison similarity did not reach the passing standard.",
        "Sim": 9.21,
        "BestFrameBase64": "/9j/4AAQSk...8ASrH/2Q==",
        "RequestId": "6176fad1-f078-445b-8a4d-c8a903528b5a"
    }
}

Example3 Liveness detection failed, the specified action was not detected.

Liveness detection failed, the specified action was not detected.

Input Example

POST / HTTP/1.1
Host: faceid.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CompareFaceLiveness
<Common request parameters>

{
    "ImageBase64": "iVBORw0KGg...s97n//2Q==",
    "VideoBase64": "AAAAGGZ0eX...AAwAAAAEecg=",
    "LivenessType": "ACTION",
    "ValidateData": "4,2"
}

Output Example

{
    "Response": {
        "Result": "FailedOperation.ActionFirstAction",
        "Description": "The first motion is not detected.",
        "Sim": 0,
        "BestFrameBase64": "/9j/4AAQSk...W/M7/M/9k=",
        "RequestId": "df5afd82-6469-4a4a-bd62-debf8c2ef94e"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.CompressVideoError The video compression failed. Please try again or reduce the size of the input video.
FailedOperation.UnKnown Unknown internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue Incorrect parameter value.
UnauthorizedOperation.Activating Activating the service.
UnauthorizedOperation.Arrears The account is in arrears.
UnauthorizedOperation.NonAuthorize Identity verification has not been completed for the account.
UnauthorizedOperation.Nonactivated The service has not been activated.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈