Skip to main content
This document will introduce an ID card recognition and information verification API integration instruction, which can verify the authenticity and consistency of the name and ID card number by inputting an ID card image or the name and ID card number. This interface is used to verify the authenticity and consistency of the name and ID card number, and you can provide the required verification information by inputting the name and ID card number or by submitting a photo of the ID card’s portrait side.

Application Process

To use the API, you need to first apply for the corresponding service on the ID Card Recognition and Information Verification API page. After entering the page, click the “Acquire” button, as shown in the image below: If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page. Upon your first application, there will be a free quota provided, allowing you to use the API for free.

Basic Usage

First, understand the basic usage method, which is to input the ID card image link to obtain the processed verification result. You need to simply pass a image_url field, and we can then fill in the corresponding content on the interface, as shown in the image below:

Here we can see that we have set the Request Headers, including:
  • accept: the format of the response result you want to receive, here filled in as application/json, which is in JSON format.
  • authorization: the key to call the API, which can be directly selected after application.
Additionally, the Request Body is set, including:
  • image_url: the link to the ID card image that needs to be processed.
  • encryption: optional, sensitive field encryption parameter (if you need to send encrypted data).
After selection, you can find that the corresponding code is also generated on the right side, as shown in the image below:

Click the “Try” button to conduct a test, as shown in the image above, and we obtained the following result:
{
  "result": "0",
  "description": "The name and ID card number are consistent",
  "name": "ID card name",
  "id_card": "ID card number",
  "sex": "ID card gender",
  "nation": "ID card nationality",
  "birth": "ID card birthday",
  "address": "ID card home address"
}
The returned result contains multiple fields, described as follows:
  • result, the authentication result code, with the following charging situation.
    • Charging result codes:
      • 0: The name and ID card number are consistent
      • -1: The name and ID card number are inconsistent
    • Non-charging result codes:
      • -2: Illegal ID card number (length, check digit, etc. are incorrect)
      • -3: Illegal name (length, format, etc. are incorrect)
      • -4: Document database service exception
      • -5: No record of this ID card in the document database
      • -6: The authoritative comparison system is being upgraded, please try again later
      • -7: The number of authentications has exceeded the daily limit.
  • description, the result of the verification of the name and ID card number.
  • name, the name information in the ID card, which will be empty if the ID card image is not uploaded.
  • id_card, the ID card number information in the ID card, which will be empty if the ID card image is not uploaded.
  • sex, the gender information in the ID card, which will be empty if the ID card image is not uploaded.
  • nation, the nationality information in the ID card, which will be empty if the ID card image is not uploaded.
  • birth, the birthday information in the ID card, which will be empty if the ID card image is not uploaded.
  • address, the home address information in the ID card, which will be empty if the ID card image is not uploaded.
It can be seen that the name and ID card number information in the ID card is consistent and valid, and other information has also been extracted and displayed using OCR technology. Additionally, if you want to generate the corresponding integration code, you can directly copy it, for example, the CURL code is as follows:
curl -X POST 'https://api.acedata.cloud/identity/idcard/ocr' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "image_url": {image_url}
}'
The Python integration code is as follows:
import requests

url = "https://api.acedata.cloud/identity/idcard/ocr"

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

payload = {
    "image_url": {image_url}
}

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

Custom Information Verification

We also provide a way to verify without disclosing ID card image information, which allows you to only pass in the name name and ID card number id_card to verify the authenticity and consistency of the name and ID card number. Below is the specific information filled in:

After clicking run, the following result is obtained:
{
    "address": "",
    "birth": "",
    "description": "The name and ID card number are consistent",
    "id_card": "ID card number",
    "name": "ID card name",
    "nation": "",
    "result": "0",
    "sex": ""
 }
From the result, it can be seen that no other private information is disclosed, and it can also complete the verification of the authenticity and consistency of the name and ID card number.

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 ID card recognition and information verification API to verify the authenticity and consistency of the name and ID card number based on the input image or name and ID card number information. We hope this document can help you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.