es_dniSpanish ID card (DNI)
Check that a Spanish DNI is valid, in date and belongs to the person who says it does.
- Category
- Identity
- Country
- Spain
- Fields it extracts
- 14 fields
- Cost
- 1 credit
The DNI is the most requested document in Spain and the one most often kept without any need. Constaia reads both sides, calculates the check letter, validates the machine readable zone (MRZ) and compares it with the printed data. You get a verdict with its reasons and, if you like, only the essential data.
- A photo of each side, or a PDF with both, counts as 1 credit.
- If you choose not to keep files, the document is deleted when the analysis ends and you keep no copy of the ID card.
- A correct letter and MRZ do not prove the document is authentic. Warnings tell you if it looks like a photo of a screen or may have been edited.
What it checks
- NIF/NIE check letter. The check character is recomputed (mod 23).
- MRZ ICAO 9303. Check digits of the machine readable zone.
- MRZ vs printed data. The MRZ matches the visible data.
- Validity. Not expired on the reference date.
- Holder. Name, number or date of birth match what you expect.
- Age. Minimum or maximum age from the date of birth.
Fields it extracts
- Document number
document_number - First name
first_name - First surname
last_name_1 - Second surname
last_name_2 - Sex
sex - Nationality
nationality - Date of birth
birth_date - Expiry date
expiry_date - Issue date
issue_date - Support number
support_number - Address
address - Place of birth
birth_place - Parents' names
parents - Mrz
mrz
Where it is used
Sample request
curl https://api.constaia.com/v1/analyze \
-H "Authorization: Bearer $CONSTAIA_API_KEY" \
-F "file=@dni_valid.jpg" \
-F 'options={
"expect": "es_dni",
"checks": {
"not_expired": true,
"holder": {
"full_name": "María García López"
}
},
"storage": "none"
}'Try it for free in test mode with the file dni_valid.jpg.
Sample response
Fictitious data. Shortened response.
{
"id": "an_01J9Z3K8QW4T6Y2B7N5M1R0PXC",
"object": "analysis",
"status": "completed",
"livemode": false,
"document": {
"type": "es_dni",
"label": "Spanish ID card (DNI)",
"confidence": 0.97
},
"verdict": {
"expected": [
"es_dni"
],
"match": true,
"status": "valid",
"reasons": [
{
"code": "type_match",
"severity": "info",
"message": "The document is: Spanish ID card (DNI)."
}
]
},
"fields": {
"document_number": {
"value": "12345678Z",
"confidence": 0.99,
"validated": true
},
"first_name": {
"value": "MARÍA",
"confidence": 0.98,
"validated": null
},
"last_name_1": {
"value": "GARCÍA",
"confidence": 0.97,
"validated": null
},
"last_name_2": {
"value": "LÓPEZ",
"confidence": 0.96,
"validated": null
},
"sex": {
"value": "F",
"confidence": 0.99,
"validated": null
},
"nationality": {
"value": "ESP",
"confidence": 0.98,
"validated": null
},
"birth_date": {
"value": "1990-04-18",
"confidence": 0.97,
"validated": null
},
"expiry_date": {
"value": "2031-03-12",
"confidence": 0.96,
"validated": null
}
},
"checks": [
{
"code": "nif_check_digit",
"passed": true,
"message": "The NIF check letter is correct."
},
{
"code": "mrz_checksums",
"passed": true,
"message": "The MRZ check digits are correct."
},
{
"code": "mrz_matches_visual",
"passed": true,
"message": "The MRZ matches the printed data."
}
],
"warnings": [],
"storage": {
"mode": "none",
"file_deleted_at": "2026-09-29T10:00:02Z",
"expires_at": null
},
"usage": {
"credits": 1,
"pages": 2
}
}FAQ
Does Constaia prove that the document is authentic?
No. It checks the type, the consistency of the data and your rules, and flags signals such as a possible edit or a photo of a screen. That does not prove authenticity.
Is a copy of the document kept?
Only if it needs review: it is then kept encrypted until someone decides and for 24 hours after that (configurable). Otherwise it is deleted as soon as the analysis ends. You can choose never to keep it.
Other documents
And for the record…
Create your free account and validate your first document in five minutes. No card required.