ONS Postcode Directory
O
ONS Postcode Directory

tap-onspd (meltanolabs variant)

The ONS Postcode Directory (ONSPD) is the Office for National Statistics' quarterly file of every UK postcode. Each postcode comes with its latitude and longitude and the geographies it falls in: country, region, county, local authority, ward, constituency, LSOA, IMD rank and more. Each release also ships code-to-name lookups for those geographies.

This tap finds the latest ONSPD release on ArcGIS Online, downloads its zip (about 250 MB) and streams the postcode and lookup CSV files out of it. Nothing is extracted to disk.

Available Streams

| Stream | Replication | Replication Key | Primary Key | |---|---|---|---| | postcodes | Incremental | _onspd_modified_at | pcds | | countries | Incremental | _onspd_modified_at | ctry_cd | | regions | Incremental | _onspd_modified_at | rgn_cd | | counties | Incremental | _onspd_modified_at | cty_cd | | local_authorities | Incremental | _onspd_modified_at | lad_cd | | wards | Incremental | _onspd_modified_at | wd_cd | | constituencies | Incremental | _onspd_modified_at | pcon_cd |

The replication key is the release's last-modified time. When the bookmark already holds the current release, every stream emits nothing and the zip is not downloaded. To load the same release again, run the tap without its state, for example with meltano run --full-refresh.

Fields

The fields of each stream come from the header of its CSV file in the release, so a column that ONS adds in a later release appears without a change to the tap.

  • lat and long are numbers, and the imdNNind ranks are integers. All other columns are strings, which keeps leading zeros.
  • Empty values become null. Postcodes with no grid reference have lat 99.999999 and long 0.
  • With Strip Vintage Suffixes on, the geography year is dropped from column names (lad26cd becomes lad_cd), so names stay the same across releases. Columns that exist in more than one vintage keep their names (oa11cd, oa21cd).

Every record also has these fields:

| Field | Type | Description | |---|---|---| | _onspd_release | string | Release label, e.g. AUG_2026 | | _onspd_item_id | string | ArcGIS item ID of the release | | _onspd_modified_at | datetime | Last-modified time of the release — replication key |

Licence

ONSPD is published under the Open Government Licence v3.0. Display these statements wherever the data is used, with the year of the loaded release:

  • Contains OS data © Crown copyright and database right
  • Contains Royal Mail data © Royal Mail copyright and database right
  • Source: Office for National Statistics licensed under the Open Government Licence v.3.0

Northern Ireland (BT) postcodes are licensed separately by Land & Property Services for internal business use only. The tap leaves them out by default, together with the Channel Islands and the Isle of Man, which are not part of the UK.

Settings

Exclude Countries

Countries whose postcodes are left out, from england, scotland, wales, northern_ireland, channel_islands and isle_of_man. The default leaves out Northern Ireland, the Channel Islands and the Isle of Man. Set to an empty list to load every postcode.

Strip Vintage Suffixes

Drop the geography year from column names (lad26cd becomes lad_cd), so that they stay the same across releases.

Meltano Cloud Connector

ONS Postcode Directory connector is available on Meltano. It is built, maintained, supported, and tested by Meltano.

Why Meltano?
Expert supportDirect access to the team that built and maintains Meltano Cloud. Same-day responses during UK business hours. When something breaks, we fix it fast because we know exactly how it works.
Rigorously testedEvery connector goes through comprehensive testing and quality checks before production. Daily monitoring catches issues before they hit your pipelines. We don't just wrap open-source taps and hope for the best. We validate, we test, we maintain.
No maintenance overheadAPI changes. Connector updates. Schema drift. Breaking changes from upstream sources. We handle it all. Your team focuses on using data. Our team focuses on making sure it's there when you need it.
Access to Meltano Slack communityJoin 5,500+ data engineers and analytics practitioners. The community is active, helpful, and always on. Good for quick questions, sharing patterns, and learning what others are building.