v1

latestOpenAPI 3.1.0MIT2026-07-13111497.3 KB
Postcodes

Autocomplete Search a Postcode

Query for a postcode either by:

  • The postcode itself (with query=) or by,
  • A geolocation (lat= and lon=).

Query with Postcode

Submit a postcode query and receive a complete list of postcode matches and all associated postcode data. This is triggered when query= is supplied.

This is essentially a postcode search which prefix matches and returns postcodes in sorted order (case insensitive).

This method is space sensitive, i.e. it detects for spaces between outward and inward parts of the postcode (some examples detailed in this issue).

The result set can either be empty or populated with up to 100 postcode entities. Either way it will always return a 200 response code.

Query with Geolocation

Returns nearest postcodes for a given longitude and latitude. This is triggered when lat= and lon= are supplied.

get/postcodes

Query parameters

querystring

Postcode to query. Aliases to q=

Example:SW1A 2AA
{"stackTrail":"paths:/postcodes:get:parameters:1:schema","oasType":"schema","type":"unknown","example":3}

Limits number of postcodes matches to return. Defaults to 10. Needs to be less than 100.

longitudenumber double
Example:-0.127695

Geographic coordinate that specifies the east-west position of a point

latitudenumber double

Latitude

Example:51.50354
radiusinteger
Example:500

Limits number of postcodes matches to return. Defaults to 100m. Needs to be less than 2,000m.

widesearchboolean

Search up to 20km radius, but subject to a maximum of 10 results. Since lookups over a wide area can be very expensive, we've created this method to allow you choose to make the trade off between search radius and number of results. Defaults to false. When enabled, radius and limits over 10 are ignored.

filterstring

A comma separated whitelist of attributes to be returned in the result object(s), e.g. filter=postcode,longitude,latitude. null responses will continue to return null. If no attributes match the result object, an empty object is returned

Example:postcode

Response

Success

status200 required

Example response

{
  "result": [
    {
      "postcode": "SW1A 2AA",
      "outcode": "SW1A",
      "incode": "1AA",
      "quality": 1,
      "eastings": 530047,
      "northings": 179951,
      "country": "England",
      "nhs_ha": "London",
      "admin_district": "Westminster",
      "admin_ward": "St. James's",
      "longitude": -0.12767,
      "latitude": 51.503541,
      "parliamentary_constituency": "Cities of London and Westminster",
      "european_electoral_region": "London",
      "primary_care_trust": "Westminster",
      "region": "London",
      "parish": "Westminster, unparished area",
      "lsoa": "Westminster 018C",
      "msoa": "Westminster 018",
      "ccg": "NHS North West London",
      "pfa": "Metropolitan Police",
      "date_of_introduction": "198001",
      "index_of_multiple_deprivation": 14843,
      "parliamentary_constituency_2024": "Cities of London and Westminster",
      "senedd_constituency": "Caerdydd Penarth",
      "senedd_constituency_no": 14,
      "nhs_region": "London",
      "ttwa": "London",
      "bua": "Greater London",
      "icb": "NHS North West London Integrated Care Board",
      "cancer_alliance": "RM Partners (West London)",
      "lsoa11": "Westminster 018C",
      "msoa11": "Westminster 018",
      "lsoa21": "Westminster 018C",
      "msoa21": "Westminster 018",
      "oa21": "E00004185",
      "ruc11": "Urban major conurbation",
      "ruc21": "Urban major conurbation",
      "lep1": "London",
      "nuts": "Westminster",
      "codes": {
        "admin_district": "E09000033",
        "admin_county": "E99999999",
        "admin_ward": "E05013806",
        "parish": "E43000236",
        "ccg": "E38000256",
        "ccg_id": "W2U3Z",
        "ced": "E99999999",
        "nuts": "TLI32",
        "lau2": "E09000033",
        "lsoa": "E01004736",
        "msoa": "E02000977",
        "pfa": "E23000001",
        "parliamentary_constituency": "E14000639",
        "parliamentary_constituency_2024": "E14000639",
        "nhs_region": "E40000003",
        "ttwa": "E30000234",
        "bua": "E34004786",
        "icb": "E54000027",
        "cancer_alliance": "E56000009",
        "lsoa11": "E01004736",
        "msoa11": "E02000977",
        "lsoa21": "E01004736",
        "msoa21": "E02000977",
        "oa21": "E00004185",
        "ruc11": "A1",
        "ruc21": "A1",
        "lep1": "E37000051"
      }
    }
  ]
}