InitFaceVerify - Initiate a verification request
This topic describes how to perform liveness detection and face verification by using the InitFaceVerify API.
Image requirements
Photos submitted by your end users for identity verification must meet the following requirements:
The photo must be recent. The end user must look directly at the camera with a neutral expression and minimal head tilt.
The photo is clear and has proper exposure. The face is not too dark, too bright, or affected by glare.
The photo resolution is no greater than 1920x1080 pixels (height x width) and no less than 640x480 pixels (height x width). The height must be greater than the width. Scale the shorter side to 720 pixels with a compression ratio greater than 0.9.
The photo size is less than 1 MB.
The service can process photos that are rotated clockwise by 90, 180, or 270 degrees.
The photo contains only one face.
NoteIf a photo contains multiple faces, the service verifies the largest face by default.
Example of a valid image: 
Initiate a verification request
API operation: InitFaceVerify
Global endpoint: cloudauth.aliyuncs.com (IPv4) or cloudauth-dualstack.aliyuncs.com (IPv6)
Request method: POST and GET
Transport protocol: HTTPS
Description: Call this API before each verification to obtain a CertifyId, which links all API calls for a single authentication request.
QPS limit: Each API has a dedicated limit. See Server-side API QPS limits.
The Financial-grade Real Person Authentication service does not currently support hard caps or automatic suspension based on the number of calls. To control costs and prevent unexpected charges, configure consumption alert rules immediately after integration:
Configure consumption alerts: Set high-value consumption alerts to monitor your spending in real time.
Monitor your resource plan balance: If you have purchased a resource plan, set a resource plan balance alert so you can top up the plan or adjust your call strategy promptly.
Configure business monitoring: See Alert notification settings to monitor for business anomalies and request fluctuations.
Request parameters
Parameter | Type | Required | Description | Example value |
SceneId | Long | Yes | The ID of the verification scenario. This ID is automatically generated after you create a verification scenario in the console. For more information about how to create a verification scenario, see Add a verification scenario. | 100000**** |
OuterOrderNo | String | Yes | A unique business identifier that you define for tracking and troubleshooting purposes. The value can be up to 32 characters long and consist of only letters and digits. Ensure that the value is unique for each request. | e0c34a77f5ac40a5aa5e6ed20c35**** |
ProductCode | String | Yes | The verification solution. The only valid value is PV_FV. | PV_FV |
Model | String | No | The type of liveness detection. The following values are supported: Note Only the following values are supported for the liveness detection type. Custom actions or combinations are not supported.
Note
| MOVE_ACTION |
UserId | String | Yes | A custom user ID. The ID must be unique and can contain up to 100 characters. | 12345**** |
CertType | String | No | The document type. Currently, only identity cards are supported. The only valid value is IDENTITY_CARD. Note This solution does not verify the authenticity or consistency of the name and document number. To perform this verification, choose an identity verification solution. | IDENTITY_CARD |
CertName | String | No | The real name of your end user. | John Doe |
CertNo | String | No | The document number of your end user. | 33010312345678**** |
MetaInfo | String | Yes | The | Important This example is for reference only. Do not use it directly in your integration. For more information, see the SDK integration guide. |
Mobile | String | No | The mobile phone number of your end user. | 1304567**** |
Ip | String | No | The IP address of your end user. | 114.112.xx.xx |
FaceContrastPicture | String | No Note You can provide a face photo in one of three ways:
If you choose the OSS method, you must specify the OssBucketName and OssObjectName parameters. The OSS request parameters only support buckets and objects from the OSS service that you authorized when enabling Real Person Verification. | The Base64-encoded photo. If you use the FaceContrastPicture method, check the photo size to avoid submitting an oversized photo. Note If you need to upload a large face photo, use the OSS method. | /9j/4AAQSkZJRgABAQAASASBC**** |
FaceContrastPictureUrl | String | The URL of the face photo. The URL must be a publicly accessible HTTP or HTTPS link. | https://cn-shanghai-aliyun-cloudauth-****.oss-cn-shanghai.aliyuncs.com/verify/****.jpeg | |
OssBucketName | String | The name of the authorized Object Storage Service (OSS) bucket. | cn-shanghai-aliyun-cloudauth-**** | |
OssObjectName | String | The name of the object in the authorized OSS bucket. | verify/****.jpeg | |
CallbackUrl | String | No | This parameter specifies the callback URL for verification results. The callback method defaults to GET, and the URL must start with Important
| https://www.aliyun.com |
CallbackToken | String | No | A security token that you generate to prevent replay attacks and tampering. If you set this parameter, the CallbackToken field is included in the callback URL. | NMjvQanQgplBSaEI0sL86WnQplB |
Crop | String | No | Specifies whether to allow the face photo to be cropped. Cropping is disallowed by default.
Note If the photo was not captured using the standard liveness detection SDK, enabling cropping is recommended. If you enable this feature, the service first crops and aligns the face in the photo before processing the request. | T |
AuthId | String | No | The user authorization ID. The value can be up to 64 characters long. | 92d46b9e9e2d703f2897f350d5bd4149 |
SuitableType | String | No | This parameter configures the elderly-friendly mode for each verification request. You can set a different value for each request based on your app's business attributes, user demographics, and operational features. The default value is 0.
Note
| 0 |
AppQualityCheck | String | No | Specifies whether to enable the strict face quality check in the SDK.
This feature requires separate integration, and enabling it increases the package size. To use this feature, download the package from this link. Note
| N |
NeedMultiFaceCheck | String | No | Specifies whether to block verification if the device detects multiple faces. Valid values:
| Y |
EnableBeauty | String | No | Enable retouching during face verification.
Important
| N |
For the OSS input parameters, you can only use the URL, Bucket, and object name that are generated by the OSS instance that you authorized when you activated the identity verification service. For information about how to query the authorized OSS, see Integration process.
If you use the FaceContrastPicture parameter (Base64 encoding of the photo) to pass in a face photo, make sure that the photo is not too large. You can use OSS to upload larger face photos.
Response parameters
Parameter | Type | Required | Description | Example value |
RequestId | String | Yes | The unique ID of the request. | 130A2C10-B9EE-4D84-88E3-5384FF03**** |
Message | String | No | The response message. | success |
Code | String | Yes | The response code. For more information about response codes, see Response codes and messages. | 200 |
ResultObject.CertifyId | String | No | The unique identifier for the identity verification session. Warning Store this ID to simplify future bill reconciliation. The | 91707dc296d469ad38e4c5efa6a0**** |
Response codes and messages
Code | Message | Description |
200 | success | The request was successful. |
400 | Parameter cannot be empty | A required parameter is empty. |
401 | Invalid parameter | The parameter is invalid. For example, the name or document number might contain invalid characters or fail to meet format requirements. |
402 | Application configuration not found | The application configuration does not exist. |
404 | Verification scenario not found | The verification scenario configuration does not exist. Create a verification scenario in the console first. |
410 | Service not activated | Object Storage Service (OSS) is not activated, or read and write permissions are not granted for OSS. Log on to the CloudAuth console to grant the required permissions. For more information, see Activate and authorize OSS. |
411 | RAM permission denied | The RAM user does not have the required permissions. You must grant the AliyunAntCloudAuthFullAccess permission to the RAM user. |
412 | Overdue payment | Your CloudAuth or Object Storage Service (OSS) account has an overdue payment. Top up your account and try again. |
414 | Device not supported | The current mobile device does not support face verification. Try again with a different device. |
415 | SDK version not supported | The current SDK version does not support face verification. Upgrade the SDK and try again. |
416 | OS version not supported | The current operating system version does not support face verification. Upgrade the OS or try again with a different device. |
417 | Face verification service unavailable | Failed to extract facial features from the provided custom reference photo. Upload a different photo. |
419 | Image unavailable | The photo failed to download, is empty, or does not meet the resolution requirements. |
420 | Duplicate data | More than one method was used to submit the photo. You must use only one of the following methods:
|
421 | Image too large | The photo size exceeds 1 MB. Compress the photo or use a different upload method. |
422 | Download timeout | The photo download timed out after 3 seconds. Check your network connection and try again. |
423 | Invalid status | The provided |
500 | System error | An internal system error occurred. Contact support for troubleshooting. |