This topic describes how to call the InitializeV2 operation to initiate an eKYC-PRO request.
API information
Operation name: InitializeV2
Request method: HTTPS POST
Description: Before you start an authentication flow, call this operation to obtain a transactionId. This ID links all subsequent API calls for the authentication request.
QPS limit: Each API has its own QPS limit. For more information, see QPS limits of ID Verification server-side APIs.
Endpoint:
NoteBenefits of internal network access: An internal network is a private communication network connecting Alibaba Cloud products within the same region. If your application server is deployed in the same region, use the internal endpoint to access the ID Verification service for enhanced security and stability.
Optimizing overseas access: Overseas network environments can be complex. Refer to Optimize server network latency to tune your integration and reduce network latency and request failures.
Asia Pacific SE 1 (Singapore)
Public endpoint:
cloudauth-intl.ap-southeast-1.aliyuncs.comInternal endpoint:
cloudauth-intl-vpc.ap-southeast-1.aliyuncs.com
Asia Pacific SE 5 (Jakarta)
Public endpoint:
cloudauth-intl.ap-southeast-5.aliyuncs.comInternal endpoint:
cloudauth-intl-vpc.ap-southeast-5.aliyuncs.com
China (Hong Kong)
Public endpoint:
cloudauth-intl.cn-hongkong.aliyuncs.comInternal endpoint:
cloudauth-intl-vpc.cn-hongkong.aliyuncs.com
Asia Pacific SE 3 (Kuala Lumpur)
Public endpoint:
cloudauth-intl.ap-southeast-3.aliyuncs.comInternal endpoint:
cloudauth-intl-vpc.ap-southeast-3.aliyuncs.com
Online Debugging and Integration
Before debugging and integration, read the Use OpenAPI document to learn how to call APIs on the OpenAPI platform and obtain the SDK.
You can go to OpenAPI Explorer to run and debug this API, and generate SDK code examples.
Integration notes
A
TransactionIdis returned only upon successful initialization. The client must complete the authentication within 30 minutes of obtaining theTransactionIdorTransactionUrl. TheTransactionIdis for one-time use only. The ID becomes invalid immediately after the authentication attempt and cannot be reused to invoke the SDK, regardless of whether the authentication succeeds, fails, or is canceled by the user. To start a new authentication, you must request a newTransactionIdfrom the server-side.The
TransactionUrlis returned only for the Web SDK scenario and is valid for a single use. Do not concatenate, modify, or reuse it.Due to network latency,
CallbackUrlnotifications may be delayed. After receiving the authentication completion notification, the client must call the server-sideCheckResultoperation to obtain the final authentication details. Do not rely solely on the callback notification or the results displayed on the page.The features of the App SDK and Web SDK differ. The behavior of the Web SDK also varies between mobile H5 and PC environments. For more information about supported features, see the integration documents.
Supported certificate types vary by deployment region. Before you begin, check the Certificate Type Table for your destination region.
Enabling
Authorizemay incur additional fees and has a response time of 1–30 seconds. You should configure the server-side timeout accordingly.
Request parameters
Field description
Integration method | Scenarios | Initialization API response | Request parameters |
App SDK | Authenticating in a native Android or iOS app |
| Common parameters + App-specific parameters |
Web SDK | Mobile H5 or PC browser authentication |
| Common parameters + Web SDK-specific parameters |
The fields are categorized as follows:
Common parameters: Can be used for both integration methods.
App SDK specific: Used to customize the liveness detection flow and document scanning method.
Web SDK specific: Used to control page redirects, language and UI, OCR pages, and H5 fallback behavior.
Request parameters (Common)
Field | Type | Required | Note | Example value |
ProductCode | String | Yes | Product solution identifier. Value: eKYC_PRO. The user must complete ID document verification and liveness detection. | eKYC_PRO |
SceneCode | String | No | A custom ID for the authentication scenario. Use this ID to retrieve records from the console. The ID can be a 10-character string that consists of letters, numbers, and underscores. | 1234567890 |
MerchantBizId | String | Yes | A unique business identifier for the merchant, used to identify and troubleshoot issues. The identifier is a 32-character string of letters and numbers. The server-side does not validate the uniqueness of this ID. The merchant must ensure that the ID is unique. | e0c34a77f5ac40a5aa5e6ed20c35**** |
MetaInfo | String | Yes | Client environment information. Generate this information using the corresponding SDK. If you create it yourself, you must at least pass the correct Example code: Valid values for
Important Use the authentication SDK to obtain MetaInfo. This provides more accurate and detailed client information for scenarios such as authentication URL issuance, log investigation, and security checks. If you create a static MetaInfo value, make sure that `deviceType` matches the actual environment. An incorrect value will cause errors when the authentication URL is issued. | |
MerchantUserId | String | Yes | A custom user identifier, or another recognizable user identifier, such as a mobile phone number or email address. We recommend that you desensitize or hash this field. | 123456789 |
IdThreshold | String | No | OCR card quality check:
| 2 |
IdSpoof | String | No | OCR anti-spoofing detection:
You can view the output result in CheckResult at | Y |
OcrValueStandard | String | No | OCR configuration: Specifies whether to return standardized OCR fields:
The output is returned in the | 0 |
DocType | String | Yes | [OCR Configuration] Supports the following three input methods:
Important Supported certificate types vary by region due to model limitations.
| Examples of the three input methods:
|
Pages | String | No | OCR configuration for the certificate capture page:
Note Only some certificates support multi-page capture. For more information, see Certificate type table. | 01 |
AutoDocPageConfig | String | No | [OCR Configuration] This parameter takes effect only when the This parameter is supported only by Native SDK 1.4.0 and later. |
|
Model | String | No | Liveness detection type:
| PHOTINUS_LIVENESS |
DocVideo | String | No | Specifies whether to capture a 1- to 2-second evidence video during the face verification process. Valid values:
Video files are large. On unstable networks, the system may discard the video to prioritize uploading essential images. To get the video URL, check the | N |
FaceAttributeCheck | String | No | Face Recognition Configuration: Specifies whether to return additional facial attributes.
The output is returned in `Checkresult` at | N |
ShowGuidePage | String | No | UI configuration: Show guide page:
PC mode does not support this configuration. Supported in Native SDK version 1.2.8 and above. | 1 |
CallbackUrl | String | No | The callback URL for the authentication result. This URL must start with The platform returns an HTTP 400 error if the URL is not publicly accessible. | https://www.aliyun.com?callbackToken=100000****&transactionId=shaxxxx&passed=Y&subCode=200 |
CallbackToken | String | No | A custom security token for the merchant. Once set, this token is returned unchanged with the CallbackUrl for anti-replay and tamper-proofing verification. | NMjvQanQgplBSaEI0sL******** |
Security level | String | No | The security level. Valid values:
| 02 |
Authorize | String | No | Authoritative data source validation switch:
Note
| T |
Mobile | String | Conditionally required | An Indonesian mobile number in the format of | +6281293671234 |
String | Conditionally required | User mailbox. Required when | a*@gmail.com |
Request parameters (App SDK specific)
Only the native App SDK supports the following fields.
Field | Type | Required | Description | Example value |
AppQualityCheck | String | No | [Face Scan Configuration] Specifies whether to enable strict face quality detection.
Supported only in Native SDK v1.2.5 and later. The face quality detection module must be integrated. | N |
TemplateConfig | String | Conditionally required | [Face Scan Configuration] The custom action pool. This parameter is required when Model is set to TEMPLATE.
Action code lookup table:
Supported in Native SDK v1.3.6 and later. | 01,02,07 |
TemplateType | String | Conditionally required | [Face Scan Configuration] The execution order of liveness detection actions in TemplateConfig. This parameter is required when Model is set to TEMPLATE.
Supported in Native SDK v1.3.6 and later. | Seq |
NeedMultiFaceCheck | String | No | [Face Scan Configuration] Determines whether to block the request when multiple faces are detected by the terminal.
Supported in Native SDK version 1.4.1 and above. | Y |
DocScanMode | String | No | [OCR Configuration] The OCR certificate scan mode.
Supported only in Native SDK v1.2.8 and later. The automatic scanning component must be integrated. | shoot |
Request parameters (Web SDK specific)
Only the Web SDK supports the following fields.
Field | Type | Required | Note | Example value |
LanguageConfig | String | No | A JSON string for the custom language configuration. To apply the settings, convert your configuration to a JSON string based on the provided template and pass it as this parameter. For more information, see Customize Web SDK languages. Note Supported only in the mobile integration mode of the Web SDK. | |
StyleConfig | String | No | A JSON string for the custom UI configuration. To apply the configuration, convert your settings to a JSON string based on the provided template and pass it as this parameter. For more information, see Customize IDV UI styles. Note Supported only in the mobile integration mode of the Web SDK. | |
ShowAlbumIcon | String | No | OCR configuration: Specifies whether to show the option to upload from an album during the OCR step:
| 1 |
ShowOcrResult | String | No | OCR configuration: Controls whether to show the detection result page for the OCR step:
| 1 |
EditOcrResult | String | No | OCR configuration: Specifies whether users can edit OCR recognition results:
| 1 |
ReturnUrl | String | Conditionally required | The URL to redirect to after authentication. This is optional for the iframe embedded pattern. Provide this URL for page redirect scenarios that do not use an iframe. | https://www.alibabacloud.com |
ProcedurePriority | String | No | Specifies whether to display a fallback method when a compatibility issue occurs during mobile H5 authentication.
| URL |
Return data
Differences in returned fields
Field | App SDK | Web SDK | Note |
RequestId / Code / Message | Yes | Yes | General response information. |
Result.TransactionId | Yes | Yes | This is the unique identifier for the authentication flow, a field for billing statistics, and a request parameter for the |
Result.Protocol | Yes | Yes | Standard authentication and encryption protocol. Pass this through to the client SDK. The Web SDK requires this field for iframe embedding. |
Result.TransactionUrl | No | Yes | The Web SDK authentication URL. After authentication, it redirects to the |
Name | Type | Description | Example value | |
HTTP status code | Integer | HTTP status code. | 200 | |
HTTP body | RequestId | String | The request ID. | 130A2C10-B9EE-4D84-88E3-5384FF03**** |
Code | String | Return code: For more information, see Server-side HTTP status codes. | Success | |
Message | String | A detailed description of the return code. | success | |
Result.TransactionId | String | A unique identifier for the authentication flow. This identifier is used for billing and is required for calls to the CheckResult API. Important
| hksb7ba1b28130d24e015d6******** | |
Result.TransactionUrl | String | The Web SDK authentication URL redirects after authentication based on the input parameter ReturnUrl. Important
| https://www.alibabacloud.com/index.html?clientcfg=**** | |
Result.Protocol | String | The encrypted string for the standard authentication protocol. Passing this parameter to the client SDK reduces network interactions and supports dynamic network switching, which improves the user experience. | hksb7ba1b28130d24e015d********* | |
Request examples
App SDK
Minimal request example
{
"ProductCode": "eKYC_PRO",
"MerchantBizId": "e0c34a77f5ac40a*****",
"MetaInfo": "{\"deviceType\":\"android\"}",
"MerchantUserId": "user_hash_value",
"DocType": "GLB03001"
}Complete request example
{
"ProductCode": "eKYC_PRO",
"SceneCode": "1234567890",
"MerchantBizId": "e0c34a77f5ac40a5aa5e6ed20c35****",
"MetaInfo": "{\"deviceType\":\"android\",\"zimVer\":\"3.0.0\",\"appVersion\":\"1\",\"appName\":\"com.aliyun.antcloudauth\",\"osVersion\":\"Android 12\",\"deviceModel\":\"Pixel 6\"}",
"MerchantUserId": "user_hash_value_123",
"DocType": "GLB03001",
"Pages": "01,02",
"Model": "TEMPLATE",
"DocVideo": "N",
"FaceAttributeCheck": "N",
"ShowGuidePage": "1",
"CallbackUrl": "https://www.aliyun.com/callback",
"CallbackToken": "NMjvQanQgplBSaEI0sL********",
"SecurityLevel": "02",
"Authorize": "F",
"IdThreshold": "2",
"IdSpoof": "Y",
"OcrValueStandard": "0",
"AutoDocPageConfig": "{\"BRA01001\": \"01\", \"BRA01002\": \"01,02\"}",
"AppQualityCheck": "Y",
"TemplateConfig": "01,02,07",
"TemplateType": "Seq",
"TemplateRanCount": "2",
"DocScanMode": "shoot"
}Web SDK
Minimal request example
{
"ProductCode": "eKYC_PRO",
"MerchantBizId": "e0c34a77f5ac40a5a*****",
"MetaInfo": "{\"deviceType\":\"h5\"}",
"MerchantUserId": "user_hash_value",
"DocType": "GLB03001",
"ReturnUrl": "https://example.com/ekyc/callback"
}Complete request example
{
"ProductCode": "eKYC_PRO",
"SceneCode": "1234567890",
"MerchantBizId": "e0c34a77f5ac40a5aa5e6ed20c35****",
"MetaInfo": "{\"deviceType\":\"h5\",\"zimVer\":\"3.0.0\",\"appVersion\":\"1\",\"appName\":\"Chrome\",\"osVersion\":\"Windows 10\",\"deviceModel\":\"PC\"}",
"MerchantUserId": "user_hash_value_123",
"DocType": "GLB03001",
"Pages": "01",
"Model": "PHOTINUS_LIVENESS",
"DocVideo": "N",
"FaceAttributeCheck": "N",
"ShowGuidePage": "1",
"CallbackUrl": "https://www.aliyun.com/callback",
"CallbackToken": "NMjvQanQgplBSaEI0sL********",
"SecurityLevel": "02",
"Authorize": "F",
"IdThreshold": "2",
"IdSpoof": "Y",
"OcrValueStandard": "0",
"AutoDocPageConfig": "{\"BRA01001\": \"01\", \"BRA01002\": \"01,02\"}",
"LanguageConfig": "{\"languageContent\":{},\"ocrResultContent\":{},\"supportedLanguage\":[\"zh-CN\"],\"titleTranslate\":{}}",
"StyleConfig": "{\"guidepage\":{},\"ocrPage\":{},\"ocrResultPage\":[],\"facePage\":{}}",
"ShowAlbumIcon": "1",
"ShowOcrResult": "1",
"EditOcrResult": "1",
"ReturnUrl": "https://example.com/ekyc/callback",
"ProcedurePriority": "url"
}