Skip to content
Alpha — Headcode is currently in alpha. APIs and data may change without notice.

Locations

Service calling patterns sometimes include TIPLOCs that are not passenger stations — junctions, sidings, depots, signal boxes and timing points. The Locations API identifies what these places are.

If a TIPLOC belongs to a passenger station, use the Stations API (GET /v1/stations/{id}). If it is an operational location — infrastructure that trains pass through but passengers do not use — use the Locations API. A station lookup will not return operational locations, and a location lookup will return 404 for passenger stations.

GET /v1/locations/{tiploc}

Returns a single location:

{
"tiploc": "ABWLCHJ",
"name": "Abbey Wood Jn",
"location_type": "junction",
"latitude": 51.5308,
"longitude": -0.1238
}

The location_type field is one of: junction, siding, depot, signal_box, timing_point or unknown.

Returns 404 with error code HEADCODE.LOCATIONS.NOT_FOUND if the TIPLOC is unknown or belongs to a passenger station.

GET /v1/locations

Search and filter locations using query parameters:

ParameterDescription
queryFree-text search against location names (supports partial and misspelled input)
typeFilter by location type (junction, siding, depot, signal_box, timing_point, unknown)
lat, lngCentre point for a spatial search (WGS84 coordinates, both required together)
radiusMaximum distance in metres from the centre point (default 1000)
limitMaximum results to return (default 20, max 100)
offsetNumber of results to skip for pagination

The response includes pagination metadata:

{
"locations": [ ... ],
"total": 142,
"limit": 20,
"offset": 0
}

Find all junctions near London:

GET /v1/locations?type=junction&lat=51.5074&lng=-0.1278&radius=5000

Search by name:

GET /v1/locations?query=abbey

You fetch a service and its calling points include the TIPLOC ABWLCHJ, which is not in the Stations API:

GET /v1/locations/ABWLCHJ

The response tells you this is “Abbey Wood Jn”, a junction. You can now label it appropriately in your UI or filter it out of a passenger-facing display while keeping it in an operational view.