Area and location
Nearest Amenities API
The nearest rail stations, metro and tram stops, GP practices, hospitals, pharmacies, supermarkets and everyday services to a UK postcode or point, with straight-line distances and walking times.
Nearest amenities
/api/v1/area/nearest-amenitiesFor each category, the nearest named places to a postcode or coordinates, nearest first. Each place has its distance in metres, a walking time, its coordinates and where the data came from.
Each call costs 1 credit. Requests that return an error are not charged.
| Name | Required | Type | Description |
|---|---|---|---|
| postcode | One of | string | Full UK postcode. |
| latitude | One of | number | Latitude, with longitude, when postcode is omitted. |
| longitude | One of | number | Longitude, with latitude, when postcode is omitted. |
| categories | No | string | Comma-separated list of categories, for example rail_station,supermarket. Omit for every category. |
Distances are straight lines, not routes. walkingMinutes assumes 80 metres a minute, so real walks take longer. Places more than 50 km away are not returned, so a category can be an empty list. GP practices, hospitals and pharmacies cover England only and sit at the centre of their postcode.
Example request
curl -X GET "https://propertyinsights.co.uk/api/v1/area/nearest-amenities?postcode=ZZ1%201AA&categories=rail_station,gp_practice,supermarket" \
-H "x-api-key: YOUR_API_KEY"Example response
The postcode, places and distances below are illustrative.
{
"success": true,
"data": {
"input": {
"postcode": "ZZ1 1AA",
"latitude": 51.4545,
"longitude": -2.5879
},
"amenities": {
"rail_station": [
{
"name": "Exampleton Rail Station",
"distanceMetres": 640,
"walkingMinutes": 8,
"latitude": 51.4491,
"longitude": -2.5813,
"source": "naptan",
"details": {
"atcoCode": "9100EXMPLTN",
"stopType": "RLY",
"locality": "Exampleton"
}
}
],
"gp_practice": [
{
"name": "EXAMPLE ROAD SURGERY",
"distanceMetres": 410,
"walkingMinutes": 5,
"latitude": 51.4561,
"longitude": -2.5831,
"source": "nhs_ods",
"details": {
"odsCode": "Z00001",
"postcode": "ZZ1 2AB",
"location": "postcode_centroid"
}
},
{
"name": "HIGH STREET MEDICAL CENTRE",
"distanceMetres": 880,
"walkingMinutes": 11,
"latitude": 51.4602,
"longitude": -2.5948,
"source": "nhs_ods",
"details": {
"odsCode": "Z00002",
"postcode": "ZZ1 3CD",
"location": "postcode_centroid"
}
}
],
"supermarket": [
{
"name": "Example Foods",
"distanceMetres": 230,
"walkingMinutes": 3,
"latitude": 51.4538,
"longitude": -2.585,
"source": "osm",
"details": {
"osmType": "node",
"osmId": 1000000001,
"brand": "Example Foods"
}
},
{
"name": "Corner Market",
"distanceMetres": 520,
"walkingMinutes": 7,
"latitude": 51.458,
"longitude": -2.591,
"source": "osm",
"details": {
"osmType": "way",
"osmId": 1000000002
}
}
]
},
"searchRadiusMetres": 50000,
"methodology": "Straight-line distances. walkingMinutes assumes 80 metres a minute in a straight line, so real walks take longer.",
"sources": {
"naptan": {
"name": "National Public Transport Access Nodes (NaPTAN), Department for Transport",
"url": "https://beta-naptan.dft.gov.uk/",
"licence": "Open Government Licence v3.0",
"coverage": "Great Britain"
},
"nhs_ods": {
"name": "NHS England Organisation Data Service",
"url": "https://www.odsdatasearchandexport.nhs.uk/",
"licence": "Open Government Licence v3.0",
"coverage": "England",
"note": "Placed at the postcode centroid from the ONS National Statistics Postcode Lookup (OGL), so distances are approximate."
},
"osm": {
"name": "OpenStreetMap contributors",
"url": "https://www.openstreetmap.org/copyright",
"licence": "Open Database License (ODbL) 1.0",
"attribution": "© OpenStreetMap contributors",
"coverage": "United Kingdom"
}
}
}
}Billing details in the response
Successful chargeable JSON responses include a top-level billing object. The endpoint examples on this page focus on the endpoint-specific data, so this repeated block may not be shown in every example.
"billing": {
"mode": "prepaid",
"creditsCharged": 1,
"creditsRemaining": 1999,
"creditsRefreshAt": "2026-08-14T09:30:00.000Z"
}| Field or header | Meaning |
|---|---|
| billing.creditsCharged X-Credits-Charged | Credits charged by this call. Failed and non-chargeable calls return 0 in the header. |
| billing.creditsRemaining X-Credits-Remaining | The credit balance after the call. |
| billing.creditsRefreshAt X-Credits-Refresh-At | The next monthly credit refresh as an ISO 8601 timestamp. Trial and non-renewing balances return null and omit the header. |
All authenticated API-key calls expose the billing headers, including validation errors and zero-credit status or management requests. Only successful chargeable JSON responses add the billing object to the response body.
When credits run out
If your balance is lower than the cost of a request, the API returns HTTP 402 and charges nothing. The error includes the credits needed, your balance and a link to change plan.
{
"statusCode": 402,
"statusMessage": "Payment Required",
"data": {
"success": false,
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "This request costs 35 API credits. Upgrade your plan or wait for your monthly refresh: https://propertyinsights.co.uk/billing",
"required": 35,
"available": 12,
"upgradeUrl": "https://propertyinsights.co.uk/billing"
}
}
}Categories
| Category | What it covers | Places returned | Source |
|---|---|---|---|
| rail_station | National Rail and other rail stations | Up to 3 | NaPTAN |
| metro_tram_stop | Underground, metro and tram stops | Up to 3 | NaPTAN |
| gp_practice | Open GP practices | Up to 3 | NHS ODS |
| hospital | NHS sites with "hospital" in the name | Up to 3 | NHS ODS |
| pharmacy | Open community pharmacies | Up to 3 | NHS ODS |
| supermarket | Supermarkets | Up to 5 | OpenStreetMap |
| cafe | Cafes and coffee shops | Up to 3 | OpenStreetMap |
| restaurant | Restaurants | Up to 3 | OpenStreetMap |
| gym | Gyms and fitness centres | Up to 3 | OpenStreetMap |
| post_office | Post offices | Up to 3 | OpenStreetMap |
| petrol_station | Petrol stations | Up to 3 | OpenStreetMap |
Sources and coverage
| Source | Licence | Geography | Updated |
|---|---|---|---|
| NaPTAN, Department for Transport | Open Government Licence v3.0 | Great Britain | Monthly reload |
| NHS England Organisation Data Service | Open Government Licence v3.0 | England | Monthly reload |
| OpenStreetMap (Geofabrik UK extract) | Open Database License (ODbL) 1.0 | United Kingdom | Monthly reload |
Each response lists the sources behind the categories it returns. If you show OpenStreetMap places to your users, credit "© OpenStreetMap contributors" as the ODbL requires. NaPTAN and NHS ODS data are published under the Open Government Licence v3.0.
OpenAPI specification
Authentication, parameters, billing headers and response schemas are also published in the machine-readable OpenAPI documents in JSON and YAML.