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

GET/api/v1/area/nearest-amenities

For 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.

NameRequiredTypeDescription
postcodeOne ofstringFull UK postcode.
latitudeOne ofnumberLatitude, with longitude, when postcode is omitted.
longitudeOne ofnumberLongitude, with latitude, when postcode is omitted.
categoriesNostringComma-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 headerMeaning
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

CategoryWhat it coversPlaces returnedSource
rail_stationNational Rail and other rail stationsUp to 3NaPTAN
metro_tram_stopUnderground, metro and tram stopsUp to 3NaPTAN
gp_practiceOpen GP practicesUp to 3NHS ODS
hospitalNHS sites with "hospital" in the nameUp to 3NHS ODS
pharmacyOpen community pharmaciesUp to 3NHS ODS
supermarketSupermarketsUp to 5OpenStreetMap
cafeCafes and coffee shopsUp to 3OpenStreetMap
restaurantRestaurantsUp to 3OpenStreetMap
gymGyms and fitness centresUp to 3OpenStreetMap
post_officePost officesUp to 3OpenStreetMap
petrol_stationPetrol stationsUp to 3OpenStreetMap

Sources and coverage

SourceLicenceGeographyUpdated
NaPTAN, Department for TransportOpen Government Licence v3.0Great BritainMonthly reload
NHS England Organisation Data ServiceOpen Government Licence v3.0EnglandMonthly reload
OpenStreetMap (Geofabrik UK extract)Open Database License (ODbL) 1.0United KingdomMonthly 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.