Skip to main content

Spain โ€” Tax ID Validation (NIF / NIE / CIF)

The Spain Tax ID Validation API authenticates Spanish fiscal identification codes, verifying natural citizens (NIF), foreign residents (NIE), and corporate entities (CIF).

The service evaluates official check-digit algorithms (modulo 23 control letters for personal NIF/NIE and modulo 11 checksums for corporate CIFs), classifies the legal structure and province of incorporation, and cross-references registration in the European VIES database.


API Referenceโ€‹

Endpointโ€‹

GET https://api.verifik.co/v2/es/tax-id/validate

Validate a Spanish tax identifier against official cryptographic control formulas and the official tax authority database.

Headersโ€‹

NameValueDescription
Content-Typeapplication/jsonRequest payload format
Acceptapplication/jsonResponse format
AuthorizationBearer <token>Client JWT authentication token

Parametersโ€‹

ParameterTypeRequiredDescription
documentNumberstringYesSpanish fiscal identifier to validate (e.g., A28015865, 12345678Z, Y1234567X).
documentTypestringNoExplicit document classification (NIF, NIE, or CIF). If omitted, the service infers type automatically from syntax.

Requestโ€‹

import axios from "axios";

const options = {
method: "GET",
url: "https://api.verifik.co/v2/es/tax-id/validate",
params: {
documentNumber: "A28015865",
documentType: "CIF",
},
headers: {
Accept: "application/json",
Authorization: "Bearer <your_token>",
},
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error.response ? error.response.data : error.message);
}

Responseโ€‹

{
"data": {
"valid": true,
"documentNumber": "A28015865",
"documentType": "CIF",
"category": "CORPORATION_CIF",
"entityTypeDescription": "Sociedad Anรณnima",
"province": "Madrid",
"viesRegistered": true,
"businessName": "TELEFONICA SA"
},
"signature": {
"dateTime": "October 31, 2026 12:00 AM",
"message": "Certified by Verifik.co"
}
}

Notesโ€‹

  • Entity Types in CIFs: The initial letter designates the legal form (A: Sociedad Anรณnima, B: Sociedad de Responsabilidad Limitada, C: Sociedad Colectiva, G: Asociaciones, etc.).
  • Province Determination: The first two digits of the numerical block identify the provincial delegation of incorporation (e.g., 28 for Madrid, 08 for Barcelona).
  • VIES Registration: The viesRegistered flag indicates whether the entity has an active intra-Community VAT operator listing with the official tax authority.