/ocr/indian_card

1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample

1.API Specification

This API is used to recognize Indian aadhaar card or pan card, and extract the key information.

Aadhaar card (2 calls) - Front and back

Pan (1 call) - Front

Image spec

1. Format: JPG(JPEG), PNG, e-aadhaar(PDF)
2. Between 128*128 and 6000*6000 (pixels), Recommended resolution: 1280*1280
3. File size: no larger than 5 MB

Request Method

POST

Request URL

https://cloudapi.accuauth.in/ocr/indian_card

Debugging Tool

Debugging Tool

2.Request Params

2.1 Request Header

Parameter Type Required Description
X-DF-API-ID string Yes For API credentials,Please visit API Request
X-DF-API-SECRET string Yes For API credentials,Please visit API Request

2.2 Request Body

Fields Type Description
optional file file Binary data of the image
optional image_base64 string Base64 encoded data of image
optional file_type string File type: pdf / image, default is image, now we only support pdf format from UIDAI Website
optional file_password string PDF file password
optional detect_face int Face detection option, 1: enable face detection, 0: disable face detection. API will return the face_region field if the above mentioned value is enabled.
optional detect_image_quality int Image quality detection option, 1: enable, 0: disable. API will return the detect_image_quality field if the above mentioned value is enabled.

Either parameter file or image_base64 must be provided as a request parameter.

You MUST add image stream to multipart/form-data section of POST message when using file parameter.

3.Response Params

Fields Type Description
request_id string Unique id of each request
status string Response status, OK if request success, other if failed; See Error Codes for details
image_quality float Image quality score [0.0-1.0], the greater of the value the higher image quality
results array The array of card ocr results,See results belowed for details
Elements in results:
Fields Type Description
card_type string The type of card: aadhaar_card or pan_card
card_side string The side of card: front or back
card_info object The key infomation of card
face_region array Four point coordinates of face rect, format as: [(x1, y1), (x2, y2), (x3, y3), (x4, y4)]; The coordinate is based on the original image, while the points order is based on the face after rotation(top left, top right, bottom right, bottom left).
card_region* array Deprecated field, only for backward compatibility.
Elements in the card_info
  • Front side of aadhaar card info:
Fields Type Description
card_no string Aadhaar card number
name string Name
gender string Gender, Male or Female
mother_name string Mother's name
father_name string Father's name
date_type string The type of date_info,DOB(day of birth) orYOB(year of birth)
date_info string Date string, the date format of DOB is DD/MM/YYYY or DD-MM-YYYY; while YOB is YYYY.
phone_number string Telephone number
vid string Virtual ID
  • Back side of aadhaar card info:
Fields Type Description
card_no string Aadhaar card number
vid string Virtual ID
son_of string Son of document holder
daughter_of string Daughter of document holder
care_of string Care of document holder
wife_of string Wife of document holder
husband_of string Husband of document holder
city string City
state string State
pin string Postcode
address string The complete address
address_line_one string The first line of address
address_line_two string The second line of address
  • Front side of pan card info:
Fields Type Description
card_no string Account number
name string The name
father_name string Father's name
date_type string The type of date_info,DOB(day of birth) orYOB(year of birth); the date format of DOB is DD/MM/YYYY; while YOB is YYYY.
date_info string The date string
issue_date string Date of issue

Response Syntax
  • Front side of aadhaar card
{
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
  "status": "OK",
  "image_quality": 0.771,
  "results": [{
     "card_side": "front",
     "card_type": "aadhaar_card",
     "card_info":{
       "name": "***",
       "gender": "Male",
       "mother_name": "",
       "father_name": "***",
       "date_type": "DOB",
       "date_info": "1982-03-15",
       "card_no": "XXXXXXXXX801",
       "vid": "XXXXXXXXXXXX8291",
       "phone_number": "XXXXXXXXXX"
      },
      "face_region": [
         [15, 460],
         [185, 460],
         [185, 666],
         [15, 666]
     ],
      "card_region": [
       [32, 241],
       [599, 241],
       [599, 556],
       [32, 556]
     ]
  }]
}
  • Back side of aadhaar card
{
  "request_id": "TIDbf966570c8804c1586e06aaddd0738d8",
  "status": "OK",
  "image_quality": 0.771,
  "results": [{
     "card_side": "back",
     "card_type": "aadhaar_card",
     "card_info": {
        "address": "C/O : Sarangdhar Baburao ***",
         "address_line_one": "67,asangaon, ***",
        "address_line_two": "main rode ***, ***",
        "card_no": "4964 XXXX XXXX",
        "care_of": "***",
        "city": "Jalna",
        "daughter_of": "",
        "husband_of": "",
        "pin": "XXXXXX",
        "son_of": "",
        "state": "Maharashtra",
        "vid": "",
        "wife_of": ""
     },
     "card_region": [
       [32, 241],
       [599, 241],
       [599, 556],
       [32, 556]
     ]
  }]
}
  • Front side of pan card
{
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
  "status": "OK",
  "image_quality": 0.771,
  "results": [{
     "card_side": "front",
     "card_type": "pan_card",
     "card_info":{
       "card_no": "XXXXX2601P",
       "name": "***",
       "father_name": "***",
       "date_type": "DOB",
       "date_info": "15/03/1982",
       "issue_date": "2003-06-08"
      },
      "face_region": [
         [15, 460],
         [185, 460],
         [185, 666],
         [15, 666]
       ]
      "card_region": [
       [32, 241],
       [599, 241],
       [599, 556],
       [32, 556]
     ]
  }]
}

4.Error Codes

Common error codes of this API:

Http Status Code Status field Description
400 INVALID_ARGUMENT Request parameter is invalid
400 DETECTION_FAILED Detect image failed
401 UNAUTHORIZED Unauthorized or access is denied
401 KEY_EXPIRED Your API ID has expired
403 NO_PERMISSION You are not authorized to use this API
403 OUT_OF_QUOTA API calls quota exceeded
403 RATE_LIMIT_EXCEEDED API request frequency exceeds the limit
404 NOT_FOUND Requested API cannot be found
500 INTERNAL_ERROR Internal server error

Comment: Please see the reason field for details when the above 40X error occurred

Response Syntax
{
  "status": "INVALID_ARGUMENT",
  "reason": "must specify 'file' or 'image_base64' argument",
  "request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}

5.Sample

results matching ""

    No results matching ""