This topic describes how to use FaceLiveness API.
Interface description
Interface name: FaceLiveness.
Service address: cloudauth-intl.cn-hongkong.aliyuncs.com.
Request method: HTTPS POST.
Interface description: Call the FaceLiveness interface to perform liveness detection on input face images.
Request parameters
Parameter | Type | Required | Description | Example |
ProductCode | String | Yes | Product code of identity proofing. | FACE_LIVENESS_MIN |
MerchantBizId | String | Yes | A unique business ID for tracing purpose. For example, the sequence ID from the merchant's business-related database. Note The Alibaba Cloud server does not perform uniqueness check on the value of this field. For better tracking, it is strongly recommended to enable the merchant server to guarantee the uniqueness of the business ID. | e0c34a77f5ac40a5aa5e6ed20c35**** |
MerchantUserId | String | Yes | Merchant user ID, or other identifiers that can be used to identify a specific user, for example, mobile phone number, email address and so on. It is strongly recommended to pre-desensitize the value of the userId field, for example, by hashing the value. | 123456789 |
FacePictureBase64 | String | No | Photos Base64 encoded. When ProductCode is FACE_LIVENESS, FacePictureBase64 or FacePictureUrl need to be set. If you choose FacePictureBase64 to transfer face photo, please pay attention to check the size of the photo, and do not import too large photo. | base64 |
FacePictureUrl | String | No | The HTTPS or HTTP address of the face image. When ProductCode is FACE_LIVENESS, FacePictureBase64 or FacePictureUrl need to be set. | https://*** |
FaceQuality | String | No | Whether to return the quality score of the input face image. The following values are supported:
By default, the value of F is used. | F |
Crop | String | No | Whether to enable the face image cropping so that the detected face is used as the center of the derived picture. The following values are supported:
By default, the value of F is used. | F |
Occlusion | String | No | Whether to enable the face occlusion feature. The following values are supported:
By default, the value of F is used. | F |
Response parameters
Field name | Data type | Description | Example | |
HTTP Status Code | Integer | The HTTP status code. | 200 | |
HTTP Body | RequestId | String | The unique ID of the request, which can be used to locate issues. | 130A2C10-B9EE-4D84-88E3-5384FF039795 |
Result.TransactionId | String | A unique transaction ID that is generated by the Alibaba Cloud server for the identity proofing process. This ID will be used as an input parameter for the ID Verification CheckResult API request. Note When an error occurs during the process, for example, invalid argument, no transaction ID is returned. | hksb7ba1b28130d24e015d694361bee4 | |
Code | String | Return code. For the full list of codes, see Codes and Messages. | Success | |
Message | String | Response detailed message. | Success | |
Result.Passed | String | Certification result. Possible values and their meanings are as below:
| Y | |
Result.SubCode | String | Authentication result sub code. | 200 | |
Result.ExtFaceInfo | String | Detailed information about face liveness process. Optional. JSON string of ExtFaceInfo. For more information, see ExtFaceInfo showed below. |
|
Codes and Messages
HTTP Status Code | Code | Message |
200 | Success | The request has succeeded. |
400 | MissingParameter | The parameter is missing. |
400 | InvalidParameter | The parameter is invalid. |
403 | Forbidden.RAMUserAccessDenied | Grant AliyunAntCloudAuthFullAccess permission to the RAM user. For more information, see Authorize a RAM user to access Real ID. |
403 | Forbidden.AccountAccessDenied | The account is unauthorized, overdue, deactivated, or disabled. |
403 | Throttling.Api | Request was denied due to api flow control. |
500 | InternalError | The error message returned because a temporary server error occurs. We recommend that you try again. If the error code persists, please submit a ticket for help. |
SubCode
SubCode | Whether billing | Message |
200 | Yes | Pass. |
205 | Yes | The authentication failed. Spoofing behavior is detected. |
ExtFaceInfo
The following table shows the fields that can be specified in the ExtFaceInfo data model.
Field name | Data type | Description | Example |
faceQualityScore | Double | Optional. The quality score of the input face image. Specified only when the value of the FaceQuality field in the request is set to T. The value of this field is between 0 and 100. | 88.62 |
occlusionResult | String | Optional. The face occlusion result returns Y if the face in an image is partially captured or not fully visible due to overlapping objects, clothing, and body parts. Otherwise, N is returned. Specified only when the value of the Occlusion field in the request is set to T. | N |
faceAttack | String | Specifies whether the face selfie image is detected as a fake face attack by using the face liveness check algorithm. If the image is a fake face attack, the value of Y is returned; otherwise, the value of N is returned. | N |