This topic describes how to integrate ID Verification using server-side API calls.
API information
API operation: EkycVerifyV2
Request method: HTTPS POST
Operation description: You can call this operation and specify information such as an image to perform an electronic KYC (eKYC) verification.
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.
China (Hong Kong)
Public endpoint:
cloudauth-intl.cn-hongkong.aliyuncs.comInternal endpoint:
cloudauth-intl-vpc.cn-hongkong.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.
In OpenAPI Explorer, you can directly run this API for debugging and generate an SDK code example.
Image requirements
Image format: JPG, JPEG, or PNG.
Image size: The recommended size is 50–100 KB, with a maximum of 1 MB.
Image resolution: Between 640×480 and 1920×1080 (height × width). For best results, we recommend scaling the shorter side to 720 pixels with a compression ratio greater than 0.9. Prefer portrait-oriented images (height greater than width), as landscape images can reduce detection accuracy.
NoteConverting an image to base64 format increases its data size. When passing an image as base64, ensure the original file is no larger than 0.6 MB to stay within the 1 MB data transfer limit.
Image quality recommendations:
The face must be complete, clear, unobstructed, and facing the camera directly. For best results, use images from a front-facing camera.
The face should occupy more than 60% of the image area, as smaller faces can reduce detection accuracy.
If an image contains multiple faces, the algorithm processes the largest one by default. Avoid using images with multiple faces.
Request parameters
Parameter | Type | Required | Description | Example |
ProductCode | String | Yes | The solution that you want to use. Set the value to eKYC_MIN. | eKYC_MIN |
SceneCode | String | No | A custom ID for the verification scenario, used to query related records in the ID Verification console. The ID can be up to 10 characters long and can contain letters, digits, and underscores (_). | 1234567890 |
MerchantBizId | String | Yes | The unique identifier of your business, which is used for troubleshooting. You can specify a custom value that is 32 characters in length and contains letters and digits. Make sure that the value is unique. | e0c34a77f5ac40a5aa5e6ed20c35**** |
MerchantUserId | String | Yes | The ID of a customer. You can specify a custom value, such as a mobile phone number or an email address. Before you specify a custom value, we recommend that you perform data masking. For example, you can perform hashing. | Y |
DocType | String | Yes | The document type. You can specify an 8-digit value to uniquely identify a document type. For more information, see Document types. | 01000000 |
DocName | String | No | The real name of the customer. Note When
If the preceding conditions are met, the following logic applies. If you provide only | Alice |
DocNo | String | No | The ID card number of the customer. Note When
If the preceding conditions are met, the following logic applies. If you provide only | 411xxxxxxxxxxx0001 |
IdOcrPictureBase64 | String | No Note You can choose any one of the three upload methods. | The Base64-encoded document image. Note If you upload an image by using the IdOcrPictureBase64 parameter, check the size of the image. Do not specify an image whose size is excessively large. | Base64-encoded content |
IdOcrPictureUrl | String | The URL of the document image. The URL can be an HTTP or HTTPS URL that can be accessed over the Internet. | https://*** | |
IdOcrPictureFile | InputStream | ID document image file stream. | For specific integration methods, see File uploads with the Advance interface. | |
FacePictureBase64 | String | No Note You can choose any one of the three upload methods. | The Base64-encoded face image. Note If you upload an image by using the FacePictureBase64 parameter, check the size of the image. Do not specify an image whose size is excessively large. | Base64-encoded content |
FacePictureUrl | String | The URL of the face image. The URL can be an HTTP or HTTPS URL that can be accessed over the Internet. | https://*** | |
FacePictureFile | InputStream | File stream of the portrait image. | For specific integration methods, see File uploads with the Advance interface. | |
Crop | String | No | Specifies whether to crop the face from the image:
| F |
Authorize | String | No | Specifies whether to enable verification against an official database:
Note This parameter supports only second-generation ID cards for residents in the Chinese mainland. | F |
IdThreshold | String | No | OCR card quality check:
| 3 |
IdSpoof | String | No | Specifies whether to enable ID document anti-spoofing detection. Valid values:
| Y |
Document types
DocType | Document |
01000000 | Passports (global) |
00000006 | ID cards (Hong Kong (China)) (2003 version) |
00000008 | ID cards (Hong Kong (China)) (2018 version) |
00000007 | Exit-entry Permit for Travelling to and from Hong Kong and Macao |
00000009 | Mainland Travel Permit for Hong Kong and Macao Residents |
000000011 | ID cards (Macao (China)) |
000000012 | Mainland Travel Permit for Taiwan Residents |
00000001 | Second-generation ID cards for residents in the Chinese mainland |
Response parameters
Parameter | Type | Description | Example | |
HTTP Status Code | Integer | The HTTP status code. | 200 | |
HTTP Body | RequestId | String | The request ID. | 130A2C10-B9EE-4D84-88E3-5384FF0**** |
Code | String | Return code: For more information, see Server-side HTTP status codes. | Success | |
Message | String | A detailed description of the returned error code. | success | |
Result.Passed | String | The final verification result. Valid values:
| Y | |
Result.SubCode | String | A description of the verification result. For more information, see ResultObject.SubCode error codes. | 200 | |
Result.ExtFaceInfo | String | The result of face liveness verification. The value is in the JSON format. For more information, see ExtFaceInfo. | | |
Result.ExtIdInfo | String | The result of document verification. The value is in the JSON format. For more information, see ExtIdInfo. | | |
Codes of ResultObject.SubCode
Code | Billed | Description and cause |
200 | Yes | The customer passed the verification. |
201 | Yes | The name does not match the ID card in the official database. The information about the customer is incorrect or fake. The customer can check the information and perform the verification again. Note This error code is returned only when the certificate type verified by the product is a Chinese ID card and the authoritative verification feature is enabled. |
202 | Yes | The information about the customer cannot be queried in the official database. We recommend that you reserve an entry point to manual review. Note This error code is returned only when the certificate type verified by the product is a Chinese ID card and the authoritative verification feature is enabled. |
203 | Yes | No image is queried or the image is unavailable. Possible cause: No library image is saved in the authoritative comparison source. We recommend that you reserve an entry point to manual review. |
204 | Yes | The document face does not match the live face. A possible reason is that the faces belong to different live persons or the quality of the live face is poor. |
205 | Yes | The results of liveness detection show risks. |
207 | Yes | The uploaded face does not match the face in the official database. This could mean the faces belong to different people or the quality of the submitted face image is poor. Note This error code is returned only when the certificate type verified by the product is a Chinese ID card and the authoritative verification feature is enabled. |
209 | Yes | An exception occurs in the authoritative comparison source. Note This error code is returned only when the certificate type verified by the product is a Chinese ID card and the authoritative verification feature is enabled. |
212 | Yes | The results of anti-counterfeiting detection on documents show risks, such as photos and copies of documents and documents that are tampered with. |
ExtFaceInfo
Parameter | Type | Description | Example |
facePassed | String | Indicates whether the customer passed the face liveness verification. Valid values:
| Y |
faceComparisonScore | Double | The score of comparison between the collected face and document face. Valid values: 0 to 100. | 99.99 |
faceAttack | String | Indicates if a liveness attack was detected on the submitted face:
| N |
authorityComparisonScore | Double | The comparison score between the collected face and the authoritative comparison source. Valid values: 0 to 100. | 99.99 |
ExtIdInfo
Parameter | Type | Description | Example |
idPassed | String | Indicates whether the customer passes the document verification. Document verification also refers to document optical character recognition (OCR). Valid values:
| N |
ocrIdInfo | String | The fields that are returned by document verification. Note If the document verification failed, this parameter is empty. | |
spoofInfo | String | The result of document anti-spoofing detection, including the risk decision and risk types: Note Anti-spoofing detection is enabled only when IdSpoof = T. Otherwise, spoofResult returns N, and spoofType is empty.
| |