Area and location

Nearest Amenities API

The nearest rail stations, metro and tram stops, bus stops, ferry terminals, GP practices, hospitals, pharmacies, supermarkets and everyday services to a UK postcode or point, with straight-line distances and walking times. It works as a points of interest API for UK property and location checks.

Amenities API: nearest places to a postcode

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 come from NHS ODS in England and Wales and Public Health Scotland in Scotland, and sit at the centre of their postcode. Bus stops are listed one per pole or bus station bay, so the stops on both sides of a road can appear: details.indicator (for example "opp" or "Bay 4") and details.bearing tell them apart. A stop listed in NaPTAN may not have a current service.

Example request

curl -X GET "https://propertyinsights.co.uk/api/v1/area/nearest-amenities?postcode=ZZ1%201AA&categories=rail_station,bus_stop,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"
          }
        }
      ],
      "bus_stop": [
        {
          "name": "Example Road",
          "distanceMetres": 90,
          "walkingMinutes": 1,
          "latitude": 51.4552,
          "longitude": -2.5873,
          "source": "naptan",
          "details": {
            "atcoCode": "0100EXMPL001",
            "stopType": "BCT",
            "locality": "Exampleton",
            "indicator": "opp",
            "bearing": "NW",
            "busStopType": "marked"
          }
        },
        {
          "name": "Example Road",
          "distanceMetres": 110,
          "walkingMinutes": 1,
          "latitude": 51.4554,
          "longitude": -2.5876,
          "source": "naptan",
          "details": {
            "atcoCode": "0100EXMPL002",
            "stopType": "BCT",
            "locality": "Exampleton",
            "indicator": "adj",
            "bearing": "SE",
            "busStopType": "marked"
          }
        }
      ],
      "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 and Wales",
        "note": "Placed at the postcode centroid from the ONS National Statistics Postcode Lookup (OGL), so distances are approximate."
      },
      "phs": {
        "name": "Public Health Scotland open data",
        "url": "https://www.opendata.nhs.scot/",
        "licence": "Open Government Licence v3.0",
        "coverage": "Scotland",
        "note": "GP practices, NHS hospitals and dispensers. 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, subway and tram stopsUp to 3NaPTAN
bus_stopBus and coach stops and bus station bays, one entry per pole or bay. Includes hail and ride sections, not flexible service zonesUp to 5NaPTAN
ferry_terminalFerry terminals, piers and landings, including river and lake servicesUp to 3NaPTAN
gp_practiceOpen GP practicesUp to 3NHS ODS, Public Health Scotland
hospitalNHS sites named as a hospital (or "ysbyty" in Wales)Up to 3NHS ODS, Public Health Scotland
pharmacyOpen community pharmacies and dispensersUp to 3NHS ODS, Public Health Scotland
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.0England and WalesMonthly reload
Public Health Scotland open dataOpen Government Licence v3.0ScotlandMonthly 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, NHS ODS and Public Health Scotland 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.