Spain: company identifier formats (NIF / CIF)

Shape, check digit, accepted and refused examples and the API call for NIF / CIF in Spain. Every example on this page is run through the same validators as the free identifier validator, so a value shown as accepted is a value the validator accepts.

NIF / CIF

FieldValue
RegisterRegistro Mercantil (BORME)
ShapeL N{7} C
Check digitEnforced. Odd positions of the 7 digits are doubled (a product above 9 loses 9) and the rest are added; control = (10 - sum mod 10) mod 10, written as that digit or as its letter (J A B C D E F G H I).
Worked example (accepted)A28015865
Normalised formA28015865
Also accepted as inputA-28015865
A one-character slipA28015866 is refused
Regex (normalised form)^[ABCDEFGHJNPQRSUVW][0-9]{7}[0-9A-J]$
API callGET /companies/search?country=ES&company_number=A28015865 · also taken by nif=
VAT numberES + NIF — built from the identifier by rule; the registration is not confirmed

Notes and scope

The first letter is the legal form (A public limited company, B limited company). A personal DNI or NIE has a different check (a mod 23 letter) and is not a company identifier: the API refuses it.

Call it from code

curl "https://api.prometiam.com/functions/v1/risk-api/companies/search?country=ES&company_number=A28015865" \
  -H "Authorization: Bearer YOUR_API_KEY"

Shape notation: N digit · L letter · X digit or letter · C check digit or character · {n} repeat n times.

A valid shape and check digit prove that a number is well-formed, not that a company holds it. Only a lookup in the register answers that.

Source and credit

Register data that the API serves for Spain carries this credit:

Based on data from the Agencia Estatal Boletín Oficial del Estado (BORME)

Related pages

Start your 14-day free trial · API documentation

The free trial lasts 14 days and includes 500 credits. A card is required and nothing is charged during the trial; it then continues as Starter (EUR 9.99/month) unless you cancel.

Frequently asked questions

How is the NIF / CIF checked?
Odd positions of the 7 digits are doubled (a product above 9 loses 9) and the rest are added; control = (10 - sum mod 10) mod 10, written as that digit or as its letter (J A B C D E F G H I).