Aadhaar OCR API
EXTRACT TEXT FROM AADHAAR CARD IMAGES
Description
This API can extract and parse the text from an input Aadhaar document image and return the information in JSON format. This is an OCR based product which accepts Aadhaar document front and optionally back side images and returns the user information including name, date of birth, aadhaar number, virtual ID number, father's name, gender and address.

API Details
Request
Type | URL |
---|---|
Post | https://api.attestr.com/api/{version}/public/xtract |
Request Body Parameters
Type | Name | Description | Optional (Default) | Min Version | Max Version |
---|---|---|---|---|---|
String | src | Input Aadhaar front image media Id. To generate a media Id, refer to Image Media Upload | Required | v1 | |
String | additional | Optional media Id for the document back side image | Optional | v1 | |
String | type | Pass fixed value as 'UIDAI' | Required | v1 |
Request Header Parameters
Type | Name | Value / Description | Optional (Default) | Min Version | Max Version |
---|---|---|---|---|---|
String | Content-Type | application/json | Required | v1 | |
String | Authorization | Basic {authToken} | Required | v1 |
If you do not have the authentication token, please refer to Register App to generate one.
Sample Request
{
"src":"MX1AloEdDOB7Xgc00d",
"additional": null,
"type":"UIDAI"
}
Response
Http Status Code 200
Please note that the valid key decides the availability of rest of the keys in the response. If provided Aadhaar image is invalid or low quality, then all keys except valid and message are omitted. If true, remaining keys will have appropriate data.
Key | Description | Type | Min Version | Max Version |
---|---|---|---|---|
valid | True | false if the provided Aadhaar image is a valid readable Aadhaar document with decent quality | Boolean | v1 | |
data | The Aadhaar object as described below | Object | v1 | |
message | Message string if the input media image is invalid or of not enough good quality to be read by OCR algorithm | String | v1 |
Key | Description | Type | Min Version | Max Version |
---|---|---|---|---|
uuid | Aadhaar number if present on the card. | String | v1 | |
vid | Virtual ID if present on the card. | String | v1 | |
name | Name of the individual as printed on the Aadhaar card. | String | v1 | |
careOf | Care of (father, mother, husband, guardian etc) information as available on the Aadhaar card. | String | v1 | |
dob | Date of birth of the individual if available, In some versions of Aadhaar card, only year of birth is available | Date | v1 | |
gender | Gender of the individual | String | v1 | |
address | Complete address of the individual as printed on the document | String | v1 |
Sample Response
Sample response for valid Aadhaar document
{
"valid": true,
"message": null,
"data": {
"uuid": "7XXX 6XXX 6545",
"vid": "9128 XXXX 5584 5279",
"name": "Gitanjali Raheja",
"careOf": "D/O Ashok Raheja",
"dob": "25/03/1996",
"gender": "Female",
"address": "S/O Durga Prasad, Akividu, West Godavari, Andhra Pradesh - 534235"
}
}
Sample response for invalid document image
{
"valid": false,
"message": "Invalid / low quality image"
}
Error Response
Parameter | Type | Description |
---|---|---|
code | Number | Unique error codes for different errors. Always available. |
message | String | Error message describing the error. Always Available. |
details | String | Detail error message. Available only for certain types of errors. |
Error Codes
HTTP Status | Error Code | Error Message |
---|---|---|
400 | 4001 | Malformed data or missing required parameter values |
400 | 4005 | Operation could not be performed due to low credits balance |
401 | 4016 | Invalid client authorization |
403 | 4031 | Unauthorized access |
403 | 4035 | Requested service is not provisioned for your account |
403 | 4039 | Client's IP address is not whitelisted |
403 | 4035 | Requested service is not provisioned for your account |
429 | 4291 | Maximum account rate limit exceeded |
429 | 4292 | Maximum API rate limit exceeded |
429 | 4293 | Maximum account daily limit exceeded |
429 | 4294 | Maximum API daily limit exceeded |
500 | 5001 | Request could not be processed |
Sample Error Response
{
"code": 4001,
"message": "Malformed data or missing required parameter values"
}
Constraints
- Only JPEG, PNG images are supported.
- Minimum image size is 200x200 png for better identification and parsing.
- Maximum allowed image size is 10 MB.