Part of a Data Solution
- Explore →
Postal Codes Solution
Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.
Premium
You're viewing a free sample
Get the complete dataset — all rows and files — delivered instantly after checkout, with lifetime access to the latest version.
- Secure checkout via Stripe
- Instant download after payment
- Lifetime access to the latest version
- Open Government Licence v3.0 license
API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.yaml to inspect schema and resources
- 2. Download data resources listed in datapackage.yaml
- 3. Read README.md for full context
Data Files
postal-codes-gb-sample
| Field | Type | Description | Constraints | Title |
|---|---|---|---|---|
| country_code | string | ISO country code — always GB | { "pattern": "^GB$", "required": true } | Country Code |
| postal_code | string | Unit postcode, e.g. AL1 1AG | { "pattern": "^[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][A-Z]{2}$", "required": true } | Postal Code |
| place_name | string | Nearest GeoNames populated place (town/locality) | Place Name | |
| admin_name1 | string | Country: England / Scotland / Wales | Administrative Name 1 | |
| admin_code1 | string | Country GSS code (E92/S92/W92) | Administrative Code 1 | |
| admin_name2 | string | District / unitary authority / borough / council area | Administrative Name 2 | |
| admin_code2 | string | District GSS code (E06/E07/E08/E09/S12/W06) | Administrative Code 2 | |
| admin_name3 | string | Electoral ward | Administrative Name 3 | |
| admin_code3 | string | Ward GSS code (E05/S13/W05) | Administrative Code 3 | |
| latitude | number | WGS84 latitude (converted from BNG) | Latitude | |
| longitude | number | WGS84 longitude (converted from BNG) | Longitude | |
| accuracy | string | OS positional quality indicator (10 = highest; 90 = no coordinate) | Accuracy | |
| alternative_city_name | string | Not available in source — empty | Alternative City Name | |
| admin_county_code | string | Extra: two-tier England county GSS code (E10); blank for single-tier areas | ||
| admin_county_name | string | Extra: two-tier England county name | ||
| easting | integer | Extra: British National Grid easting (EPSG:27700) | ||
| northing | integer | Extra: British National Grid northing (EPSG:27700) |
Download
Download sample CSVAbout
- Last updated
- 3 October 2026
- Total rows
- 100
- Format
- CSV
- File size
- 13.7 kB
- Sources
- Ordnance Survey Code-Point Open (OGL) — postcodes, grid coordinates, GSS codes
- ONS Open Geography Portal (OGL) — LAD, Ward, County name-code lookups
- GeoNames GB (CC-BY) — nearest populated-place names
- License
- Open Government Licence v3.0
About this dataset
United Kingdom (GB) — internal licensing notes
Status: PACKAGED 2026-09-11, published to git + samples bucket. Main R2 bucket
publish BLOCKED. Pipeline restored, sources re-fetched, licence position confirmed
against the primary source document, one real attribution gap found and fixed
(2026-08-25). This session (2026-09-11) finished packaging: datasets/gb/data/
now holds gb.csv, datapackage.json (with a proper licence_status block, real
hash/bytes/rows/fields), README.md, ATTRIBUTION.txt, DATA_DICTIONARY.md, gb.zip
— Frictionless-validated (valid: True, after fixing a truncated sha256 and a wrong
field count of 16 vs the real 17). datasets/gb/scripts/publish_r2.py was written
(same dry-run/--apply/preflight template used across this session) but the main
postal-codes R2 bucket is returning 403 Forbidden on every key (confirmed against
known-good keys fr/fr.csv, pk/pk.csv, not just gb/gb.csv — this is the
session-wide credential outage, not a GB-specific problem). The 100-row sample was
refreshed on the samples bucket instead (postal-codes-samples key gb/gb.csv,
13,714 → 13,731 bytes, 2026-07-30 → 2026-09-11) — GB is is_premium: true, so per
this project's free-vs-paid samples rule the samples bucket gets the truncated
100-row preview, not the full file (unlike BO/CW/CI/ET/UG, which are free and got
full files). datasets/gb/datapackage.yml updated: premium_tier: A (three-source
consolidation — OS Code-Point Open base + ONS admin crosswalk + GeoNames place names,
plus a real licensing caveat resolved — same shape as CA's tier-A justification in
docs/PRICING_TIERS.md), premium_source_key: gb/gb.zip, real licenses[] and
sources[] (previously a placeholder "Multiple sources" link), resource bytes/
modified corrected from the stale 2024 stub. Main-bucket product publish and
_meta/catalog.json update remain pending until the 403 is resolved.
How GB got here
A full GB build (uk/ at repo root — Code-Point Open + ONS + GeoNames, 1,747,841 rows,
with pipeline scripts) was added in commit 1c247b5, then deleted wholesale in commit
35a9565 ("Remove uk/ folder", no reason recorded in the message). The built CSV survived
only as an untracked local file on one machine; the four scripts were gone even from that
local working copy. The public datasets/gb/datapackage.yml was never touched by any of
this — it still points at a 2024 GeoNames 100-row sample that predates the Code-Point Open
build entirely, which is why GB shows up stale on the storefront despite a full dataset
having existed at one point.
Recovered from git history and re-verified 2026-08-25: same 1,747,841 rows, same 99.9%
district/ward fill, same 31.9% county fill, same 865 no-coordinate rows as the original
build. Relocated from the old uk/ root layout into datasets/gb/scripts/ to match the
current per-country convention.
Licence — three sources, all open, all commercial-resale-permitted
| Source | Licence | Confirmed from |
|---|---|---|
| OS Code-Point Open | OGL v3.0 | the licence file shipped inside the actual Code-Point Open download (codepo_gb/Doc/licence.txt) — primary source, not a web claim |
| ONS Open Geography (LAD/Ward/County name-and-code lookups) | OGL v3.0 | ons.gov.uk/methodology/geography/licences |
| GeoNames GB | CC BY 4.0 | geonames.org/export |
None of the three carries share-alike or a non-commercial restriction. No OSM or Nominatim data anywhere in this pipeline — unlike KWT/SGP/JEY, this build never touches the ODbL/Nominatim gate.
The attribution requirement is three-part, not two, and this was verified against the actual licence text rather than assumed:
codepo_gb/Doc/licence.txt (bundled inside the Code-Point Open download):
Contains Ordnance Survey data © Crown copyright and database right 2026.
Contains Royal Mail data © Royal Mail copyright and database right 2026.
Contains National Statistics data © Crown copyright and database right 2026.
Royal Mail's postcode IP rides along with Code-Point Open even though PAF itself is out of scope for this build — OS republishes postcode-unit boundaries under OGL, but the attribution obligation to Royal Mail travels with that republication regardless.
Gap found and fixed: the working copy's uk/README.md (now datasets/gb/ equivalent)
named only OS + ONS + GeoNames in its attribution paragraph — Royal Mail was missing,
against the licence file's explicit third line. Corrected 2026-08-25 to quote the licence
verbatim. This is exactly the failure class datahub-next#941 §6 exists to catch — a value
nobody checked against its primary source — so it's recorded here rather than silently
patched.
Recommendation
Licensing: clean, resolvable now. All three sources permit commercial resale with
attribution; the only condition is retaining the four-line attribution block (OS, Royal
Mail, National Statistics, GeoNames) in whatever ships. Add the corrected licenses: /
attribution block to datasets/gb/datapackage.yml and to any published README/datapackage
before this goes live — it is not there yet (still the 2024 stub, see below).
What remains before this matches the fr/sg convention:
- No
fetch_source.py— sources are currently hand-downloaded intosources/. - No
package.py/publish_r2.py— no gated packaging or R2-publish step exists yet. datasets/gb/datapackage.ymlstill describes the 2024 100-row GeoNames sample (is_premium: true, nopremium_tier, points at a stalepostal.datahub.io/gb/gb.csvsample object) — it has not been updated to reflect the real 1.75M-row dataset or given alicence_statusrecord per the #941 §6 gate.sources/manifest.json(checksummed provenance, the fr/ca convention) does not exist for GB yet —sources/currently just holds the raw downloaded files.
What was NOT done
No R2 object was written. No is_premium/premium_tier/data_available flag was
changed. Nothing was committed or pushed — datasets/gb/scripts/ and this file exist only
in the local working tree. Those are human decisions, same as every other country's
licensing-notes file in this repo.
Investigated 2026-08-25. Sources verified directly: codepo_gb/Doc/licence.txt (bundled
with the actual Code-Point Open download), ons.gov.uk licence page, GeoNames export page.