This topic describes how to initiate an ID_OCR_PRO request by calling the InitializeV2 API operation.
API operation details
API operation: InitializeV2
Request method: HTTPS POST
Description: Before starting an authentication flow, call this API operation to obtain a transactionId. This ID links the API operations in the authentication request.
QPS limit: Each API has its own QPS limit. For more information, see QPS limits of ID Verification server-side APIs.
Service endpoints:
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 call this API operation in OpenAPI Explorer to debug the request, and generate SDK code examples.
Integration notes
TransactionId return condition: The TransactionId is returned only if the initialization is successful.
Authentication validity period: The client must complete the authentication within 30 minutes after obtaining the TransactionId or TransactionUrl.
Single use: A TransactionId can be used only once. After an authentication attempt, the ID immediately becomes invalid, regardless of whether the attempt succeeds, fails, or is canceled. An invalid ID cannot be reused to invoke the SDK. To initiate authentication again, you must obtain a new TransactionId from the server-side.
TransactionUrl limits: This field is returned only for mobile H5 scenarios. It can be used only once. Do not concatenate, modify, or repeatedly access the URL.
Authentication result retrieval: The CallbackUrl notification may be delayed due to network latency. After the client receives the authentication completion notification, it must call the server-side CheckResult API operation to retrieve the final authentication details. Do not rely solely on the callback notification or the result displayed on the page.
SDK feature differences: The App SDK and Web SDK have different features. For the Web SDK, there are also minor feature differences between mobile H5 and PC browsers. For details, see the integration documents.
Regional limits on certificate types: The supported certificate types vary by deployment region. Before integration, check the certificate type table for your destination region.
Request parameters
Field description
Integration method | Scenario | Initialization API operation response | Request parameters |
App SDK | Complete authentication within a native Android or iOS app. |
| Common parameters + App-specific parameters |
Web SDK | Authentication in a mobile H5 page or a PC browser. |
| Common parameters + Web SDK-specific parameters |
The fields are categorized as follows:
Common parameters: Can be passed for both integration methods.
App-specific: Used for the certificate scanning method.
Web SDK-specific: Used to control page redirects, language/UI, OCR pages, and H5 fallback behavior.
Request parameters (Common)
Field | Type | Required | Description | Example |
ProductCode | String | Yes | The product plan ID. Set the value to: ID_OCR_PRO. The user must complete certificate OCR. Note The Web SDK supports direct integration. For App integration, only Native SDK version 1.3.9 and later are supported. | ID_OCR_PRO |
SceneCode | String | No | A custom authentication scenario ID. You can use this ID to search for 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 unique business ID for the merchant. This ID is used for troubleshooting. It can be up to 32 characters long and can contain letters and digits. The server-side does not verify the uniqueness of this ID. The merchant must ensure its uniqueness. | 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 ID for the merchant, or another identifier such as a mobile phone number or email address. We recommend that you desensitize or hash this field in advance. | 123456789 |
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. If you set this parameter, it will be returned with the CallbackUrl for anti-replay and tamper-proofing checks. | NMjvQanQgplBSaEI0sL******** |
IdThreshold | String | No | OCR card quality check:
| 3 |
IdSpoof | String | No | [OCR configuration] Specifies whether to enable certificate anti-spoofing check:
To view the output, check | N |
OcrValueStandard | String | No | [OCR configuration] Specifies whether to return standardized OCR fields:
To view the output, check | 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] The certificate pages to collect:
Note Only some certificates support collecting multiple pages. For more information, see the 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. |
|
ShowGuidePage | String | No | [UI configuration] Specifies whether to show the guide page:
This configuration is not supported in PC browser mode. Supported in Native SDK version 1.2.8 and above. | 1 |
Request parameters (App-specific)
Only the native App SDK supports the following fields.
Field | Type | Required | Description | Example |
DocScanMode | String | No | [OCR configuration] The OCR certificate scanning mode:
This parameter is supported only by Native SDK 1.2.8 and later, and requires the automatic scanning component to be integrated. | shoot |
Request parameters (Web SDK-specific)
Only the Web SDK supports the following fields.
Field | Type | Required | Description | Example |
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 album upload entry during the OCR step:
| 1 |
ShowOcrResult | String | No | [OCR configuration] Specifies whether to show the recognition result page during the OCR step:
| 1 |
EditOcrResult | String | No | [OCR configuration] Specifies whether to allow users to edit the OCR recognition result:
| 1 |
ReturnUrl | String | Conditionally required | The business redirect URL after authentication ends. This parameter is not required when using iframe embedding mode. It should be provided for non-iframe page redirection scenarios. | https://www.alibabacloud.com |
ProcedurePriority | String | No | Specifies whether to allow a fallback method when a compatibility issue occurs during mobile H5 authentication.
| url |
Response data
Differences in response fields
Field | App SDK | Web SDK | Description |
RequestId / Code / Message | Yes | Yes | Common response information. |
Result.TransactionId | Yes | Yes | The unique ID for the authentication flow. This field is used for billing and as a request parameter for the |
Result.Protocol | Yes | Yes | The standard encrypted protocol for authentication. We recommend that you pass this through to the client SDK. The Web SDK iframe embedding method depends on this field. |
Result.TransactionUrl | No | Yes | The Web SDK authentication URL. After authentication, the user is redirected to the |
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 | The response code. For more information, see Server-side HTTP status codes. | Success | |
Message | String | A detailed description of the response 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. After authentication, the user is redirected based on the ReturnUrl request parameter. 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
Minimum request example
{
"ProductCode": "ID_OCR_PRO",
"MerchantBizId": "e0c34a77f5ac40a*****",
"MetaInfo": "{\"deviceType\":\"android\"}",
"MerchantUserId": "user_hash_value",
"DocType": "GLB03001"
}Complete request example
{
"ProductCode": "ID_OCR_PRO",
"MerchantBizId": "e0c34a77f5ac40a5aa5e6ed20c35****",
"MetaInfo": "{\"deviceType\":\"android\",\"zimVer\":\"3.0.0\",\"appVersion\":\"1\",\"bioMetaInfo\":\"4.1.0:1150****,0\",\"appName\":\"com.aliyun.antcloudauth\",\"osVersion\":\"Android 10\",\"apdidToken\":\"\",\"deviceModel\":\"Pixel 4\"}",
"MerchantUserId": "123456789",
"DocType": "GLB03001",
"SceneCode": "1234567890",
"CallbackUrl": "https://www.aliyun.com?callbackToken=100000****",
"CallbackToken": "NMjvQanQgplBSaEI0sL********",
"IdThreshold": "3",
"IdSpoof": "N",
"OcrValueStandard": "0",
"Pages": "01",
"ShowGuidePage": "1",
"DocScanMode": "shoot"
}Web SDK
Minimum request example
{
"ProductCode": "ID_OCR_PRO",
"MerchantBizId": "e0c34a77f5ac40a5a*****",
"MetaInfo": "{\"deviceType\":\"h5\"}",
"MerchantUserId": "user_hash_value",
"DocType": "GLB03001",
"ReturnUrl": "https://example.com/ekyc/callback"
}Complete request example
{
"ProductCode": "ID_OCR_PRO",
"MerchantBizId": "e0c34a77f5ac40a5aa5e6ed20c35****",
"MetaInfo": "{\"deviceType\":\"h5\",\"zimVer\":\"3.0.0\",\"appVersion\":\"1\",\"bioMetaInfo\":\"4.1.0:1150****,0\",\"appName\":\"com.aliyun.antcloudauth\",\"osVersion\":\"iOS 10.3.2\",\"apdidToken\":\"\",\"deviceModel\":\"iPhone9,1\"}",
"MerchantUserId": "123456789",
"DocType": "GLB03001",
"SceneCode": "1234567890",
"CallbackUrl": "https://www.aliyun.com?callbackToken=100000****",
"CallbackToken": "NMjvQanQgplBSaEI0sL********",
"IdThreshold": "3",
"IdSpoof": "N",
"OcrValueStandard": "0",
"Pages": "01",
"ShowGuidePage": "1",
"LanguageConfig": "{\"languageContent\":{},\"ocrResultContent\":{},\"supportedLanguage\":[\"zh\"],\"titleTranslate\":{}}",
"StyleConfig": "{\"guidepage\":{},\"ocrPage\":{},\"ocrResultPage\":[],\"facePage\":{}}",
"ShowAlbumIcon": "1",
"ShowOcrResult": "1",
"EditOcrResult": "1",
"ReturnUrl": "https://www.alibabacloud.com",
"ProcedurePriority": "url"
}