This topic describes how to call the Initialize API operation to initiate an authentication request.
Initiate an authentication request
-
API operation: Initialize
-
Request method: HTTPS POST
-
Description: Before you start an authentication flow, call this operation to obtain a transactionId. This ID links all API operations for the authentication request.
-
This API operation has a dedicated QPS limit. For more information, see QPS limits for ID Verification server-side API operations.
-
Service endpoints:
NoteBenefits of internal network access: An internal network is a private communication network between Alibaba Cloud products within the same region. If your business server is deployed in the corresponding Alibaba Cloud region, you can use the internal same-region endpoint to access the ID Verification service. This provides more secure and stable communication.
Optimization suggestions for access from outside China: Network environments outside China can be complex. To optimize your integration solution, reduce network latency, and minimize request failures, see Server-side network latency analysis and optimization.
China (Hong Kong)
Public network:
cloudauth-intl.cn-hongkong.aliyuncs.comInternal network:
cloudauth-intl-vpc.cn-hongkong.aliyuncs.com
Online testing and integration
Before you debug and integrate an API operation, see Debug and integrate server-side API operations using OpenAPI Explorer for information about how to call API operations and obtain SDKs and sample code in OpenAPI Explorer.
You can call this operation directly in OpenAPI Explorer to test it, and generate SDK sample code for this operation.
Request parameters
|
Name |
Type |
Required |
Description |
Example |
|
ProductCode |
String |
Yes |
The product solution to use. The only valid value is FACE_LIVENESS. |
FACE_LIVENESS |
|
SceneCode |
String |
No |
A custom ID for the authentication scenario. You can use this ID to query related records in the console. The ID can be up to 10 characters long and can contain letters, digits, and underscores (_). |
1234567890 |
|
MerchantBizId |
String |
Yes |
A custom unique business identifier. You can use it to track and troubleshoot issues. The identifier can be up to 32 characters long and can contain letters and digits. Make sure the identifier is unique. Note
Alibaba Cloud servers do not check the uniqueness of this value. For better tracking, we strongly recommend that you ensure the uniqueness of this field. |
e0c34a77f5ac40a5aa5e6ed20c35**** |
|
MetaInfo |
String |
Yes |
The MetaInfo environment parameter. In a real environment, you must obtain this parameter by calling the getMetaInfo() function in the JS file. For more information, see Android integration. Note
Do not modify the return value. Pass it through directly. |
|
|
MerchantUserId |
String |
Yes |
A custom user ID or another identifier for a specific user, such as a mobile phone number or email address. We strongly recommend that you desensitize this value in advance, for example, by hashing it. |
123456789 |
|
SecurityLevel |
String |
No |
The mode that represents different security levels of the verification flow. Valid values:
|
02 |
|
Model |
String |
No |
The type of liveness detection to perform:
Note For information about the supported SDK versions, see SDK release notes. |
PHOTINUS_LIVENESS |
|
DocVideo |
String |
No |
Specifies whether to save a verification video.
Note Because the video file is large, the system may discard it if the network is unstable to prioritize the transmission of essential verification images. |
N |
|
CallbackUrl |
String |
No |
The webhook address for verification result notifications. The callback request method is GET by default. The webhook address must start with
Warning
|
https://www.aliyun.com?callbackToken=100000****&transactionId=shaxxxx&passed=Y&subCode=200 |
|
CallbackToken |
String |
No |
A security token that you generate. It is used for anti-replay and tamper-proofing checks. If you set this parameter, the CallbackToken field is included in the CallbackUrl callback. |
NMjvQanQgplBSaEI0sL86WnQplB |
|
AppQualityCheck |
String |
No |
Specifies whether to enable strict face quality checks:
Important
|
N |
Returned data
|
Name |
Type |
Description |
Example |
|
|
HTTP status code |
Integer |
The HTTP status code. |
200 |
|
|
HTTP Body |
RequestId |
String |
The request ID. |
130A2C10-B9EE-4D84-88E3-5384FF03**** |
|
Code |
String |
Success |
||
|
Message |
String |
A detailed description of the return code. |
success |
|
|
Result.TransactionId |
String |
The unique identifier for the entire verification flow. This field is used for billing statistics and to initiate a CheckResult API operation request. Important
|
hksb7ba1b28130d24e015d6******** |
|
|
Result.Protocol |
String |
The standard encrypted protocol for authentication. We recommend that you obtain this parameter and pass it to the client SDK. The client SDK uses this parameter to reduce network interactions and support dynamic network switching to improve user experience. |
hksb7ba1b28130d24e015d********* |
|
Return codes
HTTP status code | Code | Description |
200 | Success | Request successful. |
400 | MissingParameter | Parameter cannot be empty. |
InvalidParameter | Invalid parameter. | |
401 | Forbidden.ExceptionRepeatedInvoke | The number of repeated abnormal calls exceeds the limit. |
403 | Forbidden.RAMUserAccessDenied | You need to grant the RAM user the AliyunAntCloudAuthFullAccess permission. For more information, see Authorize RAM users to access the service. |
Forbidden.AccountAccessDenied | Ensure that you have activated ID verification and your account has no overdue payment. | |
Throttling.Api | API request is blocked due to throttling. | |
500 | InternalError | Internal system error. Provide feedback to engineers for troubleshooting. |
503 | ServiceUnavailable | The service is unavailable. Contact engineers for troubleshooting. |