Driving License OCR API
EXTRACT TEXT FROM DRIVING LICENSE DOCUMENT IMAGE
Description
This API can extract and parse the text from an input Indian Driving License document image and return the information in JSON format. This API can parse license issued by any state in India. Only printed cards are supported. Old handwritten and booklet based driving licenses are not supported.

API Outcome
- DL Number
- Name of the individual
- Father / mother / spouse name
- Date of birth if available
- Address of the individual if available
- Issued and the expiry dates
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 DL for driving license. | 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":"DL"
}
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 | DrivingLicense data object as described below. | Object | v1 |
Driving License Data Object
Key | Description | Type | Min Version | Max Version |
---|---|---|---|---|
reg | Driving License 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. Different states use different formats for dates and therefore the output format may vary. | Date | v1 | |
address | Address information if available else null | String | v1 | |
issued | Date of issue if available. Just like the date of birth, the date formats may vary depending on the state. | Date | v1 | |
expiry | Date of expiry if available. | Date | v1 |
Sample Response
Sample response for valid document.
{
"valid": true,
"message": null,
"data": {
"reg": "AP-12341312342001",
"name": "Gitanjali Raheja",
"careOf": "Ganesh Raheja",
"dob": "15/12/1993",
"address": "F45, Sushant Lok, Phase 3, Gurgaon - 123456",
"issued": "20/09/2016",
"expiry": "15/12/2035"
}
}
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.