---
id: "esnie"
kind: "datatype"
status: "stable"
is_pii: true
categories: ["pii", "persons"]
country: ["ES"]
langs: ["es"]
quality: 75
url: "http://registry.apicrafter.io/datatype/esnie"
---

# Spanish Foreigner Identity Number (NIE) (`esnie`)

The NIE is a tax identification number in Spain, known in Spanish as the NIE, or more formally the Numero de identidad de extranjero

- Personal data (PII): yes
- Categories: Personally identifiable information (pii), Person related (persons)
- Countries: Spain (ES)
- Languages: Spanish (es)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(X(-|\.)?0?\d{7}(-|\.)?[A-Z]|[A-Z](-|\.)?\d{7}(-|\.)?[0-9A-Z]|\d{8}(-|\.)?[A-Z])$
```

## Mappings

- dpv: `pd:OfficialID`
- presidio: `ES_NIE`
- stdnum: `es.nie`

## Metacrafter rules

4 rules: 2 match the field name, 2 match values.

- `esniefield` (field, `es/es_persons.yaml`)
- `esnievalue` (data, `es/es_persons.yaml`)
- `es_pii_esniefield` (field, `pii/es/es_pii.yaml`)
- `es_pii_esnievalue` (data, `pii/es/es_pii.yaml`)

## Supported by tools

- `amazonmacie`
- `awsglue`
- `databricks`
- `dataprep`
- `ibmguardium`
- `metacrafter`
- `openmetadata`
- `presidio`
- `pythonstdnum`

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/NIE_number>

## Quality

Score 75/100. Missing: examples, negative example, translation.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/esnie.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/ES/persons/esnie.yaml>
