Guides
- UK bus times in Python
- Live UK train departures
- Journey planning that knows about hills
- Where can I get to in 30 minutes?
- How reliable is my bus?
Docs
Where can I get to in 30 minutes?
Two questions a journey planner can't answer: "where can I get to in half an hour?" and "which of these places is quickest to reach?". This guide answers both for any point in Great Britain, by bus, Tube, tram, ferry and National Rail.
What you need
- Python 3.9 or later, and
pip install requests - A TransCAPI key: sign up free,
then
export TRANSCAPI_KEY=your_key
The code
import json
import os
import requests
API = "https://api.transcapi.com/v1"
HEADERS = {"X-Api-Key": os.environ["TRANSCAPI_KEY"]}
# Everywhere reachable from King's Cross in 15, 30 and 45 minutes at 9am
areas = requests.get(f"{API}/journey/reachable.json", headers=HEADERS, params={
"lat": 51.5308, "lon": -0.1238,
"cutoffs": "15,30,45",
"datetime": "2026-10-01T09:00:00",
}).json()
for feature in areas["features"]:
p = feature["properties"]
print(f"{p['minutes']:>3} min: {p['area_km2']:>6} km², {p['stops_reached']:,} stops")
# It's GeoJSON: save it and drop it on any map (Leaflet, MapLibre, geojson.io)
with open("kings-cross.geojson", "w") as f:
json.dump(areas, f)
# Or ask how long to each of several places in one request
offices = [
{"id": "Canary Wharf", "lat": 51.5054, "lon": -0.0235},
{"id": "Stratford", "lat": 51.5416, "lon": -0.0033},
{"id": "Croydon", "lat": 51.3762, "lon": -0.0982},
{"id": "Reading", "lat": 51.4588, "lon": -0.9716},
]
times = requests.post(f"{API}/journey/travel_times.json", headers=HEADERS, json={
"from": {"lat": 51.5308, "lon": -0.1238},
"to": offices,
"datetime": "2026-10-01T09:00:00",
}).json()
for r in sorted(times["results"], key=lambda r: r["minutes"] or 999):
print(f"{r['id']:<14} {r['minutes'] if r['minutes'] is not None else 'over 90'} min")
Run it:
$ python reachable_map.py
45 min: 522.0 km², 12,167 stops
30 min: 135.6 km², 4,898 stops
15 min: 11.7 km², 784 stops
Stratford 20.6 min
Canary Wharf 26.6 min
Croydon 42.4 min
Reading 46.3 min
Real output, for 9am on 1 October 2026. The map above is
kings-cross.geojson drawn with MapLibre.
Reachable areas
/v1/journey/reachable.json takes a point, up to four
cutoffs in minutes (each up to 90) and a departure
datetime from now until the end of tomorrow. It returns a GeoJSON
FeatureCollection, one feature per cutoff, largest first, so drawing them in
order puts the smallest on top. Each has minutes,
area_km2 and stops_reached.
Expect islands. A railway reaches Watford or Hatfield before a bus reaches the suburbs in between, and the map shows that. It's exactly what a single "within 10 km" circle hides.
Travel times to many places
/v1/journey/travel_times.json takes one origin and up to 500
destinations, each with an optional id of your own, and returns
minutes to each in the order given, null where it's beyond
max_minutes. It's one request, not 500 journey plans, which makes
it the tool for "show homes within 40 minutes of the office" or sorting venues
by how easy they are to reach.
How it's worked out, and the one approximation
Both scan every scheduled departure from the start time, across the whole day's timetable, so they're fast: a London map takes about a second. Times come from the timetable, not live running. Walking to the first stop, between stops and from the last stop is estimated from straight-line distance with an allowance for streets, so edges are good estimates rather than street-exact, and a travel time can differ by a few minutes from a full journey plan. For the exact route, use journey planning.
All the parameters are in the journey docs.
Try it. A free key gives you 1,000 requests a day with no card. Every endpoint covers Great Britain: see coverage for the parts that are regional.