DNI / NIE / CIF (Spain)
GET/api/v1/es/document
Algorithms it implements
- DNI (Spanish National Identity Document)Mod 23 (DGP)
8 digits + check letter, computed from the remainder of dividing the number by 23.
- NIE (Foreigner Identity Number)Mod 23 with X/Y/Z prefix
X/Y/Z prefix (equivalent to 0/1/2) + 7 digits + check letter, same calculation as the DNI.
- CIF (Companies and legal entities)Mod 10 (Mercantile Registry)
Organization type letter + province + number + check digit or letter depending on the type.
Inspect the step-by-step calculation in /en/catalog.
Query parameters
| Name | Default | Values | Description |
|---|---|---|---|
| sub | dni | dni · nie · cif · mix | Document subtype to generate. |
| ok | true | true · false | If `false`, forces a wrong check digit/letter (to test validators). |
| fmt | plain | plain · hyphen · space | Format of the body and the check digit. |
Generated fields
- documento
- tipo
Usage example
terminal
curl "https://datamockseed.firstflip.es/api/v1/es/document?sub=dni&ok=true&fmt=plain&count=2&seed=docs-ejemplo"Example response
Generated when this page was built, with the deterministic seed docs-ejemplo.
{
"status": "success",
"meta": {
"generator": "document",
"locale": "es",
"seed": "docs-ejemplo",
"count": 2,
"options": {
"sub": "dni",
"ok": "true",
"fmt": "plain"
}
},
"data": [
{
"documento": "29127292T",
"tipo": "DNI"
},
{
"documento": "61521712R",
"tipo": "DNI"
}
]
}