Postcodes.io
App · Travel & Places · 18 actions
Look up UK postcodes and geocode from a workflow, with no account and no API key. Get everything the Office for National Statistics holds for a postcode - coordinates, country, region, local authority district, ward, parish, parliamentary constituency, NHS and statistical areas, and the GSS code for each. Validate a postcode against the real directory rather than a regular expression, and find out when a retired one was withdrawn. Turn coordinates into postcodes and postcodes into coordinates, search or autocomplete a partial postcode, and list what is nearby. Look up hundreds of postcodes or coordinate pairs in one step. Measure the distance between two postcodes. Read an outward code as a whole postal area, search Ordnance Survey's gazetteer of British places, and get the Scottish-only geographies - council area, Data Zone, SIMD - that the UK-wide directory does not carry. Every action reads: nothing here changes anything.
Actions
| Action | What it does |
|---|---|
| Autocomplete a postcode | Complete a partial postcode into a list of real ones. |
| Find nearest outward codes | List the outward codes around another one, nearest first, each with how far its center is from the center of the one given, as the crow flies. |
| Find nearest postcodes | List the postcodes around another postcode, nearest first, each with how far away it is in meters, kilometers and miles. |
| Get a random place | Get a random British place from Ordnance Survey's Open Names, with its full record and its code. |
| Get a random postcode | Get a random live UK postcode with its full record, optionally from one outward code. |
| Look up a place | Look up one British place by its Ordnance Survey code, the 'code' field of a search result such as 'osgb4000000074554911'. |
| Look up a postcode | Look up everything Postcodes.io holds for one UK postcode: its coordinates, its country, region, local authority district, ward, parish and parliamentary constituency, its NHS and statistical areas, and the GSS code for each. |
| Look up a Scottish postcode | Look up the Scottish-only geographies for a postcode in Scotland, from the Scottish Postcode Directory: council area, Scottish Parliament constituency and region on the 2026 boundaries, health board, Data Zone and Intermediate Zone, locality and settlement, the Scottish Index of Multiple Deprivation rank, the urban-rural classification in words, and census household and population counts. |
| Look up a terminated postcode | Look up a UK postcode that no longer exists and find out when it was withdrawn, together with its last known coordinates. |
| Look up an outward code | Look up one outward code, the part of a postcode before the space, such as 'SW1A' in 'SW1A 2AA'. |
| Look up postcodes in bulk | Look up many UK postcodes in one step, which is what to use instead of a loop: a column from a spreadsheet, a list of customer addresses, a delivery run. |
| Measure the distance between two postcodes | Measure how far apart two UK postcodes are, in meters, kilometers and miles, and say whether they fall in the same local authority district, constituency and country. |
| Reverse geocode coordinates | Turn a longitude and latitude into the UK postcodes around it, nearest first, each with its distance and its full record. |
| Reverse geocode coordinates in bulk | Turn many coordinate pairs into UK postcodes in one step: a day of GPS readings, a set of pins, a list of site locations. |
| Reverse geocode to outward codes | Turn a longitude and latitude into the outward codes around it, nearest first, each with how far its center is from the point. |
| Search places | Find British places by name, from Ordnance Survey's Open Names: towns, villages, suburbs, hamlets and other gazetteer entries, each with its county, region, country, outward code and coordinates. |
| Search postcodes | Find live UK postcodes that start with a string, each with its full record. |
| Validate a postcode | Check whether a string is a live UK postcode. |
Autocomplete a postcode
Complete a partial postcode into a list of real ones. The same search as Search postcodes, but it returns the postcode strings alone rather than a full record for each, which is what an address form or a chat reply wants and a fraction of the data. Terminated postcodes are never suggested. No API key required.
Inputs
- Partial postcode
postcodetextRequired - As much of the postcode as is known. Spacing and capitalization do not matter, which also means 'EH1 1' and 'EH11' are the same search: give a letter after the digit, such as 'EH1 1Y', to stay inside EH1.
- How many results
limitnumber - How many postcodes to return, from 1 to 100. Leave empty for 10.From 1 to 100. Default:
10.
Outputs
countnumber- How many suggestions came back.
foundtrue/false- Whether any postcode matched.
limitnumber- The most that could have come back.
postcodeslist- The suggested postcodes, in order.
querytext- The partial postcode that was completed.
Example output
{
"count": 5,
"found": true,
"limit": 10,
"postcodes": [
"SW1A 2AA",
"SW1A 2AB",
"SW1A 2AE",
"SW1A 2AF",
"SW1A 2AG"
],
"query": "SW1A 2"
}Find nearest outward codes
List the outward codes around another one, nearest first, each with how far its center is from the center of the one given, as the crow flies. Use it to widen a delivery or service area a postal district at a time, or to name the neighboring areas of a site. The default radius is 5km and it reaches 25km, which is wider than the postcode search because outward codes are much further apart. No API key required.
Inputs
- Outward code
outcodetextRequired - The part of a postcode before the space, such as 'SW1A' in 'SW1A 2AA'. Two to four characters.
- How many results
limitnumber - How many outward codes to return, from 1 to 100, nearest first. Leave empty for 10.From 1 to 100. Default:
10. - Search radius (meters)
radiusnumber - How far out to look, in meters, from 1 to 25,000. Leave empty for 5,000m. Outward codes are much further apart than postcodes, which is why this reaches further than the postcode search does.From 1 to 25000. Default:
5000.
Outputs
countnumber- How many outward codes came back.
foundtrue/false- Whether any outward code was in range.
limitnumber- The most that could have come back.
nearestobject- One outward code, with every area its postcodes fall in. Null when there was nothing to return.
outcodetext- The outward code searched around.
outcodeslist- The outward codes found, nearest first.
radius_metresnumber- How far out the search looked, in meters.
resultslist- The record of each, nearest first, with its distance.
Example output
{
"count": 2,
"found": true,
"limit": 2,
"nearest": {
"admin_county": [],
"admin_district": [
"Camden",
"Westminster"
],
"admin_ward": [
"Bloomsbury",
"Camden Square",
"Camden Town",
"Church Street",
"Haverstock",
"Hyde Park",
"Kentish Town South",
"King's Cross",
"Marylebone",
"Primrose Hill",
"Regent's Park",
"St Pancras & Somers Town",
"West End"
],
"constituency_count": 3,
"country": [
"England"
],
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"district_count": 2,
"eastings": 528840,
"has_coordinates": true,
"latitude": 51.53339879746855,
"longitude": -0.1438461097046407,
"map_url": "https://www.openstreetmap.org/?mlat=51.533399&mlon=-0.143846#map=16/51.533399/-0.143846",
"northings": 183243,
"not_applicable": [
"admin_county"
],
"outcode": "NW1",
"parish": [
"Camden, unparished area",
"Westminster, unparished area"
],
"parliamentary_constituency": [
"Cities of London and Westminster",
"Holborn and St Pancras",
"Queen's Park and Maida Vale"
],
"summary": "NW1 - Camden, Westminster",
"ward_count": 13
},
"outcode": "NW1",
"outcodes": [
"NW1",
"NW1W"
],
"radius_metres": 5000,
"results": [
{
"admin_county": [],
"admin_district": [
"Camden",
"Westminster"
],
"admin_ward": [
"Bloomsbury",
"Camden Square",
"Camden Town",
"Church Street",
"Haverstock",
"Hyde Park",
"Kentish Town South",
"King's Cross",
"Marylebone",
"Primrose Hill",
"Regent's Park",
"St Pancras & Somers Town",
"West End"
],
"constituency_count": 3,
"country": [
"England"
],
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"district_count": 2,
"eastings": 528840,
"has_coordinates": true,
"latitude": 51.53339879746855,
"longitude": -0.1438461097046407,
"map_url": "https://www.openstreetmap.org/?mlat=51.533399&mlon=-0.143846#map=16/51.533399/-0.143846",
"northings": 183243,
"not_applicable": [
"admin_county"
],
"outcode": "NW1",
"parish": [
"Camden, unparished area",
"Westminster, unparished area"
],
"parliamentary_constituency": [
"Cities of London and Westminster",
"Holborn and St Pancras",
"Queen's Park and Maida Vale"
],
"summary": "NW1 - Camden, Westminster",
"ward_count": 13
},
{
"admin_county": [],
"admin_district": [
"Camden"
],
"admin_ward": [
"Regent's Park"
],
"constituency_count": 1,
"country": [
"England"
],
"distance": 651.6,
"distance_km": 0.652,
"distance_metres": 651.6,
"distance_miles": 0.405,
"district_count": 1,
"eastings": 529433,
"has_coordinates": true,
"latitude": 51.530792700194276,
"longitude": -0.13540952224371522,
"map_url": "https://www.openstreetmap.org/?mlat=51.530793&mlon=-0.13541#map=16/51.530793/-0.13541",
"northings": 182968,
"not_applicable": [
"admin_county"
],
"outcode": "NW1W",
"parish": [
"Camden, unparished area"
],
"parliamentary_constituency": [
"Holborn and St Pancras"
],
"summary": "NW1W - Camden",
"ward_count": 1
}
]
}Find nearest postcodes
List the postcodes around another postcode, nearest first, each with how far away it is in meters, kilometers and miles. The postcode itself comes back first at zero. Use it to find neighboring delivery areas, to widen a catchment, or to check what else is on a street. The default radius is 100 meters, which is a street rather than a neighborhood, so raise it for a rural address, or turn on wide search for a remote one whose neighbors are more than 2km away. No API key required.
Inputs
- Postcode
postcodetextRequired - A UK postcode. Spacing and capitalization do not matter: 'sw1a2aa' and 'SW1A 2AA' reach the same record.
- How many results
limitnumber - How many postcodes to return, from 1 to 100, nearest first. Leave empty for 10.From 1 to 100. Default:
10. - Search radius (meters)
radiusnumber - How far out to look, in meters, from 1 to 2,000. Leave empty for 100m, which is a street rather than a neighborhood: raise it for a rural address, where the nearest postcode can be a kilometer away.From 1 to 2000. Default:
100. - Wide search
widesearchtrue/false - Look out to 20km instead of using the radius above, for a remote postcode with no neighbors within 2km. It ignores the radius and returns at most 10 results, the postcode itself included, however many were asked for.Default:
false.
Outputs
countnumber- How many postcodes came back.
foundtrue/false- Whether any postcode was in range.
limitnumber- The most that could have come back. 10 at most on a wide search.
nearestobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
postcodetext- The postcode searched around.
postcodeslist- The postcodes found, nearest first.
radius_metresnumber- How far out the search looked, in meters.
resultslist- The full record of each, nearest first, with its distance.
widesearchtrue/false- Whether wide search was on.
Example output
{
"count": 1,
"found": true,
"limit": 10,
"nearest": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
},
"postcode": "SW1A 2AA",
"postcodes": [
"SW1A 2AA"
],
"radius_metres": 100,
"results": [
{
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
],
"widesearch": false
}Get a random place
Get a random British place from Ordnance Survey's Open Names, with its full record and its code. Useful for seeding test data with a location that really exists, for sampling, or for a 'somewhere in Britain' post. No API key required.
Inputs
None.
Outputs
codetext- The place's code, for Look up a place.
foundtrue/false- Whether a place came back.
messagetext- One line naming the place and where it is.
nametext- The place's name.
resultobject- One place from Ordnance Survey's gazetteer of Great Britain. Null when there was nothing to return.
Example output
{
"code": "osgb4000000074552637",
"found": true,
"message": "Henstridge Marsh - Somerset, South West, England (Other Settlement)",
"name": "Henstridge Marsh",
"result": {
"alternate_name": null,
"alternate_name_language": null,
"code": "osgb4000000074552637",
"country": "England",
"county_unitary": "Somerset",
"county_unitary_type": "UnitaryAuthority",
"district_borough": null,
"district_borough_type": null,
"eastings": 374561,
"has_coordinates": true,
"latitude": 50.98233062624499,
"local_type": "Other Settlement",
"longitude": -2.3637617159449094,
"map_url": "https://www.openstreetmap.org/?mlat=50.982331&mlon=-2.363762#map=16/50.982331/-2.363762",
"max_eastings": 375464,
"max_northings": 121216,
"min_eastings": 373127,
"min_northings": 119839,
"name": "Henstridge Marsh",
"name_1": "Henstridge Marsh",
"name_1_lang": null,
"name_2": null,
"name_2_lang": null,
"northings": 120388,
"outcode": "BA8",
"region": "South West",
"summary": "Henstridge Marsh - Somerset, South West, England (Other Settlement)"
}
}Get a random postcode
Get a random live UK postcode with its full record, optionally from one outward code. Useful for seeding test data with an address that really exists, for sampling, or for a daily 'somewhere in the UK' post. An outward code the service does not hold is reported as such rather than coming back as an empty result. No API key required.
Inputs
- Outward code
outcodetext - Restrict the pick to one outward code, such as 'SW1A'. Leave empty to draw from the whole of the UK.
Outputs
foundtrue/false- Whether a postcode came back.
messagetext- One line naming the postcode and where it is.
outcodetext- The outward code the pick was limited to, if any.
postcodetext- The postcode picked.
resultobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
Example output
{
"found": true,
"message": "SW1A 2AA - St James's, Westminster, London",
"outcode": "SW1A",
"postcode": "SW1A 2AA",
"result": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
}Look up a place
Look up one British place by its Ordnance Survey code, the 'code' field of a search result such as 'osgb4000000074554911'. Returns the same full record as a search, including the Welsh or Gaelic name where there is one and the bounding box of the place. Ordnance Survey issues new codes when it republishes its gazetteer, so run Search places or Get a random place earlier in the same workflow to get a code rather than keeping one. No API key required.
Inputs
- Place code
codetextRequired - The Ordnance Survey code of the place, such as 'osgb4000000074554911'. Codes do not follow a pattern you can guess, and Ordnance Survey issues new ones when it republishes its gazetteer, so a code saved months ago may find nothing. Take one from a Search places step in the same workflow. Case does not matter.
Outputs
codetext- The place code looked up, in lower case.
foundtrue/false- Whether a place has that code.
messagetext- One line naming the place, or why it was not found.
nametext- The place's name.
resultobject- One place from Ordnance Survey's gazetteer of Great Britain. Null when there was nothing to return.
Example output
{
"code": "osgb4000000074554911",
"found": true,
"message": "Cardiff - Caerdydd - Cardiff, Wales (City)",
"name": "Cardiff",
"result": {
"alternate_name": "Caerdydd",
"alternate_name_language": "cym",
"code": "osgb4000000074554911",
"country": "Wales",
"county_unitary": "Caerdydd - Cardiff",
"county_unitary_type": "UnitaryAuthority",
"district_borough": null,
"district_borough_type": null,
"eastings": 318371,
"has_coordinates": true,
"latitude": 51.480004719851095,
"local_type": "City",
"longitude": -3.176855474926971,
"map_url": "https://www.openstreetmap.org/?mlat=51.480005&mlon=-3.176855#map=16/51.480005/-3.176855",
"max_eastings": 325293,
"max_northings": 183747,
"min_eastings": 311231,
"min_northings": 173105,
"name": "Cardiff",
"name_1": "Cardiff",
"name_1_lang": "eng",
"name_2": "Caerdydd",
"name_2_lang": "cym",
"northings": 176329,
"outcode": "CF10",
"region": "Wales",
"summary": "Cardiff - Caerdydd - Cardiff, Wales (City)"
}
}Look up a postcode
Look up everything Postcodes.io holds for one UK postcode: its coordinates, its country, region, local authority district, ward, parish and parliamentary constituency, its NHS and statistical areas, and the GSS code for each. Spacing and capitalization do not matter. A postcode that no longer exists is not a failure: the step reports when it was terminated, so a workflow can tell a retired postcode from a typo. Comes with a plain-English reading of how accurate the coordinates are and a map link. No API key required.
Inputs
- Postcode
postcodetextRequired - A UK postcode. Spacing and capitalization do not matter: 'sw1a2aa' and 'SW1A 2AA' reach the same record.
Outputs
foundtrue/false- Whether it is a live postcode.
messagetext- One line saying what was found.
postcodetext- The postcode looked up, in capitals with its space.
resultobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
terminatedtrue/false- Whether it is a real postcode that has been withdrawn.
terminated_recordobject- A postcode that has been withdrawn, and when. Null when the postcode was not a withdrawn one.
Example output
{
"found": true,
"message": "SW1A 2AA - St James's, Westminster, London",
"postcode": "SW1A 2AA",
"result": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
},
"terminated": false,
"terminated_record": null
}Look up a Scottish postcode
Look up the Scottish-only geographies for a postcode in Scotland, from the Scottish Postcode Directory: council area, Scottish Parliament constituency and region on the 2026 boundaries, health board, Data Zone and Intermediate Zone, locality and settlement, the Scottish Index of Multiple Deprivation rank, the urban-rural classification in words, and census household and population counts. None of that is in the UK-wide directory. A real postcode outside Scotland is reported as such rather than as an error, so a condition can tell it apart from a typo. No API key required.
Inputs
- Scottish postcode
postcodetextRequired - A postcode in Scotland. Spacing and capitalization do not matter.
Outputs
foundtrue/false- Whether the Scottish directory holds it.
in_scotlandtrue/false- Whether it is a live Scottish postcode. True with found false for one issued since the Scottish directory was last published, which has no Scottish geographies yet.
messagetext- One line saying what was found.
outside_scotlandtrue/false- Whether it is a real postcode somewhere else in the UK. False for a match, and for a postcode that does not exist at all.
postcodetext- The postcode looked up, in capitals with its space.
resultobject- Everything the Scottish Postcode Directory holds for one postcode. Null when there was nothing to return.
Example output
{
"found": true,
"in_scotland": true,
"message": "EH1 1YJ - City Center, City of Edinburgh",
"outside_scotland": false,
"postcode": "EH1 1YJ",
"result": {
"census_household_count": null,
"census_household_count_1991": null,
"census_household_count_2001": null,
"census_household_count_2011": null,
"census_population_count": null,
"census_population_count_1991": null,
"census_population_count_2001": null,
"census_population_count_2011": null,
"civil_parish": "Edinburgh",
"codes": {
"civil_parish": "S35000287",
"council_area": "S12000036",
"data_zone": "S01014713",
"data_zone_2001": "S01002117",
"data_zone_2011": "S01008677",
"electoral_ward": "S13002929",
"enterprise_region": "S09000002",
"health_board_area": "S08000024",
"health_board_area_1995": "05",
"health_board_area_2006": "S08000010",
"integration_authority": "S37000012",
"intermediate_zone": "S02002727",
"intermediate_zone_2001": "S02000393",
"intermediate_zone_2011": "S02001622",
"island": "000",
"itl_level_2": "TLM1",
"itl_level_3": "TLM13",
"lau_level_1": "S30000008",
"local_government_district": "29",
"local_government_district_1991": "29",
"locality": "S52000233",
"national_park": null,
"registration_district": "S12000036",
"roa_community_planning_partnership": null,
"roa_local": null,
"scottish_parliamentary_constituency": "S16000182",
"scottish_parliamentary_region": "S17000022",
"settlement": "S53000178",
"strategic_development_planning_area": "S11000003",
"travel_to_work_area": "S22000059",
"uk_parliamentary_constituency": "S14000078"
},
"council_area": "City of Edinburgh",
"data_zone": "Old Town, Princes Street and Leith Street - 04",
"data_zone_2001": "S01002117",
"data_zone_2011": "S01008677",
"date_of_deletion": null,
"date_of_introduction": "1/8/1973 00:00:00",
"deleted_on": null,
"eastings": 325763,
"electoral_ward": "City Center",
"enterprise_region": "East of Scotland",
"grid_link_indicator": "Y",
"grid_link_positional_accuracy": "1",
"has_coordinates": true,
"health_board_area": "Lothian",
"health_board_area_1995": "Lothian",
"health_board_area_2006": "Lothian",
"incode": "1YJ",
"integration_authority": "Edinburgh",
"intermediate_zone": "Old Town, Princes Street and Leith Street",
"intermediate_zone_2001": "S02000393",
"intermediate_zone_2011": "S02001622",
"introduced_on": "1973-08-01",
"is_live": true,
"island": "Mainland of Scotland",
"itl_level_2": "East Central Scotland",
"itl_level_3": "City of Edinburgh",
"latitude": 55.95031738,
"lau_level_1": "City of Edinburgh",
"linked_small_user_postcode": "EH1 1PL",
"local_government_district": "Edinburgh City",
"local_government_district_1991": "Edinburgh City",
"locality": "Edinburgh",
"locality_1991": "Edinburgh",
"locality_2001": "Edinburgh",
"locality_2020": "Edinburgh",
"longitude": -3.1903596,
"map_url": "https://www.openstreetmap.org/?mlat=55.950317&mlon=-3.19036#map=16/55.950317/-3.19036",
"national_park": null,
"never_digitised": null,
"northings": 673672,
"not_applicable": [],
"outcode": "EH1",
"output_area": "S00143089",
"output_area_1991": "6229AB03B",
"output_area_2001": "S00013295",
"output_area_2011": "S00106725",
"pc_compact": "EH11YJ",
"postcode": "EH1 1YJ",
"postcode_district": "EH1",
"postcode_sector": "EH1 1",
"registration_district": "S12000036",
"roa_community_planning_partnership": null,
"roa_local": null,
"scottish_index_of_multiple_deprivation": 3201,
"scottish_parliamentary_constituency": "Edinburgh Central",
"scottish_parliamentary_region": "Edinburgh and Lothians East",
"settlement": "Edinburgh",
"settlement_2001": "Edinburgh",
"settlement_2020": null,
"split_indicator": "N",
"strategic_development_planning_area": "S11000003",
"summary": "EH1 1YJ - City Center, City of Edinburgh",
"travel_to_work_area": "Edinburgh",
"uk_parliamentary_constituency": "Edinburgh East and Musselburgh",
"urban_rural_6_fold": "1",
"urban_rural_8_fold": "1",
"urban_rural_description": "Large Urban Areas",
"user_type": "large"
}
}Look up a terminated postcode
Look up a UK postcode that no longer exists and find out when it was withdrawn, together with its last known coordinates. Postcodes are retired all the time as streets are redeveloped, so an old customer record can hold an address that a normal lookup simply cannot find. Only terminated postcodes are here: a postcode still in use is reported as still in use rather than as a failure. No API key required.
Inputs
- Terminated postcode
postcodetextRequired - A UK postcode that no longer exists. Spacing and capitalization do not matter. Only withdrawn postcodes are in this table: a postcode still in use is reported as still in use, so use Look up a postcode for one of those. If you do not have a retired postcode to hand, the example below is one.
Outputs
foundtrue/false- Whether it is a withdrawn postcode.
messagetext- When it was withdrawn, or why it is not here.
postcodetext- The postcode looked up, in capitals with its space.
resultobject- A postcode that has been withdrawn, and when. Null when the postcode was not a withdrawn one.
terminated_ontext- When it was withdrawn, as YYYY-MM.
Example output
{
"found": true,
"message": "BN1 1AU was terminated in August 2011.",
"postcode": "BN1 1AU",
"result": {
"eastings": 531263,
"has_coordinates": true,
"latitude": 50.823931,
"longitude": -0.13772,
"map_url": "https://www.openstreetmap.org/?mlat=50.823931&mlon=-0.13772#map=16/50.823931/-0.13772",
"month_terminated": 8,
"northings": 104363,
"postcode": "BN1 1AU",
"terminated_on": "2011-08",
"terminated_phrase": "August 2011",
"year_terminated": 2011
},
"terminated_on": "2011-08"
}Look up an outward code
Look up one outward code, the part of a postcode before the space, such as 'SW1A' in 'SW1A 2AA'. An outward code covers hundreds of postcodes, so this returns every local authority district, ward, county, parish and parliamentary constituency it touches, plus its center point. Use it to describe a postal area from a partial address, or to see how many boundaries an area straddles. No API key required.
Inputs
- Outward code
outcodetextRequired - The part of a postcode before the space, such as 'SW1A' in 'SW1A 2AA'. Two to four characters.
Outputs
foundtrue/false- Whether the outward code exists.
messagetext- One line naming it and its districts.
outcodetext- The outward code looked up, in capitals.
resultobject- One outward code, with every area its postcodes fall in. Null when there was nothing to return.
Example output
{
"found": true,
"message": "SW1A - Wandsworth, Westminster",
"outcode": "SW1A",
"result": {
"admin_county": [],
"admin_district": [
"Wandsworth",
"Westminster"
],
"admin_ward": [
"Nine Elms",
"St James's"
],
"constituency_count": 2,
"country": [
"England"
],
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"district_count": 2,
"eastings": 529727,
"has_coordinates": true,
"latitude": 51.50455391034481,
"longitude": -0.13223425517241374,
"map_url": "https://www.openstreetmap.org/?mlat=51.504554&mlon=-0.132234#map=16/51.504554/-0.132234",
"northings": 180056,
"not_applicable": [
"admin_county"
],
"outcode": "SW1A",
"parish": [
"Wandsworth, unparished area",
"Westminster, unparished area"
],
"parliamentary_constituency": [
"Battersea",
"Cities of London and Westminster"
],
"summary": "SW1A - Wandsworth, Westminster",
"ward_count": 2
}
}Look up postcodes in bulk
Look up many UK postcodes in one step, which is what to use instead of a loop: a column from a spreadsheet, a list of customer addresses, a delivery run. The answers come back in the order they were sent, so they line up with the column they came from, and the ones that could not be matched are listed separately rather than left as gaps to sift out. Postcodes.io takes 100 per request and refuses a longer list outright, so this step splits a longer one into batches automatically, up to 1,000. Trim the fields to keep a large answer small. No API key required.
Inputs
- Postcodes
postcodeslistRequired - The postcodes to look up. Give a list, or one string with the postcodes separated by commas or new lines. Up to 1,000; duplicates and order are kept so the answers line up with the list that was sent.
- Fields to return
fieldslist - Trim every result down to just these fields, which keeps a hundred-postcode answer small. Leave empty to get everything. Postcodes.io only filters on the fields listed here and silently ignores any other name, so anything else is refused rather than quietly returning the lot. Note that a trimmed result skips the extra fields this integration adds, such as the map link and the plain-English position quality, because those are worked out from fields the filter may have removed.One or more of:
postcode,longitude,latitude,eastings(Eastings (British National Grid)),northings(Northings (British National Grid)),quality(Positional quality (1 to 9)),country,region,admin_district(Local authority district),admin_county(County), and 14 more.
Outputs
fieldslist- The fields each record was trimmed to. Empty for all.
foundtrue/false- Whether at least one was found.
matchedlist- The records found, in order, trimmed to the chosen fields when Fields to return is set.
matched_countnumber- How many were found.
postcodeslist- The postcodes that were found, in order.
request_countnumber- How many requests the batches took.
requested_countnumber- How many postcodes were sent.
resultslist- One row per postcode sent, in the order sent.
unmatchedlist- The postcodes that were not found.
unmatched_countnumber- How many were not found.
Example output
{
"fields": [],
"found": true,
"matched": [
{
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
],
"matched_count": 1,
"postcodes": [
"SW1A 2AA"
],
"request_count": 1,
"requested_count": 2,
"results": [
{
"found": true,
"query": "SW1A 2AA",
"result": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
},
{
"found": false,
"query": "ZZ99 9ZZ",
"result": null
}
],
"unmatched": [
"ZZ99 9ZZ"
],
"unmatched_count": 1
}Measure the distance between two postcodes
Measure how far apart two UK postcodes are, in meters, kilometers and miles, and say whether they fall in the same local authority district, constituency and country. This is the step for 'is this customer within 20 miles of the depot?' or 'which of our sites is closest?'. Both postcodes are read in a single request. The distance is as the crow flies between the two postcode centroids, not a driving distance and not door to door. No API key required.
Inputs
- From postcode
origintextRequired - The postcode to measure from.
- To postcode
destinationtextRequired - The postcode to measure to.
Outputs
destinationtext- The postcode measured to.
destination_resultobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
distance_kmnumber- How far apart they are, in kilometers.
distance_metresnumber- How far apart they are, in meters.
distance_milesnumber- How far apart they are, in miles.
foundtrue/false- Whether both postcodes were found.
origintext- The postcode measured from.
origin_resultobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
same_constituencytrue/false- Whether both are in the same UK Parliament constituency.
same_countrytrue/false- Whether both are in the same country of the UK.
same_districttrue/false- Whether both are in the same local authority.
Example output
{
"destination": "EH1 1YJ",
"destination_result": {
"admin_county": null,
"admin_district": "City of Edinburgh",
"admin_ward": "City Center",
"bua": null,
"cancer_alliance": null,
"ccg": "Edinburgh Community Health Partnership",
"ced": null,
"codes": {
"admin_county": "S99999999",
"admin_district": "S12000036",
"admin_ward": "S13002929",
"bua": "S99999999",
"cancer_alliance": "S99999999",
"ccg": "S03000042",
"ccg_id": "042",
"ced": "S99999999",
"icb": "S99999999",
"lau2": "S30000008",
"lep1": "S99999999",
"lep2": null,
"lsoa": "S01014713",
"lsoa11": "S01008677",
"lsoa21": "S01014713",
"msoa": "S02002727",
"msoa11": "S02001622",
"msoa21": "S02002727",
"national_park": "S99999999",
"nhs_region": "S99999999",
"nuts": "TLM13",
"oa21": "S00143089",
"parish": "S99999999",
"parliamentary_constituency": "S14000078",
"parliamentary_constituency_2024": "S14000078",
"pfa": "S23000009",
"ruc11": "1",
"ruc21": "1",
"ttwa": "S22000059"
},
"country": "Scotland",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 325763,
"european_electoral_region": "Scotland",
"has_coordinates": true,
"icb": "Scotland",
"incode": "1YJ",
"index_of_multiple_deprivation": 3201,
"introduced_on": "1980-01",
"latitude": 55.950317,
"lep1": null,
"lep2": null,
"longitude": -3.19036,
"lsoa": "Old Town, Princes Street and Leith Street - 04",
"lsoa11": "Old Town, Princes Street and Leith Street - 04",
"lsoa21": "Old Town, Princes Street and Leith Street - 04",
"map_url": "https://www.openstreetmap.org/?mlat=55.950317&mlon=-3.19036#map=16/55.950317/-3.19036",
"msoa": "Old Town, Princes Street and Leith Street",
"msoa11": "Old Town, Princes Street and Leith Street",
"msoa21": "Old Town, Princes Street and Leith Street",
"national_park": "(pseudo) Scotland (non-National Park)",
"nhs_ha": "Lothian",
"nhs_region": null,
"northings": 673672,
"not_applicable": [
"admin_county",
"bua",
"cancer_alliance",
"ced",
"icb",
"lep1",
"national_park",
"nhs_region",
"parish"
],
"nuts": "City of Edinburgh",
"oa21": "S00143089",
"outcode": "EH1",
"parish": null,
"parliamentary_constituency": "Edinburgh East and Musselburgh",
"parliamentary_constituency_2024": "Edinburgh East and Musselburgh",
"pfa": "Scotland",
"postcode": "EH1 1YJ",
"primary_care_trust": "Edinburgh Community Health Partnership",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": null,
"ruc11": "(Scotland) Large Urban Area",
"ruc21": "Large Urban Areas",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "EH1 1YJ - City Center, City of Edinburgh, Scotland",
"ttwa": "Edinburgh"
},
"distance_km": 533.803,
"distance_metres": 533803.5,
"distance_miles": 331.69,
"found": true,
"origin": "SW1A 2AA",
"origin_result": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
},
"same_constituency": false,
"same_country": false,
"same_district": false
}Reverse geocode coordinates
Turn a longitude and latitude into the UK postcodes around it, nearest first, each with its distance and its full record. This is the step for a GPS reading, a map click or a photo's location. The default radius is 100 meters, which finds nothing in open country: turn on wide search for a rural point and it looks out to 20km instead, though it then ignores the radius and returns at most 10 results. No API key required.
Inputs
- Longitude
longitudenumberRequired - The east-west coordinate, in WGS84 decimal degrees. Negative is west of Greenwich, which is most of the UK.From -180.0 to 180.0.
- Latitude
latitudenumberRequired - The north-south coordinate, in WGS84 decimal degrees.From -90.0 to 90.0.
- How many results
limitnumber - How many postcodes to return, from 1 to 100, nearest first. Leave empty for 10.From 1 to 100. Default:
10. - Search radius (meters)
radiusnumber - How far out to look, in meters, from 1 to 2,000. Leave empty for 100m, which is a street rather than a neighborhood: raise it for a rural address, where the nearest postcode can be a kilometer away.From 1 to 2000. Default:
100. - Wide search
widesearchtrue/false - Look out to 20km instead of using the radius above. Turn this on for a point in open country, where the default 100m finds nothing. It is not simply a wider version of the same search: it ignores the radius entirely and returns at most 10 results however many were asked for.Default:
false.
Outputs
countnumber- How many postcodes came back.
foundtrue/false- Whether any postcode was in range.
latitudenumber- The latitude searched around.
limitnumber- The most that could have come back. 10 at most on a wide search.
longitudenumber- The longitude searched around.
nearestobject- Everything the UK postcode directory holds for one postcode. Null when there was nothing to return.
postcodeslist- The postcodes found, nearest first.
radius_metresnumber- How far out the search looked, in meters.
resultslist- The full record of each, nearest first, with its distance.
widesearchtrue/false- Whether wide search was on.
Example output
{
"count": 1,
"found": true,
"latitude": 51.503541,
"limit": 10,
"longitude": -0.12767,
"nearest": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
},
"postcodes": [
"SW1A 2AA"
],
"radius_metres": 100,
"results": [
{
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
],
"widesearch": false
}Reverse geocode coordinates in bulk
Turn many coordinate pairs into UK postcodes in one step: a day of GPS readings, a set of pins, a list of site locations. Every point gets its own row with the nearest postcode and everything else in range, and the points that matched nothing are counted rather than left as gaps. Postcodes.io takes 100 points per request and refuses more, so a longer list is batched automatically, up to 1,000. No API key required.
Inputs
- Coordinates
coordinateslistRequired - The points to look up, latitude first, as a person reads them off a map. Give one 'latitude, longitude' pair per line, or a list of objects with 'longitude' and 'latitude'. Up to 1,000 points.
- How many results
limitnumber - How many postcodes to return, from 1 to 100, nearest first. Leave empty for 10.From 1 to 100. Default:
10. - Search radius (meters)
radiusnumber - How far out to look, in meters, from 1 to 2,000. Leave empty for 100m, which is a street rather than a neighborhood: raise it for a rural address, where the nearest postcode can be a kilometer away.From 1 to 2000. Default:
100. - Wide search
widesearchtrue/false - Look out to 20km instead of using the radius above. Turn this on for a point in open country, where the default 100m finds nothing. It is not simply a wider version of the same search: it ignores the radius entirely and returns at most 10 results however many were asked for.Default:
false. - Fields to return
fieldslist - Trim every result down to just these fields, which keeps a hundred-postcode answer small. Leave empty to get everything. Postcodes.io only filters on the fields listed here and silently ignores any other name, so anything else is refused rather than quietly returning the lot. Note that a trimmed result skips the extra fields this integration adds, such as the map link and the plain-English position quality, because those are worked out from fields the filter may have removed.One or more of:
postcode,longitude,latitude,eastings(Eastings (British National Grid)),northings(Northings (British National Grid)),quality(Positional quality (1 to 9)),country,region,admin_district(Local authority district),admin_county(County), and 14 more.
Outputs
fieldslist- The fields each record was trimmed to. Empty for all.
foundtrue/false- Whether at least one point had a postcode in range.
limitnumber- The most postcodes each point could get. 10 at most on a wide search.
matched_countnumber- How many points had a postcode in range.
radius_metresnumber- How far out each search looked, in meters.
request_countnumber- How many requests the batches took.
requested_countnumber- How many points were sent.
resultslist- One row per point sent, in the order sent.
unmatched_countnumber- How many points had none.
widesearchtrue/false- Whether wide search was on.
Example output
{
"fields": [],
"found": true,
"limit": 10,
"matched_count": 1,
"radius_metres": 100,
"request_count": 1,
"requested_count": 1,
"results": [
{
"count": 1,
"found": true,
"latitude": 51.503541,
"longitude": -0.12767,
"nearest": {
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
},
"postcodes": [
"SW1A 2AA"
],
"results": [
{
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": 0.0,
"distance_km": 0.0,
"distance_metres": 0.0,
"distance_miles": 0.0,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
]
}
],
"unmatched_count": 0,
"widesearch": false
}Reverse geocode to outward codes
Turn a longitude and latitude into the outward codes around it, nearest first, each with how far its center is from the point. A coarser and much smaller answer than a full postcode: this is the step for 'roughly which postal area is this?', or for grouping a set of points into districts. It works where a postcode lookup finds nothing, because the default radius is 5km rather than 100 meters. No API key required.
Inputs
- Longitude
longitudenumberRequired - The east-west coordinate, in WGS84 decimal degrees. Negative is west of Greenwich, which is most of the UK.From -180.0 to 180.0.
- Latitude
latitudenumberRequired - The north-south coordinate, in WGS84 decimal degrees.From -90.0 to 90.0.
- How many results
limitnumber - How many outward codes to return, from 1 to 100, nearest first. Leave empty for 10.From 1 to 100. Default:
10. - Search radius (meters)
radiusnumber - How far out to look, in meters, from 1 to 25,000. Leave empty for 5,000m. Outward codes are much further apart than postcodes, which is why this reaches further than the postcode search does.From 1 to 25000. Default:
5000.
Outputs
countnumber- How many outward codes came back.
foundtrue/false- Whether any outward code was in range.
latitudenumber- The latitude searched around.
limitnumber- The most that could have come back.
longitudenumber- The longitude searched around.
nearestobject- One outward code, with every area its postcodes fall in. Null when there was nothing to return.
outcodeslist- The outward codes found, nearest first.
radius_metresnumber- How far out the search looked, in meters.
resultslist- The record of each, nearest first, with its distance.
Example output
{
"count": 1,
"found": true,
"latitude": 54.9724,
"limit": 1,
"longitude": -1.6115,
"nearest": {
"admin_county": [],
"admin_district": [
"Newcastle upon Tyne"
],
"admin_ward": [
"Monument",
"Ouseburn"
],
"constituency_count": 2,
"country": [
"England"
],
"distance": 3.5,
"distance_km": 0.004,
"distance_metres": 3.5,
"distance_miles": 0.002,
"district_count": 1,
"eastings": 424966,
"has_coordinates": true,
"latitude": 54.97241814044942,
"longitude": -1.6115445936329582,
"map_url": "https://www.openstreetmap.org/?mlat=54.972418&mlon=-1.611545#map=16/54.972418/-1.611545",
"northings": 564268,
"not_applicable": [
"admin_county"
],
"outcode": "NE1",
"parish": [
"Newcastle upon Tyne, unparished area"
],
"parliamentary_constituency": [
"Newcastle upon Tyne Central and West",
"Newcastle upon Tyne East and Wallsend"
],
"summary": "NE1 - Newcastle upon Tyne",
"ward_count": 2
},
"outcodes": [
"NE1"
],
"radius_metres": 5000,
"results": [
{
"admin_county": [],
"admin_district": [
"Newcastle upon Tyne"
],
"admin_ward": [
"Monument",
"Ouseburn"
],
"constituency_count": 2,
"country": [
"England"
],
"distance": 3.5,
"distance_km": 0.004,
"distance_metres": 3.5,
"distance_miles": 0.002,
"district_count": 1,
"eastings": 424966,
"has_coordinates": true,
"latitude": 54.97241814044942,
"longitude": -1.6115445936329582,
"map_url": "https://www.openstreetmap.org/?mlat=54.972418&mlon=-1.611545#map=16/54.972418/-1.611545",
"northings": 564268,
"not_applicable": [
"admin_county"
],
"outcode": "NE1",
"parish": [
"Newcastle upon Tyne, unparished area"
],
"parliamentary_constituency": [
"Newcastle upon Tyne Central and West",
"Newcastle upon Tyne East and Wallsend"
],
"summary": "NE1 - Newcastle upon Tyne",
"ward_count": 2
}
]
}Search places
Find British places by name, from Ordnance Survey's Open Names: towns, villages, suburbs, hamlets and other gazetteer entries, each with its county, region, country, outward code and coordinates. Use it to turn a place name a person typed into a real location. Welsh and Gaelic names are matched too and come back alongside the English one. Great Britain only: Northern Ireland is not in this dataset. No API key required.
Inputs
- Place name
querytextRequired - The name to search for, whole or partial. Matches the primary name and the Welsh or Gaelic one.
- How many results
limitnumber - How many places to return, from 1 to 100. Leave empty for 10.From 1 to 100. Default:
10.
Outputs
countnumber- How many places came back.
foundtrue/false- Whether any place matched.
limitnumber- The most that could have come back.
nameslist- The names of the places found, in order.
querytext- The name that was searched for.
resultslist- The full record of each place found.
Example output
{
"count": 1,
"found": true,
"limit": 10,
"names": [
"Edinburgh"
],
"query": "Edinburgh",
"results": [
{
"alternate_name": null,
"alternate_name_language": null,
"code": "osgb4000000074558316",
"country": "Scotland",
"county_unitary": "City of Edinburgh",
"county_unitary_type": "UnitaryAuthority",
"district_borough": null,
"district_borough_type": null,
"eastings": 325847,
"has_coordinates": true,
"latitude": 55.95334432795488,
"local_type": "City",
"longitude": -3.1891056108178377,
"map_url": "https://www.openstreetmap.org/?mlat=55.953344&mlon=-3.189106#map=16/55.953344/-3.189106",
"max_eastings": 332818,
"max_northings": 678272,
"min_eastings": 315137,
"min_northings": 665348,
"name": "Edinburgh",
"name_1": "Edinburgh",
"name_1_lang": null,
"name_2": null,
"name_2_lang": null,
"northings": 674007,
"outcode": "EH1",
"region": "Scotland",
"summary": "Edinburgh - City of Edinburgh, Scotland (City)"
}
]
}Search postcodes
Find live UK postcodes that start with a string, each with its full record. Use it to turn a partial postcode into real ones, or an outward code into the postcodes inside it. Exact matches win: searching for a postcode the service holds returns that one rather than everything sharing its prefix. Terminated postcodes are never returned. Use Autocomplete a postcode instead when only the postcode strings are wanted. No API key required.
Inputs
- Search for
querytextRequired - A whole or partial postcode. An outward code such as 'SW1A' returns the postcodes inside it. The search ignores the space, so give one letter after it: 'EH1 1' also matches EH11, but 'EH1 1Y' does not.
- How many results
limitnumber - How many postcodes to return, from 1 to 100. Leave empty for 10.From 1 to 100. Default:
10.
Outputs
countnumber- How many postcodes came back.
foundtrue/false- Whether any postcode matched.
limitnumber- The most that could have come back.
postcodeslist- The postcodes found, in order.
querytext- What was searched for.
resultslist- The full record of each postcode found.
Example output
{
"count": 1,
"found": true,
"limit": 10,
"postcodes": [
"SW1A 2AA"
],
"query": "SW1A",
"results": [
{
"admin_county": null,
"admin_district": "Westminster",
"admin_ward": "St James's",
"bua": "City of Westminster",
"cancer_alliance": "West London",
"ccg": "NHS West and North London",
"ced": null,
"codes": {
"admin_county": "E99999999",
"admin_district": "E09000033",
"admin_ward": "E05013806",
"bua": "E63012036",
"cancer_alliance": "E56000021",
"ccg": "E38000256",
"ccg_id": "W2U3Z",
"ced": "E99999999",
"icb": "E54000071",
"lau2": "E09000033",
"lep1": "E37000051",
"lep2": null,
"lsoa": "E01004736",
"lsoa11": "E01004736",
"lsoa21": "E01004736",
"msoa": "E02000977",
"msoa11": "E02000977",
"msoa21": "E02000977",
"national_park": "E65000001",
"nhs_region": "E40000003",
"nuts": "TLI35",
"oa21": "E00023936",
"parish": "E43000236",
"parliamentary_constituency": "E14001172",
"parliamentary_constituency_2024": "E14001172",
"pfa": "E23000001",
"ruc11": "A1",
"ruc21": "UN1",
"ttwa": "E30000234"
},
"country": "England",
"date_of_introduction": "198001",
"date_of_termination": null,
"distance": null,
"distance_km": null,
"distance_metres": null,
"distance_miles": null,
"eastings": 530047,
"european_electoral_region": "London",
"has_coordinates": true,
"icb": "NHS West and North London Integrated Care Board",
"incode": "2AA",
"index_of_multiple_deprivation": 24862,
"introduced_on": "1980-01",
"latitude": 51.503541,
"lep1": "London",
"lep2": null,
"longitude": -0.12767,
"lsoa": "Westminster 018C",
"lsoa11": "Westminster 018C",
"lsoa21": "Westminster 018C",
"map_url": "https://www.openstreetmap.org/?mlat=51.503541&mlon=-0.12767#map=16/51.503541/-0.12767",
"msoa": "Westminster 018",
"msoa11": "Westminster 018",
"msoa21": "Westminster 018",
"national_park": "England (non-National Park)",
"nhs_ha": "London",
"nhs_region": "London",
"northings": 179951,
"not_applicable": [
"admin_county",
"ced"
],
"nuts": "Westminster",
"oa21": "E00023936",
"outcode": "SW1A",
"parish": "Westminster, unparished area",
"parliamentary_constituency": "Cities of London and Westminster",
"parliamentary_constituency_2024": "Cities of London and Westminster",
"pfa": "Metropolitan Police",
"postcode": "SW1A 2AA",
"primary_care_trust": "Westminster",
"quality": 1,
"quality_description": "Within the building of the matched address closest to the postcode mean",
"region": "London",
"ruc11": "(England/Wales) Urban major conurbation",
"ruc21": "Urban: Nearer to a major town or city",
"senedd_constituency": null,
"senedd_constituency_no": null,
"summary": "SW1A 2AA - St James's, Westminster, London",
"ttwa": "London"
}
]
}Validate a postcode
Check whether a string is a live UK postcode. This is a real existence check against the Office for National Statistics postcode directory, not a format check: 'ZZ99 9ZZ' is correctly shaped and is not a postcode, and this says so. When the answer is no, the step also says whether the postcode used to exist and when it was withdrawn, so an address form can tell a customer 'that postcode was retired in 2018' rather than just rejecting it. Ideal in a condition before the rest of a workflow runs. No API key required.
Inputs
- Postcode
postcodetextRequired - A UK postcode. Spacing and capitalization do not matter: 'sw1a2aa' and 'SW1A 2AA' reach the same record.
Outputs
messagetext- The verdict in one sentence.
postcodetext- The postcode checked, in capitals with its space.
terminatedtrue/false- Whether it is a real postcode that has been withdrawn.
terminated_recordobject- A postcode that has been withdrawn, and when. Null when the postcode was not a withdrawn one.
validtrue/false- Whether it is a live UK postcode.
Example output
{
"message": "SW1A 2AA is a live UK postcode.",
"postcode": "SW1A 2AA",
"terminated": false,
"terminated_record": null,
"valid": true
}