---
id: "gb_postcode_district"
kind: "datatype"
status: "draft"
is_pii: false
name: "UK postcode district (outward code)"
regexp: "^[A-Z]{1,2}\\d[A-Z\\d]?$"
categories: ["geo"]
country: ["GB"]
langs: ["en"]
quality: 85
url: "https://registry.apicrafter.io/datatype/gb_postcode_district"
---

# UK postcode district (outward code) (`gb_postcode_district`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Outward code of a UK postcode, the part before the space: the postcode area letters and the district number (LS13, NW1, WC1H). Data published at postcode district level gives it instead of full postcodes.

- Parent datatype: [`postindex`](https://registry.apicrafter.io/datatype/postindex.md)
- Personal data (PII): no
- Categories: Geographic identifiers (geo)
- Countries: United Kingdom (GB)
- Languages: English (en)
- Classification: categorical

## Detection

Regular expression (Python `re`):

```
^[A-Z]{1,2}\d[A-Z\d]?$
```

## Examples

- `LS13` — Leeds
- `NW1` — London NW1
- `WC1H` — London WC1H
- `N6` — London N6
- `LS13 5` (invalid example) — A postcode sector
- `LS13 5LP` (invalid example) — A full postcode

## Metacrafter rules

1 rules: 1 match the field name, 0 match values.

- `gbpostcodedistrictfield` (field, `gb/gb_geo.yaml`)

## Supported by tools

- [`metacrafter`](https://registry.apicrafter.io/tool/metacrafter.md)

## Sources

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

## Quality

Score 85/100. Missing: mapping (Wikidata, Schema.org, ...), translation.

JSON: <https://registry.apicrafter.io/api/v1/datatypes/gb_postcode_district.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/GB/geo/gb_postcode_district.yaml>
