Guidance for Using the Unified ID Card OCR API

Introduction
The Unified ID Card OCR API enables users to upload images of identity cards and retrieve the information contained on them. The API supports various card types, such as ID cards, passports, and driving licenses. This guide will help you integrate and use the API effectively.

Step-by-Step Guide to Integrate the Unified ID Card OCR API

1. Obtain API Access Token
Before making any API requests, you need to authenticate by generating a token using your accessKey, secretKey, and a timestamp. Here's an example of how to obtain the access token:

curl -X POST \ -H "Content-Type: application/json" \ -d '{"accessKey":"your_access_key","signature":"your_signature","timestamp":1665993522952,"periodSecond":3600}' \ "https://api.advance.ai/openapi/auth/ticket/v1/generate-token"

2. Prepare the Unified ID Card OCR Request
Once you have the access token, you can submit your request to scan the ID card. Here’s an example request using curl:

curl -X POST \ -H 'X-ACCESS-TOKEN: {Your Access Token}' \ -H 'Content-Type: multipart/form-data' \ -F 'region="ID"' \ -F 'cardType="ID_CARD"' \ -F 'frontFile=@"/path/to/front.jpg"' \ -F 'backFile=@"/path/to/back.jpg"' \ -F 'returnEmpty="false"' \ "https://api.advance.ai/intl/openapi/face-identity/v4/unified-id-card-ocr"

3. Key Parameters for the API Request

  • X-ACCESS-TOKEN: Your API token.
  • region: The region where the service is available (e.g., "ID" for Indonesia).
  • cardType: The type of card (e.g., ID_CARD, PASSPORT, DRIVING_LICENSE).
  • frontFile: The image of the front side of the card.
  • backFile: The image of the back side of the card.
  • returnEmpty: Set to false if you only want fields with values returned, or true to receive all fields.

4. Handle the API Response
A successful response will return data from the scanned card, such as the ID number, full name, date of birth, expiry date, and other relevant details. Here is an example response:

{ "code":"SUCCESS", "message":"OK", "data": { "front": { "idNumber":"123456789", "fullName":"John Doe", "expiryDate":"2029/12/31", "gender":"MALE", "nationality":"ID", "address":"1234 Street Name", ... }, "back": { ... } }, "transactionId":"abcdef123456", "pricingStrategy":"PAY" }

5. Best Practices for Image Quality
To ensure the OCR works properly, make sure that:

  • Images are in PNG, JPG, or JPEG format.
  • The file size is below 2 MB.
  • The resolution is between 256x256 and 4096x4096 pixels.
  • The card is captured clearly without any obstructions, light spots, or tilts.

Conclusion
By following this guide, you can successfully integrate the Unified ID Card OCR API into your system for fast and accurate card scanning.

 

Further Assistance

If you continue to experience issues despite following the guidelines provided, please contact our support team for further assistance:

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.