Driving Licence and Vehicle
Read a driving licence image (OCR)
Upload a photo or scan of a driving licence and get the licence number, holder name, date of birth and address as structured fields.
POST
/
v2
/
verify
/
dl_ocr
Extract driving licence fields from an image
curl --request POST \
--url https://prod.idto.ai/v2/verify/dl_ocr \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '(binary image of the driving licence)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/dl_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('file', '(binary image of the driving licence)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/dl_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/dl_ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/dl_ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/dl_ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/dl_ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-API-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/dl_ocr")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Driving licence details extracted successfully.",
"error_code": null,
"data": {
"dl_number": "KA0120200000001",
"name": "RAHUL SHARMA",
"relative_name": "SURESH SHARMA",
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560001",
"dob": "1990-01-01",
"doi": "2010-05-01",
"doe": "2030-05-01",
"blood_group": "O+",
"pincode": "560001"
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}Upload an image of the licence as
On
Questions: Driving licence and vehicle FAQ.
Was this page helpful? Email us at tech@idto.ai with the page link.
multipart/form-data in the file field. idto reads the card and returns its fields. Pair it with Verify a driving licence to confirm the extracted number against the issuing record.
Every response has the same shape whichever source serves the call. Branch on error_code, never on status:
error_code: nullwithdata: fields were read from the card. Billed.error_code: "IDTO_202"withdata: null: no driving licence could be read from the file. Billed.- Any non-2xx response: the check did not complete. Never billed.
Environments
| Environment | Base URL | Notes |
|---|---|---|
| Production | https://prod.idto.ai | Keys from the dashboard after go-live. Billed. |
| Staging | https://dev.idto.ai | Keys on request from your idto account manager. Calls reach live sources, so use identities you are authorised to verify. Staging credits are deducted from your staging account. |
Input rules
| Field | Rule |
|---|---|
file | Required. One image of the licence, at most 12 MB. Larger uploads return IDTO_503 (413). |
workflow_session_token | Optional. Pass only when the call is part of an idto workflow session. |
data.dl_number is returned only when the text read matches two letters followed by 11 to 14 digits; otherwise it is null. Check every field before you rely on it, OCR reads what is printed and can misread a worn card.
Retries and duplicate protection
Send anIdempotency-Key header (at most 255 characters) to make retries safe. Replaying the same key with the same body within 48 hours returns the stored first response without a new check or a new charge. The same key with a different body returns IDTO_010 (422). A replay while the first call is still running returns IDTO_004 (409). If the first call returned an error, nothing is stored, so a retry runs the check again.
Errors
| Code | HTTP | Message | Billed |
|---|---|---|---|
IDTO_202 | 200 | No driving licence could be read from the document. Please upload a clear DL image. | Yes |
IDTO_001 | 400 | Invalid input. Please check the request and try again. | No |
IDTO_503 | 413 | The image could not be processed. Please try a clearer, smaller image. | No |
IDTO_001 | 422 | Invalid input. Please check the request and try again. (a required field is missing or has the wrong type) | No |
null | 400 | Insufficient credits for this operation. (your idto balance is too low; recharge and retry) | No |
IDTO_004 | 409 | An identical request is already in progress; retry shortly. | No |
IDTO_010 | 422 | Idempotency-Key was already used with a different request body. | No |
IDTO_006 | 429 | Too many requests. Please wait a moment and retry. | No |
IDTO_007 | 500 | Verification could not be completed due to a service configuration issue. Please contact support at tech@idto.ai. | No |
IDTO_008 | 503 | The verification service is facing downtime due to issues from the source. Please drop a mail to tech@idto.ai, and try again later. | No |
IDTO_202 or IDTO_503, ask the user for a sharper, well lit photo of the front of the card. Retry IDTO_004, IDTO_006 and IDTO_008 with backoff. Full taxonomy: v2 error codes.
Test scenarios
| Input | Expected error_code | HTTP | Billed |
|---|---|---|---|
| Clear photo of the front of a driving licence | null | 200 | Yes |
| Photo of a different document or a blank page | IDTO_202 | 200 | Yes |
| File larger than 12 MB | IDTO_503 | 413 | No |
Request without the file part | IDTO_001 | 422 | No |
Was this page helpful? Email us at tech@idto.ai with the page link.
Authorizations
Headers
Make retries of this exact request safe. If the same key is replayed with an identical request body, the original result is returned without re-running the verification or billing again. If the same key is replayed with a different body, the request is rejected with IDTO_010 (422). Omitting this header runs every request as new.
Maximum string length:
255Response
The image was OCR'd.
Last modified on December 1, 2026
Extract driving licence fields from an image
curl --request POST \
--url https://prod.idto.ai/v2/verify/dl_ocr \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--header 'X-Client-ID: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '(binary image of the driving licence)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/dl_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const form = new FormData();
form.append('file', '(binary image of the driving licence)');
const options = {
method: 'POST',
headers: {'X-Client-ID': '<api-key>', 'X-API-Key': '<api-key>'}
};
options.body = form;
fetch('https://prod.idto.ai/v2/verify/dl_ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://prod.idto.ai/v2/verify/dl_ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Client-ID": "<api-key>",
"X-API-Key": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.idto.ai/v2/verify/dl_ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.idto.ai/v2/verify/dl_ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-API-Key: <api-key>",
"X-Client-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://prod.idto.ai/v2/verify/dl_ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-API-Key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://prod.idto.ai/v2/verify/dl_ocr")
.header("X-Client-ID", "<api-key>")
.header("X-API-Key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary image of the driving licence)\r\n-----011000010111000001101001--")
.asString();{
"status": "success",
"message": "Driving licence details extracted successfully.",
"error_code": null,
"data": {
"dl_number": "KA0120200000001",
"name": "RAHUL SHARMA",
"relative_name": "SURESH SHARMA",
"address": "12 SAMPLE STREET, SAMPLE AREA, BENGALURU, KARNATAKA-560001",
"dob": "1990-01-01",
"doi": "2010-05-01",
"doe": "2030-05-01",
"blood_group": "O+",
"pincode": "560001"
},
"billed": true,
"tranx_id": "8f14e45f-ceea-467e-bd93-4a2c11e0a1b2",
"timestamp": "2026-09-14T10:15:30Z"
}