BYTETOOLS

Postcodes.io API

Free UK postcode API with no key: coordinates, council, constituency, ward and NHS area for any UK postcode, plus reverse and nearest lookups. Tested.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-19

What is the Postcodes.io API?

Postcodes.io is a free, key-free API for UK postcodes, returning coordinates, administrative areas, parliamentary constituency, ward, NHS health authority and more, with reverse geocoding and nearest-postcode lookups.

Postcodes.io is the standard free tool for UK address work. A single lookup returns not just coordinates but the full administrative hierarchy — district, county, ward, constituency and NHS area — which is exactly what civic and public sector applications need.

The constituency field pairs particularly well with the UK Parliament Members API: postcode in, constituency out, then MP details. That two-step is how most 'find your MP' features are built.

Quick facts

Base URL
https://api.postcodes.io
Authentication
No API key required.
Rate limit
No published hard limit; the service is open source and self-hostable.
Pricing
Free and open source, using Open Government Licence data.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Postcodes.io API

Every request below was executed against the live API on 2026-08-19, and the response shown is the real body it returned — not an illustration.

1. Look up a UK postcode

GET https://api.postcodes.io/postcodes/SW1A1AA

curl
curl 'https://api.postcodes.io/postcodes/SW1A1AA'
JavaScript (fetch)
const res = await fetch("https://api.postcodes.io/postcodes/SW1A1AA");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://api.postcodes.io/postcodes/SW1A1AA", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "status": 200,
  "result": {
    "postcode": "SW1A 1AA",
    "quality": 1,
    "eastings": 529090,
    "northings": 179645,
    "country": "England",
    "nhs_ha": "London",
    "longitude": -0.141563,
    "latitude": 51.50101,
    "european_electoral_region": "London",
    "primary_care_trust": "Westminster",
    "region": "London",
    "lsoa": "Westminster 018C",
    "msoa": "Westminster 018",
    "incode": "1AA",
    "outcode": "SW1A",
    "parliamentary_constituency": "Cities of London and Westminster",
    "parliamentary_constituency_2024": "Cities of London and Westminster",
    "senedd_constituency": null,
    "senedd_constituency_no": null,
    "admin_district": "Westminster",
    "parish": "Westminster, unparished area",
    "admin_county": null,
    "date_of_introduction": "198001",
    "date_of_termination": null,
    "index_of_multiple_deprivation": 24862,
    "admin_ward": "St James's",
    "ced": null,
    "ccg": "NHS West and North London",
    "nuts": "Westminster",
    "pfa": "Metropolitan Police",
    "nhs_region": "London",
    "ttwa": "London",
    "national_park": "England (non-National Park)",
    "bua": "City of Westminster",
    "icb": "NHS West and North London Integrated Care Board",
    "cancer_alliance": "West London",
    "lsoa11": "Westminster 018C",
    "msoa11": "Westminster 018",
    "lsoa21": "Westminster 018C",
    "msoa21": "Westminster 018",
    "oa21": "E00023938",
    "ruc11": "(England/Wales) Urban major conurbation",
    "ruc21": "Urban: Nearer to a major town or city",
    "lep1": "London",
    "lep2": null,
    "codes": {

Parameters

ParameterTypeRequiredDescription
postcodes/<postcode>pathOptionalLook up a specific postcode. postcodes/SW1A1AA
postcodes?lon=&lat=queryOptionalReverse geocode coordinates to nearby postcodes. lon=-0.12&lat=51.50
postcodes/<postcode>/nearestpathOptionalPostcodes near a given one. nearest
postcodes?q=stringOptionalPartial postcode autocomplete. SW1A

Response fields

statusinteger
Status code inside the body.
result.postcodestring
Normalised postcode with correct spacing.
result.longitude / latitudenumber
Coordinates as real numbers.
result.admin_districtstring
Local council area.
result.parliamentary_constituencystring
Westminster constituency — pairs with the Parliament API.
result.nhs_hastring
NHS health authority region.
result.codesobject
ONS statistical codes for each administrative area.

What you can build with the Postcodes.io API

  • Autofill address forms from a UK postcode
  • Build a 'find your MP' feature via the constituency field
  • Map users to local council or NHS regions
  • Validate and normalise UK postcodes at signup

Common errors and how to fix them

404

Postcode does not exist or is terminated.

Fix: Postcodes.io only holds live postcodes; use the /terminated endpoint to check historic ones.

Spacing issues

Postcodes can be sent with or without a space.

Fix: The API normalises input, but always display the normalised `postcode` from the response.

Empty reverse geocode

The coordinates are outside the UK or in the sea.

Fix: Increase the radius parameter, or handle the empty case.

Postcodes.io API — frequently asked questions

Is Postcodes.io free?

Yes, completely free with no API key. It is open source and uses Open Government Licence data, and can be self-hosted.

Can I find someone's MP from their postcode?

Yes — that is a common use. Look up the postcode, read parliamentary_constituency, then query the UK Parliament Members API for that constituency's MP.

Does it do reverse geocoding?

Yes, pass lon and lat to find nearby postcodes, with an optional radius. Useful for turning a device location into an address area.

Does it cover Northern Ireland?

Yes, though some administrative fields differ because Northern Ireland uses a different local government structure.

Tools that pair with this API

Postcodes.io is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-19; always check the official documentation before relying on this API in production, as terms and limits can change.