This topic describes how to call the CheckResult operation to retrieve the authentication result from the ID document OCR solution.
API description
Operation name: CheckResult
Request method: HTTPS POST
Description: After you receive a callback notification, call this operation on your server to obtain the authentication result.
ImportantBy default, ID Verification service results are stored for 30 days. After this period, the system automatically deletes them. You must query the authentication results within 30 days of completing the authentication.
This API is subject to an exclusive queries per second (QPS) limit. For more information, see ID Verification server-side API QPS limits.
Endpoints:
NoteAn internal network is a private communication network for Alibaba Cloud products within the same region. If your application server is deployed in an Alibaba Cloud region, you can use the VPC endpoint to access the ID Verification service for a more secure and stable network connection.
China (Hong Kong)
Public endpoint:
cloudauth-intl.cn-hongkong.aliyuncs.comVPC endpoint:
cloudauth-intl-vpc.cn-hongkong.aliyuncs.com
Online debugging and integration
Before you debug and integrate, read Use OpenAPI Explorer to debug and integrate server-side API operations. This document explains how to call API operations on the OpenAPI platform and how to obtain the SDK and its sample code.
In OpenAPI Explorer, you can debug this operation and generate SDK sample code.
Request parameters
Name | Type | Required | Description | Example |
MerchantBizId | String | Yes | A unique business ID that you customize to track and troubleshoot issues. The ID can be a combination of up to 32 letters and digits. Make sure that the ID 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**** |
TransactionId | String | Yes | The unique identifier for the entire authentication process. Obtain this value by calling the Initialize API operation. Important To prevent tampering threats, this value must be the TransactionId stored on your server from the Initialize API operation call. We do not recommend using the TransactionId from the client-side callback. | hksb7ba1b28130d24e015d6******** |
IsReturnImage | String | No | Specifies whether to return the authentication image.
| Y |
Response parameters
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 | The detailed description of the response code. | success | |
Result.Passed | String | The final authentication result. Valid values:
| Y | |
Result.SubCode | String | The description of the authentication result. For more information, see ResultObject.SubCode error codes. | 200 | |
Result.ExtIdInfo | String | The information about the ID document OCR result. For information about the JSON format, see the example on the right. For more information, see ExtIdInfo. | | |
ExtIdInfo
Name | Type | Description | Example |
ocrIdPassed | String | The final result of the ID document OCR phase. Valid values:
| N |
idImage | String | The ID document OCR photo in Base64 format. This field is returned if you set the isReturnImage parameter to Y in the request and the ID document OCR process is successfully completed. | base64 |
ocrIdInfo | String | The field information from the ID document OCR. For more information, see OCR result fields. Note If the ID document OCR process fails, this field is empty. | |
spoofInfo | String | The result of the ID document anti-spoofing check. The result includes the risk decision and risk type. Note ID document anti-spoofing is enabled only when you set IdSpoof to Y in the Initialize operation. Otherwise, spoofResult defaults to N and spoofType is empty.
| |
ocrIdEditInfo | String | The ID document OCR field information that the user submits after editing it on the OCR result page. This parameter is returned if the client is configured to enable the OCR result editing page (ShowOcrResult). Note For web SDK integration, configure ShowOcrResult in the server-side Initialize operation. | |
idBackImage | String | The OCR photo of the back of the ID document, in Base64 format. Note This field is returned if you set the isReturnImage parameter to Y in the request and the ID document OCR process is successfully completed. | base64 |
ocrIdBackInfo | String | The OCR field information from the back of the ID document. Important If the ID document OCR process fails, this field is empty. | |
spoofBackInfo | String | The result of the anti-spoofing check for the back of the ID document. The result includes the risk decision and risk type. Note ID document anti-spoofing is enabled only when you set IdSpoof to Y in the Initialize operation. Otherwise, spoofResult defaults to N and spoofType is empty.
Note This is an algorithm prediction result. This field may not be returned. We recommend that you avoid setting a dependency on this field in your business logic. | |
Response codes
HTTP status code | Code | Message |
200 | Success | Request successful. |
400 | MissingParameter | Parameter cannot be empty. |
InvalidParameter | Invalid parameter. | |
TransactionIdInvalid | Invalid Transaction ID. | |
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. | |
404 | ProcessNotCompleted | The entire authentication process is not completed. |
500 | InternalError | Internal system error. Provide feedback to engineers for troubleshooting. |
ResultObject.SubCode error codes
Subcode is returned based on different product solutions or integration methods. For details, refer to the following table.
Applicable solution | Error code | Is authentication record billed | Description and suggested reasons |
General | 200 | Yes | Authentication passed. |
| 211 | Yes | The quality or resolution of the certificate image does not meet requirements, or the image itself is incomplete. Ensure the photo of the certificate's portrait side is clear, has normal exposure, is complete without occlusion, and has no significant angle deviation. |
| 212 | Yes | Certificate anti-counterfeiting detection indicates risk. There may be high-risk operations such as rephotographing, tampering, or photocopying. |
| 213 | Yes | The specified certificate type was not detected (recognition mode) or the certificate type could not be identified (classification mode). We recommend uploading a clear, complete certificate image with normal angle. |
OCR result fields
Hong Kong Identity Card
Both the 2003 and 2018 versions of the smart identity card are supported.
Field | Type | Description |
name | String | Name |
englishName | String | Name (English) |
nameCode | String | Telecode for Chinese Name |
sex | String | Sex. Valid values:
|
birthDate | String | Date of birth |
idNumber | String | Identity card number |
currentIssueDate | String | Date of registration |
firstIssueDate | String | Month and year of first registration |
isPermanent | String | Indicates whether it is a permanent identity card. Valid values:
|
symbols | String | Symbol mark. Example: "**AZ". |
Exit-Entry Permit for Travelling to and from Hong Kong and Macao
Field | Type | Description |
name | String | Name |
englishName | String | Name (Pinyin) |
sex | String | Sex |
birthDate | String | Date of birth |
idNumber | String | Certificate number |
issueDate | String | Date of issue |
expiryDate | String | Date of expiry |
placeOfIssue | String | Place of issue |
originOfIssue | String | Issuing authority |
Mainland Travel Permits for Hong Kong and Macao Residents
Field | Type | Description |
name | String | Name |
englishName | String | Name (English) |
sex | String | Sex |
birthDate | String | Date of birth |
idNumber | String | Certificate number |
issueDate | String | Date of issue |
expiryDate | String | Date of expiry |
originOfIssue | String | Issuing authority |
Global Passport
For this ID document type, the service recognizes the content of the machine-readable zone (MRZ) in International Civil Aviation Organization (ICAO)-compliant e-passports and outputs the passport fields in a standardized format. This approach prevents compatibility issues that can be caused by different data page formats across various countries.
Field | Type | Description |
surname | String | Surname (in Latin script, based on MRZ recognition) |
givenname | String | Given name (in Latin script, based on MRZ recognition) |
sex | String | Sex (F or M) |
birthDate | String | Date of birth (in yyyy-mm-dd format) |
passportNo | String | Passport number |
nationality | String | Nationality (3-digit country code) |
expiryDate | String | Date of expiry (in yyyy-mm-dd format) |
countryCode | String | Country code of the passport issuing authority (3-digit coun Country code |
Macao Resident Identity Card
Field | Type | Description |
surnameCN | String | Surname (Chinese) |
givennameCN | String | Given name (Chinese) |
surname | String | Surname (English) |
givenname | String | Given name (English) |
sex | String | Sex |
birthDate | String | Date of birth |
idNumber | String | Certificate number |
expiryDate | String | Date of expiry |
placeOfBirth | String | Place of birth code. Example: "AS". |
Mainland Travel Permit for Taiwan Residents
Field | Type | Description |
name | String | Name |
englishName | String | Name (Pinyin) |
sex | String | Sex |
birthDate | String | Date of birth |
idNumber | String | Certificate number |
issueDate | String | Date of issue |
expiryDate | String | Date of expiry |
originOfIssue | String | Issuing authority |
placeOfIssue | String | Place of issue |
People's Republic of China Resident Identity Card
Field | Type | Description |
name | String | Name |
sex | String | Sex |
ethnicity | String | Ethnicity |
birthDate | String | Date of birth |
idNumber | String | ID card number |
address | String | Address |