Skip to content
Clear Postcode

API reference · v1

Postcode API reference

Base URL https://api.clearpostcode.co.uk/v1. Send your key as X-Api-Key. Every answer is {data, meta}; every error is an RFC 9457 problem. The machine-readable contract: openapi.json.

Conventions

  • Input is forgiving, output is canonical. sw1a1aa, SW1A%201AA and sw1a-1aa all answer as SW1A 1AA.
  • Billing: one lookup per postcode found. Not-found, errors, autocomplete and 304 Not Modified are free. Send If-None-Match with the ETag you got.
  • Limits: RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset show your month; 429 means slow down (see Retry-After), 402 means the month's allowance is used.
  • Trim responses with ?fields=location,local_authority.
  • Every response carries X-Request-Id (quote it to support) and Server-Timing.
  • Versioning: v1 only ever grows: new endpoints and new fields, never a removed or renamed one. Anything breaking would be v2, announced at least 12 months ahead with Deprecation and Sunset headers.

Look up a postcode

GET/v1/postcodes/{postcode}

Everything about one postcode: status (live or terminated), coordinates with positional quality, and every area it sits in (country, region, county, council, ward, parish, constituency, police force, NHS board, census areas), plus rural-urban class and deprivation decile. A terminated postcode answers 200 with status "terminated", the month it ended and the nearest live postcode in replaced_by.

Billing: 1 lookup when found; not found is free. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
postcode *pathstringAny UK postcode, in any case, with or without the space. e.g. SW1A 1AA
fieldsquerystringComma-separated top-level fields to return (postcode and status always come back). e.g. location,local_authority,ward
curl "https://api.clearpostcode.co.uk/v1/postcodes/SW1A%201AA" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"
Real response (August 2026 edition)
{
  "data": {
    "postcode": "SW1A 1AA",
    "status": "live",
    "outcode": "SW1A",
    "incode": "1AA",
    "sector": "SW1A 1",
    "district": "SW1A",
    "area": "SW",
    "introduced": "1980-01",
    "terminated": null,
    "replaced_by": null,
    "user_type": "large",
    "location": {
      "latitude": 51.50101,
      "longitude": -0.141563,
      "easting": 529090,
      "northing": 179645,
      "positional_quality": 1,
      "positional_quality_label": "Within the building closest to the postcode's centre"
    },
    "country": {
      "code": "E92000001",
      "name": "England"
    },
    "region": {
      "code": "E12000007",
      "name": "London"
    },
    "county": null,
    "county_electoral_division": null,
    "local_authority": {
      "code": "E09000033",
      "name": "Westminster"
    },
    "ward": {
      "code": "E05013806",
      "name": "St James's"
    },
    "parish": {
      "code": "E43000236",
      "name": "Westminster, unparished area"
    },
    "constituency": {
      "code": "E14001172",
      "name": "Cities of London and Westminster"
    },
    "police_force": {
      "code": "E23000001",
      "name": "Metropolitan Police"
    },
    "nhs_region": {
      "code": "E40000003",
      "name": "London"
    },
    "icb": {
      "code": "E54000071",
      "name": "NHS West and North London Integrated Care Board"
    },
    "sub_icb": {
      "code": "E38000256",
      "name": "NHS West and North London ICB - W2U3Z"
    },
    "national_park": null,
    "built_up_area": {
      "code": "E63012036",
      "name": "City of Westminster"
    },
    "travel_to_work_area": {
      "code": "E30000234",
      "name": "London"
    },
    "lsoa": {
      "code": "E01004736",
      "name": "Westminster 018C"
    },
    "msoa": {
      "code": "E02000977",
      "name": "Westminster 018"
    },
    "output_area": "E00023938",
    "rural_urban": {
      "code": "UN1",
      "name": "Urban: Nearer to a major town or city",
      "urban": true
    },
    "area_classification": "3c2",
    "deprivation": {
      "index": "English Indices of Deprivation 2025",
      "rank": 24593,
      "of": 33755,
      "decile": 8
    }
  },
  "meta": {
    "edition": "2026-08",
    "next_edition_due": "2026-11",
    "coverage": "Great Britain, the Channel Islands and the Isle of Man",
    "licence": "OGL-UK-3.0",
    "attribution": [
      "Contains OS data © Crown copyright and database right 2026",
      "Contains Royal Mail data © Royal Mail copyright and database right 2026",
      "Source: Office for National Statistics licensed under the Open Government Licence v.3.0"
    ],
    "docs": "https://clearpostcode.co.uk/developers/docs"
  }
}

Validate a postcode

GET/v1/postcodes/{postcode}/validate

Three answers in one: is the format valid, is it in the current edition (known), and is it live. Northern Ireland (BT) postcodes are checked by format only and come back with coverage "not_covered". New-build postcodes can take up to a quarter to reach the open data, so treat known: false as "check again", never as "wrong".

Billing: 1 lookup when known; otherwise free. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
postcode *pathstringAny UK postcode, in any case, with or without the space. e.g. SW1A 1AA
curl "https://api.clearpostcode.co.uk/v1/postcodes/sw1a1aa/validate" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"
Real response (August 2026 edition)
{
  "data": {
    "input": "sw1a1aa",
    "postcode": "SW1A 1AA",
    "format_valid": true,
    "known": true,
    "status": "live",
    "valid": true,
    "coverage": "covered",
    "replaced_by": null
  },
  "meta": {
    "edition": "2026-08"
  }
}

Postcodes near a postcode

GET/v1/postcodes/{postcode}/nearest

Live postcodes closest to this one, nearest first, with the distance in metres.

Billing: 1 lookup. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
postcode *pathstringAny UK postcode, in any case, with or without the space. e.g. SW1A 1AA
radiusqueryintegerSearch radius in metres (up to 2,000; default 500). e.g. 500
limitqueryintegerHow many results (1 to 50, default 10). e.g. 10
curl "https://api.clearpostcode.co.uk/v1/postcodes/SW1A%201AA/nearest?limit=5" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"
Real response (August 2026 edition)
{
  "data": [
    {
      "postcode": "SW1A 1BB",
      "distance_m": 357,
      "latitude": 51.503831,
      "longitude": -0.139099
    },
    {
      "postcode": "SW1A 1BD",
      "distance_m": 357,
      "latitude": 51.504022,
      "longitude": -0.139783
    }
  ],
  "meta": {
    "edition": "2026-08",
    "radius_m": 500
  }
}

Postcodes near a point (reverse geocode)

GET/v1/postcodes

Live postcodes nearest a latitude and longitude, nearest first.

Billing: 1 lookup when anything is found. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
lat *querynumberLatitude (WGS84). e.g. 51.501
lon *querynumberLongitude (WGS84). e.g. -0.1416
radiusqueryintegerMetres (up to 2,000; default 500). e.g. 500
limitqueryintegerHow many results (1 to 50, default 10). e.g. 10
curl "https://api.clearpostcode.co.uk/v1/postcodes?lat=51.501&lon=-0.1416&limit=3" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Bulk lookup (up to 100)

POST/v1/postcodes

Look up to 100 postcodes in one call. Results come back in the order sent, each with the query, the record or null, and an error code when it wasn't found.

Billing: 1 lookup per postcode found. Secret (server) keys only.

ParameterInTypeDescription
fieldsquerystringComma-separated top-level fields to return (postcode and status always come back). e.g. location,local_authority,ward
curl -X POST https://api.clearpostcode.co.uk/v1/postcodes \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY" \
  -H "content-type: application/json" \
  -d '{"postcodes":["SW1A 1AA","M1 1AE","EH1 1YZ"]}'

Bulk reverse geocode (up to 50)

POST/v1/reverse

Nearest postcodes for up to 50 points in one call.

Billing: 1 lookup per point with a result. Secret (server) keys only.

curl -X POST https://api.clearpostcode.co.uk/v1/reverse \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY" \
  -H "content-type: application/json" \
  -d '{"points":[{"lat":51.5014,"lon":-0.1419,"limit":1},{"lat":53.4808,"lon":-2.2426,"limit":1}]}'

Autocomplete a partial postcode

GET/v1/autocomplete

Postcodes (or districts, for 1 to 4 characters) that start with what has been typed. Free: keystrokes are never billed. Send at least 2 characters.

Billing: Free (fair use). Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
q *querystringWhat has been typed so far. e.g. SW1A 1
limitqueryintegerHow many results (1 to 20, default 10). e.g. 10
curl "https://api.clearpostcode.co.uk/v1/autocomplete?q=SW1A%201" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Distance between two postcodes

GET/v1/distance

Straight-line distance in kilometres and miles, and the compass bearing from the first to the second.

Billing: 1 lookup. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
from *querystringFirst postcode. e.g. SW1A 1AA
to *querystringSecond postcode. e.g. EH1 1YZ
curl "https://api.clearpostcode.co.uk/v1/distance?from=SW1A%201AA&to=EH1%201YZ" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

A postcode district

GET/v1/outcodes/{outcode}

One district (the outward code, e.g. SW1A): how many live and terminated postcodes, its sectors, centre, councils, wards, constituencies and places.

Billing: 1 lookup. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
outcode *pathstringOutward code. e.g. SW1A
curl "https://api.clearpostcode.co.uk/v1/outcodes/SW1A" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Every postcode in a district

GET/v1/outcodes/{outcode}/postcodes

The district's live postcodes with coordinates, in order, a page at a time. Pass the last postcode you received as after= to get the next page.

Billing: 1 lookup per page. Secret (server) keys only.

ParameterInTypeDescription
outcode *pathstringOutward code. e.g. SW1A
afterquerystringCursor: the last postcode of the previous page. e.g. SW1A 1AA
limitqueryintegerHow many results (1 to 500, default 100). e.g. 100
curl "https://api.clearpostcode.co.uk/v1/outcodes/SW1A/postcodes?limit=100" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

A postcode sector

GET/v1/sectors/{sector}

One sector (e.g. SW1A 1): its live postcodes with coordinates, centre, and the councils and wards it covers.

Billing: 1 lookup. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
sector *pathstringSector, e.g. "SW1A 1". e.g. SW1A 1
curl "https://api.clearpostcode.co.uk/v1/sectors/SW1A%201" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

A postcode area

GET/v1/areas/{area}

One postcode area (the letters, e.g. SW): its name, counts and every district in it.

Billing: 1 lookup. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
area *pathstringArea letters. e.g. SW
curl "https://api.clearpostcode.co.uk/v1/areas/SW" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Find a place

GET/v1/places

Cities, towns, villages and neighbourhoods by name (OS Open Names), each with its postcode district and coordinates.

Billing: 1 lookup when anything is found. Publishable (browser) keys allowed. Works without a key for trying out.

ParameterInTypeDescription
q *querystringPlace name or its start. e.g. Chelsea
limitqueryintegerHow many results (1 to 20, default 10). e.g. 10
curl "https://api.clearpostcode.co.uk/v1/places?q=Chelsea" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Your usage

GET/v1/usage

Your plan, this period's allowance, lookups used, credits and when the allowance resets.

Billing: Free. Secret (server) keys only.

curl "https://api.clearpostcode.co.uk/v1/usage" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Addresses at a postcode (early access)

Early access

GET/v1/addresses

Every Royal Mail PAF address at a postcode, with UDPRN, line_1 to line_3, post_town and organisation. In early access: join the list at clearpostcode.co.uk/address-lookup.

Billing: 1 address lookup per postcode (early access). Publishable (browser) keys allowed.

ParameterInTypeDescription
postcode *querystringPostcode. e.g. SW1A 1AA
curl "https://api.clearpostcode.co.uk/v1/addresses?postcode=SW1A%201AA" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Address autocomplete (early access)

Early access

GET/v1/addresses/suggest

Suggestions as the customer types; suggestions are always free, only the address you resolve is billed.

Billing: Free. Publishable (browser) keys allowed.

ParameterInTypeDescription
q *querystringWhat has been typed. e.g. 10 Downing
curl "https://api.clearpostcode.co.uk/v1/addresses/suggest?q=10%20Downing" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

Resolve one address (early access)

Early access

GET/v1/addresses/{udprn}

The full PAF address for a UDPRN from a suggestion.

Billing: 1 address lookup. Publishable (browser) keys allowed.

ParameterInTypeDescription
udprn *pathstringRoyal Mail's Unique Delivery Point Reference Number. e.g. 23747771
curl "https://api.clearpostcode.co.uk/v1/addresses/23747771" \
  -H "X-Api-Key: $CLEAR_POSTCODE_KEY"

The postcode record

What GET /v1/postcodes/{postcode} returns. Area fields are {code, name} with the GSS code, or null where the postcode has none.

FieldTypeMeaning
postcodestringCanonical form, e.g. "SW1A 1AA".
status"live" | "terminated"Live postcodes are in use; terminated ones have been retired by Royal Mail.
outcode, incode, sector, district, areastringThe parts: SW1A, 1AA, SW1A 1, SW1A, SW.
introduced, terminatedYYYY-MM | nullWhen the postcode came into use and, if terminated, when it ended.
replaced_bystring | nullFor a terminated postcode: the nearest live postcode in the same sector (or district).
user_type"small" | "large"Large-user postcodes belong to one organisation that receives a lot of post.
locationobjectlatitude, longitude (WGS84), easting, northing (British National Grid), positional_quality 1 to 9 and its meaning. Null coordinates for the Channel Islands and the Isle of Man.
country, region, county, local_authority, ward, parish{code, name}Administrative areas with their GSS codes.
county_electoral_division{code, name}County council electoral division (England, two-tier areas).
constituency{code, name}Westminster parliamentary constituency (2024 boundaries).
police_force, nhs_region, icb, sub_icb{code, name}Police force area and NHS geographies.
national_park, built_up_area, travel_to_work_area{code, name}National park (if any), built-up area and travel-to-work area.
lsoa, msoa, output_area{code, name} / string2021 census statistical areas.
rural_urban{code, name, urban}2021 rural-urban classification, and whether that counts as urban.
area_classificationstring | null2021 Output Area Classification code.
deprivation{index, rank, of, decile} | nullThe area's rank in its nation's deprivation index (1 = most deprived) and its decile (1 to 10).

Errors

Every error is application/problem+json with a type link explaining it. The full list: error reference (15 types).