Domain name for API request: iai.tencentcloudapi.com.
This API is used to detect the liveness of a face in a static image uploaded by a user. Compared with dynamic liveness detection, static liveness detection does not require moving lips, shaking head, or blinking for recognition.
Image-based liveness detection is suitable for scenarios where the image is a selfie or the requirement for attack defense is not high. If you have a higher security requirement for liveness detection, please use FaceID.
SignatureMethod
to TC3-HMAC-SHA256
.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: DetectLiveFace. |
Version | Yes | String | Common Params. The value used for this API: 2020-03-03. |
Region | No | String | Common Params. This parameter is not required for this API. |
Image | No | String | Base64-encoded image data, which cannot exceed 5 MB. The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats (the aspect ratio of the image should be close to 3:4 (width:height); otherwise, the score returned for the image will be meaningless). PNG, JPG, JPEG, and BMP images are supported, while GIF images are not. |
Url | No | String | Image URL. The image cannot exceed 5 MB in size after being Base64-encoded. The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats. Either Url or Image must be provided; if both are provided, only Url will be used. (The aspect ratio of the image should be close to 3:4 (width:height); otherwise, the score returned for the image will be meaningless.) We recommend storing the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability. The download speed and stability of non-Tencent Cloud URLs may be low. PNG, JPG, JPEG, and BMP images are supported, while GIF images are not. |
FaceModelVersion | No | String | Algorithm model version used by the Face Recognition service. Currently, 2.0 and 3.0 are supported.This parameter is 3.0 by default starting from April 2, 2020. If it is left empty for accounts that used this API, 2.0 will be used by default.The parameter can be set only to 3.0 for accounts that purchase the service after November 26, 2020.Different algorithm model versions correspond to different face recognition algorithms. The 3.0 version has a better overall effect than the legacy version and is recommended. |
Parameter Name | Type | Description |
---|---|---|
Score | Float | Liveness score. Value range: [0,100]. The score is generally between 80 and 100, but 0 is also a common value. As a recommendation, when the score is greater than 87, it can be judged that the person in the image is alive. You can adjust the threshold according to your specific scenario. This field is meaningful only if FaceModelVersion is 2.0. |
FaceModelVersion | String | Algorithm model version used for face recognition. |
IsLiveness | Boolean | Whether liveness detection is passed. This field is meaningful only if FaceModelVersion is 3.0. |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: iai.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DetectLiveFace
<Common request parameters>
{
"Url": "http://test.image.myqcloud.com/testA.jpg"
}
{
"Response": {
"Score": 99,
"IsLiveness": true,
"FaceModelVersion": "3.0",
"RequestId": "048a5eb3-f7a9-4c1f-a982-00e90b6b892c"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AuthFailure.InvalidAuthorization | Authentication failed. |
FailedOperation.ConflictOperation | The operations conflict. Do not operate on the same person simultaneously. |
FailedOperation.DuplicatedGroupDescription | The custom description field must be unique in the group. |
FailedOperation.FaceSizeTooSmall | The face frame size is smaller than the MinFaceSize value, and the face is filtered out. |
FailedOperation.GroupInDeletedState | The current group is being deleted. Please wait. |
FailedOperation.GroupPersonMapExist | The ID of the corresponding person is already in the group. |
FailedOperation.GroupPersonMapNotExist | The ID of the corresponding person is not in the group. |
FailedOperation.ImageDecodeFailed | Image decoding failed. |
FailedOperation.ImageDownloadError | An error occurred while downloading the image. |
FailedOperation.ImageFacedetectFailed | Face detection failed. |
FailedOperation.ImageResolutionExceed | The image resolution is too high. |
FailedOperation.ImageResolutionTooSmall | The image short edge resolution is smaller than 64. |
FailedOperation.ImageSizeExceed | The size of the Base64-encoded image cannot exceed 5 MB. |
FailedOperation.RequestLimitExceeded | The request frequency exceeds the limit. |
FailedOperation.RequestTimeout | The backend service timed out. |
FailedOperation.RpcFail | The RPC call failed. |
FailedOperation.SearchFacesExceed | The number of faces searched for exceeds the limit. |
FailedOperation.ServerError | The algorithm service is exceptional. Please retry. |
FailedOperation.UnKnowError | An internal error occurred. |
InternalError | Internal error. |
InvalidParameter.InvalidParameter | Invalid parameter. |
InvalidParameterValue.AccountFaceNumExceed | The number of faces in the account exceeds the limit. |
InvalidParameterValue.DeleteFaceNumExceed | The number of faces to be deleted exceeds the limit. Every person must have at least one face image. |
InvalidParameterValue.FaceModelVersionIllegal | The algorithm model version is invalid. |
InvalidParameterValue.GroupExDescriptionsExceed | The array length of the group's custom description fields exceeds the limit. Up to 5 fields can be created. |
InvalidParameterValue.GroupExDescriptionsNameIdentical | The name of the group's custom description field must be unique. |
InvalidParameterValue.GroupExDescriptionsNameIllegal | The name of the group's custom description field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupExDescriptionsNameTooLong | The name of the group's custom description field exceeds the length limit. |
InvalidParameterValue.GroupFaceNumExceed | The number of faces in the group exceeds the limit. |
InvalidParameterValue.GroupIdAlreadyExist | The group ID already exists. It must be unique. |
InvalidParameterValue.GroupIdIllegal | The group ID contains invalid characters. It can contain only letters, digits, and special symbols (-%@#&_). |
InvalidParameterValue.GroupIdNotExist | The group ID does not exist. |
InvalidParameterValue.GroupIdTooLong | The group ID exceeds the length limit. |
InvalidParameterValue.GroupIdsExceed | The list of groups passed in exceeds the limit. |
InvalidParameterValue.GroupNameAlreadyExist | The group name already exists. It must be unique. |
InvalidParameterValue.GroupNameIllegal | The group name contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupNameTooLong | The group name exceeds the length limit. |
InvalidParameterValue.GroupNumExceed | The number of groups exceeds the limit. If you need more, please contact us. |
InvalidParameterValue.GroupNumPerPersonExceed | The number of groups exceeds the limit. One person can be added to up to 100 groups. |
InvalidParameterValue.GroupTagIllegal | The group remarks field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupTagTooLong | The group remarks field exceeds the length limit. |
InvalidParameterValue.ImageEmpty | Empty image. |
InvalidParameterValue.LimitExceed | The number of returned results exceeds the limit. |
InvalidParameterValue.NoFaceInGroups | There are no faces in the specified group. |
InvalidParameterValue.NoFaceInPhoto | There are no faces in the image. |
InvalidParameterValue.OffsetExceed | The starting number is too large. Please check the length of the array to be requested. |
InvalidParameterValue.PersonExDescriptionInfosExceed | The array length of the person's custom description fields exceeds the limit. Up to 5 fields are allowed. |
InvalidParameterValue.PersonExDescriptionsNameIdentical | The name of the person's custom description field must be unique. |
InvalidParameterValue.PersonExDescriptionsNameIllegal | The name of the person's custom description field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.PersonExDescriptionsNameTooLong | The name of the person's custom description field exceeds the length limit. |
InvalidParameterValue.PersonExistInGroup | The ID of the corresponding person is already in the group. |
InvalidParameterValue.PersonFaceNumExceed | The number of face images for the person exceeds the limit. One person can have up to 5 face images. |
InvalidParameterValue.PersonGenderIllegal | An error occurred while setting person gender. 0: empty; 1: male; 2: female. |
InvalidParameterValue.PersonIdAlreadyExist | The person ID already exists. It must be unique. |
InvalidParameterValue.PersonIdIllegal | The person ID contains invalid characters. It can contain only letters, digits, and -%@#&_. |
InvalidParameterValue.PersonIdNotExist | The person ID does not exist. |
InvalidParameterValue.PersonIdTooLong | The person ID field exceeds the length limit. |
InvalidParameterValue.PersonNameIllegal | The person name contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.PersonNameTooLong | The person name exceeds the length limit. |
InvalidParameterValue.SearchPersonsExceed | The number of persons searched for exceeds the limit. |
InvalidParameterValue.UploadFaceNumExceed | Up to four faces can be uploaded at a time. |
InvalidParameterValue.UrlIllegal | Invalid URL format. |
LimitExceeded.ErrorFaceNumExceed | The number of faces exceeds the limit. |
MissingParameter.ErrorParameterEmpty | A required parameter is empty. |
ResourceUnavailable.Delivering | The resource is being shipped. |
ResourceUnavailable.Freeze | The account is frozen. |
ResourceUnavailable.InArrears | The account is in arrears. |
ResourceUnavailable.NotExist | The billing status is unknown. Please check whether the service has been activated in the console. |
ResourceUnavailable.Recover | The resource has been repossessed. |
ResourceUnavailable.StopUsing | The service has been suspended for the account. |
ResourceUnavailable.UnknownStatus | The billing status is unknown. |
ResourcesSoldOut.ChargeStatusException | The billing status is exceptional. |
UnsupportedOperation.UnknowMethod | Unknown method name. |
Was this page helpful?