Identity Information and Validity Period Verification API Integration Guide

This article introduces an Identity Information and Validity Period Verification API integration guide, which can be used to verify the authenticity and consistency of a name, ID card number, and ID card validity period.

Application Process

To use the Identity Information and Validity Period Verification API, first go to the Ace Data Cloud Console to obtain your API Token for later use.

If you have not yet logged in or registered, you will be automatically redirected to the login page to register and log in, and you will automatically return to the current page once finished.

An API Key for a general application can be used for services enabled for the account; a Key for a dedicated application can be used within that application's service scope. Please check the Key's permissions, validity period, and limits, and confirm that the application balance is sufficient to pay for this request. Available trial credits are subject to what is shown in your account; if the balance is insufficient, click the “Recharge” button.

📘 Full documentation: Identity Information and Validity Period Verification API →

Basic Usage

First, let's look at the basic usage: enter an ID card image link to obtain the processed verification result. First, you need to pass a name field, and then you can fill in the corresponding content on the interface, as shown below:

As you can see, we have set the Request Headers here, including:

  • accept: The desired format of the response result. Here it is set to application/json, meaning JSON format.
  • authorization: The key used to call the API, which can be selected directly from the drop-down list after application.

The Request Body is also set, including:

  • name: Name.
  • id_card: ID card number.
  • image_url: Link to the face image to be processed.
  • validity_end: ID card validity end date, in YYYYMMDD format; use “00000000” for long-term validity.
  • validity_begin: ID card validity start date, in YYYYMMDD format.
  • encryption: Optional encryption parameters for sensitive fields (if submitting ciphertext).

After making the selection, you can see that the corresponding code is also generated on the right, as shown below:

Click the “Try” button to test it. As shown above, we obtained the following result:

{
  "result": "0",
  "description": "一致"
}

The returned result contains multiple fields, described below:

  • result , the authentication result code, with billing as follows.
    • Billable result codes:
      • 0: The name and ID card number match
      • -1: The name and ID card number do not match
    • Non-billable result codes:
      • -2: Invalid ID card number (incorrect length, check digit, etc.)
      • -3: Invalid name (incorrect length, format, etc.)
      • -4: Document database service error
      • -5: No record of this ID card in the document database
      • -6: The authoritative verification system is being upgraded; please try again later
      • -7: The number of authentication attempts exceeds the daily limit.
  • description, the result of verifying the name and ID card number here.

It can be seen that the name, ID card number, and ID card validity period on the ID card are authentic and consistent.

In addition, if you want to generate the corresponding integration code, you can directly copy the generated code. For example, the CURL code is as follows:

curl -X POST 'https://api.acedata.cloud/identity/idcard/check-2e' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "name": "***",
  "id_card": "***",
  "validity_begin": "***",
  "validity_end": "***"
}'

The Python integration code is as follows:

import requests

url = "https://api.acedata.cloud/identity/idcard/check-2e"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "name": "***",
    "id_card": "***",
    "validity_begin": "***",
    "validity_end": "***"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

Error Handling

When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:

  • 400 token_mismatched: Bad request, possibly due to missing or invalid parameters.
  • 400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.
  • 401 invalid_token: Unauthorized, invalid or missing authorization token.
  • 429 too_many_requests: Too many requests, you have exceeded the rate limit.
  • 500 api_error: Internal server error, something went wrong on the server.

Error Response Example

{
  "success": false,
  "error": {
    "code": "api_error",
    "message": "fetch failed"
  },
  "trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}

Conclusion

Through this document, you have learned how to use the Identity Information and Validity Period Verification API to verify the authenticity and consistency of a name, ID card number, and ID card validity period. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.