Tools API Blog
Sign in Create account

Validate NIF, NIE or CIF

Validate NIF/NIE/CIF is an API that checks the check letter or digit of a Spanish tax ID, before you store it on an invoice or a form. Scope: Spain only, unlike a VAT number from any EU country.

How it works

You send the ID (with or without spaces/dashes) and it detects whether it's a NIF (8 digits + letter), a NIE (X/Y/Z + 7 digits + letter) or a CIF (letter + 7 digits + a check digit or letter), and mathematically checks whether the check character matches. It doesn't query Spain's tax agency or any registry: just the number's own arithmetic.

An invalid ID isn't a request error: the response is 200 with "valid": false, same as when it's valid.

Honest note about the CIF

Which CIF organization letters require a digit check and which require a letter varies by source. Rather than risk an incorrect rule, this tool accepts either mathematically valid form of the check character. It checks the checksum, not whether the company is actually registered.

All you need

  • Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
  • In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).

How to use it in n8n (step by step)

In the HTTP Request node:

  • Method: POST
  • URL: https://api.cofferdock.com/validate-tax-id
  • Send Headers: on → add two: x-api-key = your key, and Content-Type = application/json
  • Send Body: on → Body Content Type: JSON → { "tax_id": "12345678Z" }

In Make (HTTP → Make a request module): same method and URL, Body type: Raw, Content type: JSON, with the same body.

Options (inside the JSON)

OptionDefaultWhat it does
tax_id-Required. The NIF, NIE or CIF to validate, with or without spaces/dashes.

What you get back

valid (true/false), type (nif/nie/cif, or null if it matches no Spanish format) and formatted (the ID uppercased with no spaces).