MRZSpain

OCR for Spanish National ID Card - DNI API

Extract data from Spanish National ID Cards (DNI) instantly. High-accuracy DNI OCR API built for developers. Get your JSON response in seconds. Try for free today.

OCR for Spanish National ID Card - DNI API
Start in Seconds
Sign up to get your API key and start processing your documents
State of the Art Accuracy
We use the most powerful models to ensure the highest accuracy and throughput
GDPR Compliant
We are EU Hosted, GDPR Compliant and follow Zero Data Retention by default
Just pay for what you extract
No monthly commitments or high starting tiers. Volume discounts available.

Try it out

Experience the power of our OCR. Upload a document and see the results instantly.

Drop document or click to upload

Supports PDF, PNG, JPG (max 10MB)

By uploading a document, you agree to our terms. We do not store your data.

JSON Response
{
"success":
true,
"data":{
"id_number":
"12345678Z",
"id_number_verified":
true,
"foreign_id_number":
null,
"foreign_id_number_verified":
false,
"document_number":
"BCA12345",
"document_number_verified":
true,
"name":
"JUAN",
"name_verified":
true,
"first_surname":
"GARCIA",
"first_surname_verified":
true,
"second_surname":
"MARTINEZ",
"second_surname_verified":
true,
"birth_date":
"1985-03-15",
"birth_date_verified":
true,
"expiration_date":
"2030-03-15",
"expiration_date_verified":
true,
"issuing_date":
"2020-03-15",
"issuing_team_number":
"08892L6D1",
"gender":
"M",
"gender_verified":
true,
"raw_address":
"CL. MAYOR 12 P02 01 MADRID MADRID MADRID",
"address_road_type":
"CALLE",
"address_road_name":
"MAYOR",
"address_number":
"12",
"address_floor":
"P02",
"address_door":
"01",
"address_province":
"MADRID",
"address_municipality":
"MADRID",
"address_town":
"MADRID",
"mrz_detected":
true
},
"balance":
14.5,
"cost":
0.005
}
id_numberstring | null

Spanish DNI number (DNI)

id_number_verifiedboolean

Whether the DNI control letter has been mathematically verified

document_numberstring | null

The unique document number (Número de soporte)

document_number_verifiedboolean

Whether the document number has been verified against the MRZ

foreign_id_numberstring | null

Foreign ID number (NIE). Only present when document is NIE.

foreign_id_number_verifiedboolean

Whether the foreign ID number has been mathematically verified

namestring | null

Holder's given name(s) (Nombre)

name_verifiedboolean

Whether the name has been verified against the MRZ

first_surnamestring | null

Holder's first (paternal) surname (Primer apellido)

first_surname_verifiedboolean

Whether the first surname has been verified against the MRZ

second_surnamestring | null

Holder's second (maternal) surname (Segundo apellido)

second_surname_verifiedboolean

Whether the second surname has been verified against the MRZ

birth_datestring | null

Holder's date of birth (Fecha de nacimiento)

birth_date_verifiedboolean

Whether the birth date has been verified against the MRZ

expiration_datestring | null

Date on which the document expires (Fecha de expiración)

expiration_date_verifiedboolean

Whether the expiration date has been verified against the MRZ

issuing_datestring | null

Date on which the document was issued (Fecha de emisión)

issuing_team_numberstring | null

Code identifying the office and team that issued the document (Equipo)

genderstring | null

Holder's gender as a single letter (e.g. M or F) (Género)

gender_verifiedboolean

Whether the gender has been verified against the MRZ

raw_addressstring | null

Full address as it appears on the document, unparsed (Dirección completa)

address_road_typestring | null

Type of road (Tipo de vía)

address_road_namestring | null

Name of the street or road (Nombre de la vía)

address_numberstring | null

Street number (Número)

address_floorstring | null

Floor within the building (Planta)

address_doorstring | null

Door or apartment identifier within the floor (Número de puerta)

address_provincestring | null

Province of the registered address (Provincia)

address_municipalitystring | null

Municipality of the registered address (Municipio)

address_townstring | null

Town or city of the registered address (Población)

mrz_detectedboolean | null

Whether a Machine Readable Zone (MRZ) was detected on the document

Indemnizame
Sagardobus
Swipoo

Common questions

Quick answers to common questions about our Spanish National ID Card - DNI OCR.

How can I get the best accuracy?

To ensure the highest extraction quality, use high-resolution pictures with good lighting and always include both the front and back side images of the document in your request.

Does it support one side of the document?

Yes, but processing only one side will result in lower accuracy and might miss important information that is only present on the other side.

Does it support old versions of the document?

Yes, it supports any version of the Spanish ID Document (DNI), including the older pre-electronic versions.

Does it structure the DNI address?

Yes, it extracts and structures the address into specific fields including road type, road name, number, floor, door, province, municipality, and town.

Does it support NIE documents?

Partially yes. When the document is a NIE (Tarjeta de Identidad de Extranjero), the NIE number is returned in the foreign_id_number field. For DNI documents, foreign_id_number is null.

Integrate our API in seconds

Start extracting data from your documents in seconds with our ready-to-use OCR API.

Terminal - Local File
curl -X POST "https://api.tiny-idp.com/api/extractors/run/es-national-id-card" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "files=@/path/to/your/document.jpg"

Ready to build?

Get your free API key and start extracting data from documents in minutes. No credit card required for the free tier.

Common use cases

Discover how businesses are using our OCR API to automate their workflows.

Automated Onboarding

Extract data from documents to streamline user registration and KYC processes.

Data Verification

Instantly verify document details against your records or third-party databases.

International Documents

Process identity documents from over 190 countries with high accuracy.

Workflow Automation

Eliminate manual data entry by piping structured document data directly into your CRM or ERP.

Simple, Transparent Pricing

No hidden fees. No monthly minimums. Pay only for what you extract.

Pay As You Go

Usage-Based

Simple pay-as-you-go pricing. No monthly commitment.

0 – 1,000 requests/mo
Starting tier
€0.045
/request
1,000+ requests/mo22% off
Automatic discount
€0.035
/request
Get Started

Enterprise

Custom

Tailored pricing for high-volume scenarios. Get SLA guarantees, on-premise deployment, and dedicated support — reach out and we'll put together a plan that fits your scale.

Contact Sales

All prices exclude VAT. Volume discounts apply automatically.

Enterprise-grade Compliance & Security

We take data privacy seriously. Tiny IDP is built from the ground up to meet the strictest European data protection standards.

Zero Data Retention

We don't store your documents, images, or predictions. Data is processed in-memory and immediately discarded.

GDPR Compliant

Full compliance with European data protection regulations (GDPR) for your peace of mind.

EU-Based Infrastructure

All data is processed and hosted exclusively in secure European data centers.

Visit Trust Center
EU Hosted
Encrypted
No Storage
GDPR

Do you need a custom OCR?

We support custom extractors! Define your own fields, rules, and logic to extract data from any type of document.