Spain VAT API – Validate Spain VAT Numbers in Real Time

REST JSON endpoint for verifying Impuesto sobre el Valor Añadido (IVA) numbers against the official EU VIES register, with national registry fallback where available and a VIES consultation number once you set your own VAT as requester in dashboard Account details.

Why a Spain-Aware VAT API

In Spain, VAT is known as Impuesto sobre el Valor Añadido (IVA) and the current standard rate is 21%. Every Spain VAT number starts with the prefix ES and follows a fixed structure issued by the Spanish tax authority. A generic VAT validator that ignores country-specific quirks will accept malformed input and miss the country’s format rules.

The vatnode API normalises IVA input, runs the official VIES check, and returns a single JSON shape with the consultation number, company data where published, and the current Spain VAT rates inline.

Spain VAT Number Format

Structure
ES + letter + 7 digits + letter/digit, or ES + 8 digits + letter
Regex pattern
^ES([A-Z]\d{7}[A-Z0-9]|\d{8}[A-Z])$

Real Spain VAT numbers you can validate right now:

More of them live in the EU VAT number directory, grouped by member state.

Validating Spain VAT Numbers – Code Examples

All three examples validate the same Spain VAT number ESA15075062. To receive a consultation number back, set your own VAT as requester once in dashboard Account details – then every call, including these, returns a consultation number automatically, with no extra parameters.

curl
curl 'https://api.vatnode.dev/v1/vat/ESA15075062' \
  -H "Authorization: Bearer YOUR_API_KEY"
Node.js (fetch)
const res = await fetch(
  'https://api.vatnode.dev/v1/vat/ESA15075062',
  { headers: { Authorization: `Bearer ${process.env.VATNODE_API_KEY}` } }
)
const data = await res.json()
console.log(data.valid, data.companyName, data.consultationNumber)
Python (httpx)
import os, httpx

r = httpx.get(
    "https://api.vatnode.dev/v1/vat/ESA15075062",
    headers={"Authorization": f"Bearer {os.environ['VATNODE_API_KEY']}"},
)
data = r.json()
print(data["valid"], data["companyName"], data["consultationNumber"])

What You Get Back

A successful response for a valid SpainVAT number, once you've set your VAT as requester in dashboard Account details, looks like this:

{
  "valid": true,
  "vatId": "ESA15075062",
  "countryCode": "ES",
  "countryName": "Spain",
  "companyName": "Inditex SA",
  "consultationNumber": "WAPIAAAAXk7ZpY3o",
  "source": "VIES",
  "countryVat": {
    "currency": "EUR",
    "standardRate": 21,
    "reducedRates": [10],
    "superReducedRate": 4,
    "parkingRate": null
  },
  "verifiedAt": "2026-05-19T08:14:22Z"
}

When the number is not registered, valid is false and company fields are null. The consultationNumber is the EU VIES requestIdentifier – the documented audit reference for reverse-charge ‘reasonable care’ evidence. It is returned once you set your own VAT as requester in dashboard Settings; otherwise it is null.

Spain VAT Rates

vatnode returns the current Spanish IVA rates inline with every successful response. Today’s rates (standard 21%, reduced 10%, super-reduced 4%) are sourced from the European Commission TEDB feed, checked daily and updated on any change.

Rate typeValue
Standard21%
Reduced10%
Super-reduced4%

VIES vs National Fallback for Spain

For Spain, VIES is the sole authoritative source. vatnode does not run a national-registry fallback for this country today – when VIES is unavailable, the API surfaces a structured VIES_UNAVAILABLE error with retry guidance so you can degrade gracefully rather than silently accept unverified numbers.

Cached VIES responses (15-minute TTL on identical VAT IDs) absorb the majority of short outages transparently. For the full per-country fallback status, see the coverage matrix.

Spain VAT API – FAQ

Is the Spain VAT number the same as the company registration number?

The Spanish IVA number identifies the business for VAT. vatnode does not return a company register number for Spain, so registryCode is null. The part after the ES prefix is the tax identification number (Número de Identificación Fiscal), returned in taxId.

How fast is Spain VAT validation through vatnode?

Cached responses return in single-digit milliseconds. Live VIES lookups for Spain typically complete in under one second; a 15-minute Redis cache is applied to identical VAT IDs.

Does the API work for Spanish sole traders and small businesses?

Yes. If a Spanish sole trader or small business is registered for IVA and listed in VIES, vatnode validates the number and returns the same response shape as for corporate entities. The valid field is true regardless of legal form.

Does vatnode handle VIES outages for Spain?

vatnode caches recent VIES responses and surfaces a clear VIES_UNAVAILABLE error code with structured retry guidance. vatnode does not use a national validity fallback for Spain — only the VAT register itself can confirm a VAT registration, so during a VIES outage validation defers to the cached result or returns the error for safe handling.

What is the consultation number returned for checks in Spain?

The consultationNumber is the VIES requestIdentifier — a reference returned by VIES that proves the check was performed against the official EU register on a specific date. It shows that you checked, not that the counterparty stayed valid afterwards, and it is returned once you set your own VAT as requester in dashboard Account details — including for Spain.

VAT APIs for Other EU Countries

See Also

Building an AI workflow? vatnode is also available to AI agents through the official MCP server — Claude, Cursor and ChatGPT can validate Spain VAT numbers and look up rates directly in chat.

Start Validating Spain VAT Numbers

100 validations per month on the free plan, no credit card required. REST JSON over HTTPS, VIES consultation number on qualified checks, EU-hosted by default.