This topic describes how to use the CheckResult API operation to query the authentication results of the ID document OCR solution.
API description
API operation: CheckResult
Endpoint: cloudauth-intl.cn-hongkong.aliyuncs.com
Request method: HTTPS POST
Description: After you receive a callback notification, use this API operation on the server to retrieve the authentication results.
QPS limit: This API is subject to an exclusive queries per second (QPS) limit. For more information, see ID Verification server-side API QPS limits.
Online debugging and integration
Before you debug and integrate, read the Use OpenAPI Explorer to debug and integrate server-side API operations document. It explains how to call API operations on the OpenAPI platform and how to obtain the SDK and its sample code.
You can go to OpenAPI Explorer to debug this API operation and generate SDK code examples.
Request parameters
Name | Type | Required | Description | Example |
MerchantBizId | String | Yes | A unique business identifier that you customize to track and troubleshoot issues. The identifier can be a combination of letters and digits up to 32 characters long. Make sure the identifier is unique. Note Alibaba Cloud servers do not check the uniqueness of this field. For better tracking, ensure that the value of this field is unique. | 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 images.
| 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 | A detailed description of the returned code. | success | |
Result.Passed | String | The final authentication result. Valid values:
| Y | |
Result.SubCode | String | A description of the authentication result. For more information, see | 200 | |
Result.ExtIdInfo | String | Information about the ID document OCR recognition result. For 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 recognition stage:
| N |
idImage | String | The ID document OCR photo in Base64 format. For example, if you set the isReturnImage parameter to Y when you initiate the API request and the ID document OCR process is complete, this field is returned. | base64 |
ocrIdInfo | String | The ID document OCR field information. For more information, see OCR recognition response fields. Note If the ID document OCR process fails, the value of this field is empty. | |
spoofInfo | String | The result of the anti-spoofing check for the ID document, which includes the risk assessment result and risk type. Note The ID document check is enabled only when IdSpoof is set to Y in the Initialize API operation. Otherwise, spoofResult returns N by default and spoofType is empty.
| |
ocrIdEditInfo | String | The ID document OCR field information submitted by the user after editing on the OCR result page. This field is returned when the OCR result editing page (ShowOcrResult) is enabled in the client configuration. | |
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 when you initiate the API request and the ID document OCR process is completed. | base64 |
ocrIdBackInfo | String | The OCR field information from the back of the ID document. Important If the ID document OCR process fails, the value of this field is empty. | |
spoofBackInfo | String | The result of the anti-spoofing check for the ID document, which includes the risk assessment result and risk type. Note The ID document check is enabled only when IdSpoof is set to Y in the Initialize API operation. Otherwise, spoofResult returns N by default and spoofType is empty.
Note This is an algorithm prediction. The field may not be returned. Avoid setting a required dependency on this field for your business. | |
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. |
Error codes for ResultObject.SubCode
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. |
Field returned by document recognition
Hong Kong (China) Identity Card
Both the 2003 and 2018 versions of smart identity cards are supported.
Field | Type | Description |
name | String | The name. |
englishName | String | The name in English. |
nameCode | String | The Chinese name code. |
sex | String | The gender. Valid values:
|
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
currentIssueDate | String | The date of registration. |
firstIssueDate | String | The month and year of first registration. |
isPermanent | String | Indicates whether the identity card is a permanent resident identity card. Valid values:
|
symbols | String | The remarks. Example: "***AZ". |
Exit-Entry Permit for Traveling to and from Hong Kong and Macao
Field | Type | Description |
name | String | The name. |
englishName | String | The romanized name. |
sex | String | The gender. |
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
issueDate | String | The issuance date. |
expiryDate | String | The expiration date. |
placeOfIssue | String | The issuance place. |
originOfIssue | String | The issuance authority. |
Mainland Travel Permit for Hong Kong and Macao Residents
Field | Type | Description |
name | String | The name. |
englishName | String | The romanized name. |
sex | String | The gender. |
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
issueDate | String | The issuance date. |
expiryDate | String | The expiration date. |
originOfIssue | String | The issuance authority. |
Mainland Travel Permit for Taiwan Residents
Field | Type | Description |
name | String | The name. |
englishName | String | The romanized name. |
sex | String | The gender. |
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
issueDate | String | The issuance date. |
expiryDate | String | The expiration date. |
originOfIssue | String | The issuance authority. |
placeOfIssue | String | The issuance place. |
Global passport
Field | Type | Description |
surname | String | The surname. |
givenname | String | The given name. |
sex | String | The gender. |
birthDate | String | The date of birth. |
passportNo | String | The passport number. |
nationality | String | The nationality. |
expiryDate | String | The expiration date. |
countryCode | String | The country code. |
Macao (China) Resident Identity Card
Field | Type | Description |
surnameCN | String | The surname in Chinese. |
givennameCN | String | The given name in Chinese. |
surname | String | The surname in English. |
givenname | String | The given name in English. |
sex | String | The gender. |
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
expiryDate | String | The expiration date. |
placeOfBirth | String | The code of the birthplace. Example: "AS". |
People's Republic of China Resident Identity Card
Field | Type | Description |
name | String | The name. |
sex | String | The gender. |
ethnicity | String | The ethnicity. |
birthDate | String | The date of birth. |
idNumber | String | The ID card number. |
address | String | The address. |
province | String | The province of residence. Note This is a reserved field and is empty by default. |
city | String | The city of residence. Note This is a reserved field and is empty by default. |
originOfIssue | String | The issuance authority. |
issueDate | String | The issuance date. |
expiryDate | String | The expiration date. |