VOTER ID CARD OCR API
EXTRACT TEXT FROM INDIAN VOTER ID DOCUMENT IMAGE
Description
This API can extract and parse the text from an input Indian Voter card document image and return the information in JSON format. Both old and new card formats are supported.

API Outcome
- Voter Registration Number
- Name of the individual
- Father / mother / spouse name
- Date of birth / Age as available
- Address of the individual if available
- Gender information
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 image media Id of the front side of the document. To generate a media Id, refer to Image Media Upload | Required | v1 | |
String | additional | Optional. Media Id for the back side image of the document. | Optional | v1 | |
String | type | Document type. Use value as VOTER for Voter Id. | 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":"MX1AloGHE4B7Xgc89h",
"type":"VOTER"
}
Response
Http Status Code 200
Please note that the valid key decides the availability of rest of the keys in the response. If provided PAN 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 document image is a valid readable document with decent quality | Boolean | v1 | |
message | Message string if the input media image is invalid or of not enough good quality to be read by OCR model | String | v1 | |
data | VoterCard data object as described below. | Object | v1 |
Voter Card Data Object
Key | Description | Type | Min Version | Max Version |
---|---|---|---|---|
reg | Voter registration number as present on the document | String | v1 | |
name | Name of the individual as shown in the document | String | v1 | |
careOf | Father, mother or the spouse name if available | String | v1 | |
dob | Date of birth if available else null. | Date | v1 | |
age | Age in years if available. Some voter card formats have age in the place of the date of birth. | String | v1 | |
address | Address information if available else null | String | v1 | |
gender | Male / female if available else null | String | v1 |
Sample Response
Sample response for valid document.
{
"valid": true,
"message": null,
"data": {
"reg": "ABC0648741",
"name": "Gitanjali Raheja",
"careOf": "Remesh Raheja",
"dob": "12/12/1996",
"age": null,
"gender": "Female",
"address": "6/423, Kottappurathu, Kudavechoor PO 686144"
}
}
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.