Spain Driving Licence (Permiso de Conducción) OCR API

Read the Spanish permiso de conducción from a photo and get the licence number, name, dates and classes as structured JSON. Upload an image below to test it free.

200 free credits = 100 Driver License scans, no credit card. Then from $5 for 500 credits, pay as you go. See pricing

Diagram of the API reading a Spanish permiso de conducción and returning the fields as JSON.

What Makes the Spanish permiso de conducción Hard to Parse

The Spanish permiso de conducción is issued by the Dirección General de Tráfico (DGT). The Spanish carnet de conducir uses the EU numbered fields: 1 apellidos, 2 nombre, 3 date and place of birth, 4a and 4b issue and expiry dates, 4c the issuing authority, 5 the licence number and 9 the categories. For Spanish nationals the licence number in field 5 is the holder's DNI number, and the card has no address field.

One API Call, Named Fields

The StructOCR Driver License OCR API returns the licence number (field 5, the DNI or NIE), apellidos and nombre (fields 1 and 2), date and place of birth (field 3), issue and expiry dates (4a, 4b), issuing authority (4c) and categories (field 9). Spanish cards print dates as DD.MM.YYYY; the API returns them as YYYY-MM-DD. Send a JPG, PNG, WebP or PDF as Base64 JSON or as a multipart upload; there is no SDK to embed in your app, although official Python and Node.js SDKs are available. Step-by-step code is in the Python guide. Usage is billed per successful scan with pay-as-you-go pricing.

Live Demo: Driver License OCR Scanner

No registration required. Upload a file to test the extraction.

1
Upload
2
Results
↑

Drop files here or click to browse

JPG · PNG · PDF · TIFF  ·  up to 500 files · max 4.5 MB each

No document handy?

No files selected
Need more testing? Create a free account to get 200 free credits (equals 100 Driver License scans).

Where Teams Use It in Spain

Alquiler de coches y carsharing

Comprobar las categorías y la caducidad antes de entregar el vehículo.

Seguros

Prellenar los datos del conductor desde una foto del carnet.

Reparto y VTC

Registrar conductores y repartidores con su número de permiso.

Technical Specs

  • Endpoint: POST https://api.structocr.com/v1/driver-license
  • Input: JPG, PNG, WebP or PDF up to 4.5 MB, as Base64 JSON or multipart upload
  • Price: 2 credits per successful scan; new accounts get 200 free credits (100 scans)
  • Retention: Images and results are kept for at most 24 hours for quality spot-checks, then deleted

Key Features

  • Named fields: The licence number (field 5, the DNI or NIE), apellidos and nombre (fields 1 and 2), date and place of birth (field 3), issue and expiry dates (4a, 4b), issuing authority (4c) and categories (field 9).
  • Normalized dates: Spanish cards print dates as DD.MM.YYYY; the API returns them as YYYY-MM-DD.
  • Good to know: The card has no address field, so address is returned as null.

Integration & AI Prompts

Install the official SDK and pass a photo of the licence. Full request and response details are in the driver license API reference.

# pip install structocr
import os
from structocr import StructOCR

client = StructOCR(api_key=os.environ["STRUCTOCR_API_KEY"])
result = client.scan_driver_license("licence.jpg")

if result.get("success"):
    data = result["data"]
    print(data["document_number"], data["surname"], data["date_of_expiry"])

Standardized JSON Output

An illustrative response for a Spanish permiso de conducción, with fictional values.

{
  "success": true,
  "data": {
    "type": "drivers_license",
    "country_code": "ESP",
    "region": null,
    "document_number": "12345678Z",
    "personal_number": null,
    "surname": "GARCÍA LÓPEZ",
    "given_names": "LUCÍA",
    "sex": null,
    "date_of_birth": "1992-11-20",
    "place_of_birth": "MADRID",
    "date_of_issue": "2020-04-02",
    "date_of_expiry": "2030-04-02",
    "date_of_first_issue": null,
    "issuing_authority": "DGT",
    "address": null,
    "vehicle_class": "AM, B"
  }
}

Frequently Asked Questions

Can I test the Spanish permiso de conducción scan for free?

Yes. Upload a photo in the live demo on this page without an account, or create an account to get 200 free credits, enough for 100 licence scans through the API.

¿El número de permiso es el DNI?

En los permisos de ciudadanos españoles el número del campo 5 coincide con el DNI, y se devuelve como document_number.

Is the address included?

No. The card has no address field, so address is returned as null.

Do I need an SDK?

No. It is a plain REST API that accepts Base64 JSON or a multipart upload. Official Python and Node.js SDKs are available if you prefer them.

Explore More Driver License OCR Solutions

SOLUTION

Retail Sportsbook ID Scanning with a PDF417 API

Scan US driver licenses and state ID cards for retail sportsbooks. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Staffing Agency Worker Onboarding with ID Barcodes

Scan US driver licenses and state ID cards for staffing agencies. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Tattoo and Piercing Studio ID Checks with PDF417

Scan US driver licenses and state ID cards for tattoo and piercing studios. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Telecom Customer Onboarding with Driver License PDF417

Use PDF417 and AAMVA parsing for telecom account opening. Pre-fill given_names, surname, date_of_birth, handle unreadable barcodes, and keep API credentials server-side.

Driver License OCR
SOLUTION

Thailand Driving Licence OCR API

Extract the licence number, the holder's name in English, ID number, date of birth, issue and expiry dates and licence type from the Thai driving licence as JSON with one API call. Try it free in the browser; new accounts get 100 free licence scans.

Driver License OCR
SOLUTION

Turkey Driving Licence (Sürücü Belgesi) OCR API

Extract the licence number, surname and name, date and place of birth, issue and expiry dates, T.C. Kimlik No. where printed and classes from the Turkish sürücü belgesi as JSON with one API call. Try it free in the browser; new accounts get 100 free licence scans.

Driver License OCR
SOLUTION

UAE Driving Licence OCR API

Extract the licence number, the holder's name, nationality where printed, date of birth, issue and expiry dates, the issuing authority and the permitted vehicle categories from the UAE driving licence as JSON with one API call. Try it free in the browser; new accounts get 100 free licence scans.

Driver License OCR
SOLUTION

UK Driving Licence OCR API

Extract name, licence number (field 5), address (field 8), dates and categories from UK DVLA driving licences as JSON. Free upload test and 100 free API scans.

Driver License OCR
SOLUTION

US Driver License Scanner API & SDK

Scan US driver's licenses from all 50 states with a REST API or our Python and Node SDKs. Extract name, DOB, address and the Document Discriminator (DD). 100 free scans.

Driver License OCR
SOLUTION

Vape and Tobacco Shop ID Verification with PDF417

Scan US driver licenses and state ID cards for vape and tobacco retailers. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

From tutorial to production in 5 minutes.

You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.

Instant Access Cancel Anytime No Credit Card