Automate DNINIE Validation for Spain

Spain DNI and NIE Verification API: Number and Expiry Date Check

Table of Contents
Share this article

Updated November 2026

This guide shows how to verify a DNI/NIE in Spain with Verifik’s API: the endpoint, its parameters, a request you can paste into a terminal, the documented response and errors, and what to watch for when you put it in production. Everything below comes from the official endpoint documentation.

About the DNI/NIE in Spain

Spain uses two identity numbers. The Documento Nacional de Identidad (DNI), issued by the Policía Nacional, has eight digits and a control letter. Foreign residents receive a Número de Identidad de Extranjero (NIE), which starts with X, Y or Z, followed by seven digits and a control letter.

Verifik’s endpoint accepts both (DNIES or NIE) and, unlike most Latin American endpoints, it validates the document’s expiry date instead of the date of birth.

Want to try it? Create your Verifik account and make your first call today.

How to call the Spain DNI/NIE API

Endpoint: GET https://api.verifik.co/v2/es/cedula. Send your token in the Authorization: Bearer header. Parameters, as documented:

ParameterRequiredDescription
documentTypeYesDocument type. Allowed values: DNIES, NIE.
documentNumberYesDocument number without spaces.
dateYesExpiration date in DD/MM/YYYY format.

Request example with placeholder values (replace them with your user’s data):

curl --location --request GET 'https://api.verifik.co/v2/es/cedula?documentType=DNIES&documentNumber=12345678Z&date=31/12/2030' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'

200 response from the docs (personal data masked):

{
  "data": {
    "documentType": "DNIES",
    "documentNumber": "12*****89",
    "fullName": "J*** P****",
    "names": [
      "J***",
      "P****"
    ]
  },
  "signature": {
    "message": "Certified by Verifik.co",
    "dateTime": "January 16, 2024 3:44 PM"
  },
  "id": "ES001"
}

A successful call returns HTTP 200 with a data object containing: documentType, documentNumber, fullName, names. Every response also carries a signature (timestamp and “Certified by Verifik.co”) and a unique id you can store as evidence of the check.

Documented errors for /v2/es/cedula

  • 401 UNAUTHORIZED (“Authentication required”): the token is missing or invalid; check the Authorization header.
  • 403 FORBIDDEN (“Access forbidden”): the token is valid but not allowed to use this endpoint; check your plan or permissions.
  • 404 NotFound (“Record not found”): no record was found; do not treat it as a match and route the case to review or ask for another document.
  • 409 MissingParameter (“"date" is required”): a required parameter is missing or has an invalid value; fix the request instead of retrying it as is.

Integration tips

  • The date parameter is the document’s expiry date in DD/MM/YYYY, not the birth date. Label the form field clearly.
  • Calculate the control letter (number modulo 23) before calling the API to catch typos.
  • Send the number without spaces or hyphens, letter included (for example 12345678Z).
  • Spanish data processing is governed by the GDPR and the LOPDGDD; minimize stored fields.

Personal data and terms of use

Identity lookups process personal data. Use the API only for a lawful purpose you can document, such as onboarding, fraud prevention or contract checks, collect consent where the local law requires it, and keep only the fields you need. Usage is governed by the smartCHECK terms and conditions.

Pricing

Each successful request consumes credits from your Verifik plan. Current plans and per-endpoint costs are on the smartCHECK pricing page.

Related guides and documentation

Start testing

Create a Verifik account to get your API token, or book a meeting if you want to review coverage and volumes with the team.

Miguel Treviño - Co-founder and CTO, Verifik

Frequently Asked Questions (FAQs)

➖

Which date does the Spain endpoint ask for?

The date parameter is the expiry date of the DNI or NIE, in DD/MM/YYYY format.

➕

Which endpoint verifies a DNI/NIE in Spain?

GET https://api.verifik.co/v2/es/cedula, with the parameters documentType, documentNumber, date and your Bearer token.

➕

What errors can the Spain DNI/NIE endpoint return?

The documentation lists HTTP 401, 403, 404, 409. In short, a 404 means no record was found; 409 usually means a missing or invalid parameter.

➕

How is the Spain DNI/NIE check priced?

Each successful request consumes credits from your Verifik plan. See the smartCHECK pricing page for current plans.

Explore more articles