es_dniSpanish ID card (DNI)
Check that a Spanish DNI is valid, not expired and belongs to the right person.
- Category
- Identity
- Country
- Spain
- Extracted fields
- 14 fields
- Cost
- 1 credit
es_dnispecimen- Document number
- First name
- First surname
- Second surname
- Sex
- Nationality
- Date of birth
- Expiry date
- Issue date
The DNI is the most requested document in Spain, and the one most often stored for no reason. Constaia reads both sides, computes the check letter, validates the MRZ and compares it with the printed data. You get a verdict with reasons and, if you want, only the minimum fields.
- A photo of each side, or one PDF with both, counts as 1 credit.
- With storage "none" the file is deleted as soon as the analysis ends: you never keep a copy of the ID.
- A correct letter and MRZ do not prove the document is authentic; warnings flag screen photos or possible edits.
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.
Extracted fields
- 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
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 with a ck_test_ key and 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 the document is authentic?
No. It checks the type, data consistency and your rules, and flags signals such as a possible edit or a screen photo. That does not prove authenticity.
Is a copy of the document kept?
No, unless you ask for it. With storage "none" (the default) the file is deleted when the analysis ends.
Other documents
And for the record…
Create your account, copy the test key and validate your first document in five minutes.