Transport
Copy link

This page covers two kinds of transport data:

  • Transit: public transport stations, stops and lines, for modes such as rail, bus, coach and ferry
  • Roads: major roads and where you get on or off them

This page answers questions such as:

  • Which stations are within walking distance?
  • Which lines connect these two stations?
  • Where's the nearest motorway entry?

Stations and lines come from our public transport data (traveltime_pt). Major roads and their entries and exits come from Overture Maps (overture). /v1/catalog/{country} lists the transit modes and operators in a country, and gives the updated_at of each dataset, which is the date it was last loaded.

Request headers
Copy link

Required authentication header. Use the same application id as for the TravelTime API.

string

Required authentication header.

Stations and stops
Copy link

GET /v1/transport/transit/stations

Get the stations and stops in a location. Stops that are grouped under a station are left out. With q, results are sorted by best match. Otherwise they are sorted nearest first with near, in the order sent with cells, or by id.

For long cell lists, POST /v1/transport/transit/stations takes the same fields as a JSON body (see Long requests).

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
qtext—Search by name, with the best match first. Requires a location, or country to search the whole country. Has no next page, so raise limit to get more results.q=kings+cross
modetransit mode—Only return stations that this mode serves, either at the station's own stop or on a line that calls there. One of bus, cable_car, coach, ferry, overground, rail or underground.mode=underground

The endpoint also takes the following common parameters:

Each result has these fields:

  • id (st_gb_…)
  • name
  • modes: a list of the station's own mode and the modes of its lines
  • lat and lng, in degrees
  • cell: its resolution-9 H3 cell
  • line_count: the number of lines that call there
  • trips_per_hour: departures per hour in each of am_peak, interpeak, pm_peak, evening and weekend, or null for a period with none
  • trips_per_week: the number of trips a week that call there
  • distance_m: the distance in metres, only with near

Errors

CodeHTTPWhen
location_required400The request has no near, bbox, cells or at, or it has q with neither a location nor country.
country_not_allowed400country is sent without q.
invalid_mode400mode is not a transit mode. allowed lists them.

All the location and paging error codes also apply.

Examples

All 41 stops and stations within 800 m of King's Cross station, nearest first, each with its distance.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations?near=51.5309,-0.1229&radius_m=800"
200 · 41 stations

41 pins inside the 800 m circle; a pin opens its row.

All 81 stations inside a map viewport.

The 15 stations inside seven H3 cells around Euston Square, in the order the cells were sent.

Search for a station by name to get its id. This returns 16 matches across the country, with the best match first.

Filter by mode to get only the Underground stations within 1.5 km, of which there are 9.

One station
Copy link

GET /v1/transport/transit/stations/{id}

Get one station or stop, with every line that calls there, the stations near it and, for a stop, the station it is grouped under.

The response has the same fields as a list result, plus:

  • lines: every line that calls there, as {id, name, operator, mode}, with rail first, then underground, overground, ferry, coach, bus and cable car
  • nearby: up to 5 stations within 500 m, as {id, name, modes, lat, lng, distance_m}
  • parent: for a stop, the id of the station it is grouped under, or null

Errors

CodeHTTPWhen
invalid_id400The id is not a station id (st_gb_…).
not_found404There is no station with this id.
Examples

London Kings Cross, with the 48 lines that call there and the five stations nearest to it.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations/st_gb_218003af11f9"
200 · one station

1 pin; it opens its row.

Stations per H3 cell
Copy link

GET /v1/transport/transit/stations/cells

Count the stations in each H3 cell, with a count per mode. With a boundary type, such as group_by=borough, you get one row per boundary, and with group_by=all you get one total for everything you send. With include=walk_15_min, you also get what a 15-minute walk reaches. Only stations are counted, not the stops grouped under them, so the counts cover the same stations that the list returns. For long cell lists, POST /v1/transport/transit/stations/cells takes the same fields as a JSON body.

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
includewalk_15_min—Adds walk_15_min: whether a station is within a 15-minute walk, and how many. Walk times exist for Australia, France, Germany, Lithuania, the Netherlands, Spain, Sweden, Switzerland, the United Kingdom and the United States.include=walk_15_min

The endpoint also takes the following common parameters:

Each result has a cell, a count of stations and mode_counts, the number of stations per mode with the most first. With group_by=all, there is one row with cell_count, count and mode_counts, and with a boundary type, one such row per boundary, with its boundary.

With include=walk_15_min, each cell's row has a walk_15_min block. Walk times are worked out per res-9 cell, so a res-10 cell reads its parent, and a coarser cell is covered if any res-9 cell in it is.

  • covered: true if a station is within a 15-minute walk
  • stations: the number of stations within a 15-minute walk. For a cell coarser than res 9, it is the most that any one of its res-9 cells reaches
  • modes: the modes of those stations
  • operators: the operators serving them, each as {id, name}. At resolutions 6 to 8, up to the 50 that serve most of the cell
  • lines: the number of lines calling at those stations

Neighbouring cells reach the same stations and lines, so stations and lines cannot be added up over cells. In a total (group_by=all or a boundary type, at resolution 9 or coarser), walk_15_min instead has people_covered, the residents with a station within a 15-minute walk, people, all the residents, people_covered_share, from 0 to 1, operator_count, and lines, with each operator and line counted once.

The rollup is sum for the counts, ratio_of_sums for people_covered_share, and distinct for operator_count and lines.

Errors

CodeHTTPWhen
invalid_resolution400resolution is outside 6 to 10, the resolutions that transit data has, or is not 9 with a boundary type in group_by, or is 10 for a walk_15_min total. allowed lists the valid ones.
invalid_group_by400group_by is not cell, all or a boundary type the country has. allowed lists them.
invalid_include400include is anything other than walk_15_min.
too_many_cells400A walk_15_min total at resolution 8 is sent more res-8 cells than the country's walk times can read in one request. allowed_max gives the maximum.
invalid_format400geojson is requested with group_by=all.

All the location and paging error codes also apply.

1. Send one cell, get one row
Copy link

Put the id of one H3 cell in cells. You get back one row for that cell. count is the number of stations in it, and mode_counts splits them by mode.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations/cells?cells=89195da4d03ffff"

You get

{
  "resolution": 9,
  "results": [
    {
      "cell": "89195da4d03ffff",
      "count": 5,
      "mode_counts": {
        "bus": 4,
        "underground": 1
      }
    }
  ],
  "next_cursor": null
}

2. Send several cells, get one row for each
Copy link

Separate the cell ids with commas. You get one row for each cell, in the order you sent them. These seven cells lie between Euston and St Pancras. The map shades each cell by its number of stations, from 1 to 5. Select a cell to see its row.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff"
200 · 7 H3 cells

Shade = count157 H3 cells; click a cell to open its row.

3. Add them up: one row for all the cells
Copy link

Add group_by=all to get one total row instead. The same seven cells hold 15 stations: 12 bus, 2 rail and 1 Underground. These are the same 15 stations that the list returns.

For a long list of cells, send POST /v1/transport/transit/stations/cells with the same fields in a JSON body. See Long requests.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff&group_by=all"

You get

{
  "resolution": 9,
  "results": [
    {
      "cell_count": 7,
      "count": 15,
      "mode_counts": {
        "bus": 12,
        "rail": 2,
        "underground": 1
      }
    }
  ],
  "next_cursor": null,
  "rollup": {
    "cell_count": "sum",
    "count": "sum",
    "mode_counts": "sum"
  }
}

4. No cell ids yet? Send an area
Copy link

Send bbox (south, west, north, east) for a box, or near and radius_m for a circle. You get one row for every cell in the area, and each row has its cell id. This box around King's Cross holds 39 cells, with 0 where there are no stations.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/stations/cells?bbox=51.522,-0.140,51.538,-0.110"

Public transport lines
Copy link

GET /v1/transport/transit/lines

Get the lines that have a stop inside a location, the lines that stop at every station in serves, or the lines run by one operator. With q, results are sorted by best match; otherwise they are sorted by id. For long cell lists, POST /v1/transport/transit/lines takes the same fields as a JSON body.

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
servesstation ids—Returns the lines that stop at every station in the comma-separated list. It takes the place of a location, so don't send one with it.serves=st_gb_7d4f15682232,st_gb_63a8aa9929e4
operatoroperator id—Returns the lines run by this operator. /v1/catalog/{country} lists the operator ids. It takes the place of a location, so don't send one with it.operator=london_underground_tfl
modetransit mode—Only return lines of this mode.mode=bus
qtext—Search by name or number, with the best match first. Requires a location or country. Has no next page, so raise limit to get more results.q=victoria
includestops—Adds each line's stops, in the same format as for one line. A page then holds up to 100 rows.include=stops

The endpoint also takes the following common parameters:

Each result has these fields:

  • id (ln_gb_…)
  • name
  • operator, as {id, name}
  • mode
  • stop_count: the number of stops
  • trips_per_hour: as for stations
  • stops: only with include=stops, in the same format as for one line

Errors

CodeHTTPWhen
location_required400The request has no location, serves or operator, or it has q with neither a location nor country.
too_many_locations400The request has two of a location, serves and operator.
country_not_allowed400country is sent without q.
invalid_serves400serves holds something other than station ids, or stations from two countries.
invalid_mode400mode is not a transit mode. allowed lists them.
invalid_include400include is anything other than stops.

All the location and paging error codes also apply.

Examples

All the lines that stop somewhere inside the box. There are 215, so the first page has 100 of them.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines?bbox=51.522,-0.140,51.538,-0.110"
200 · 100 lines, more pages
NamenameOperator nameoperator.nameModemodeStop countstop_count
NL-9Replacement Servicebus19
London Kings Cross ↔ RoystonGreat Northernrail21
68Transport UKbus84
Crewe ↔ London EustonWest Midlands Trainsrail24
Hitchin ↔ London Kings CrossGreat Northernrail10

5 of the first 100 shown · next_cursor fetches the next page

The 124 lines that stop in the H3 cells you choose. Of these, 101 are rail, 19 bus, 2 Overground and 2 Underground.

The Northern and Victoria lines both connect King's Cross St. Pancras and Euston. The station ids come from Stations by mode, and include=stops adds each line's stops.

All the lines run by one operator, in this case the 11 London Underground lines.

One line
Copy link

GET /v1/transport/transit/lines/{id}

Get one line with its stops, each with its station's position, mode and number of other lines.

The response has the same fields as a list result, plus stops. Each stop has its station as {id, name}, a sequence, lat and lng, the station's mode, variant_share, the share (0–1) of the line's route variants that call there, and interchange_count, the number of other lines that call at the station. If the line counts cannot be read, the request fails with a 503. Stops on the main run come first, in sequence order. Stops off the main run (on a branch) follow, sorted by name, with sequence set to null.

Errors

CodeHTTPWhen
invalid_id400The id is not a line id (ln_gb_…).
not_found404There is no line with this id.
Examples

The Victoria line and its 16 stops, starting with Brixton.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines/ln_gb_8d9e35643776"
200 · one line
Ididln_gb_8d9e35643776
NamenameVictoria
Operator idoperator.idlondon_underground_tfl
Operator nameoperator.nameLondon Underground (TfL)
Modemodeunderground
Stop countstop_count16
Trips per hour am peaktrips_per_hour.am_peak34.4
Trips per hour interpeaktrips_per_hour.interpeak27.08
Trips per hour pm peaktrips_per_hour.pm_peak34.67
Trips per hour eveningtrips_per_hour.evening25.25
Trips per hour weekendtrips_per_hour.weekend10.27

Lines per H3 cell
Copy link

GET /v1/transport/transit/lines/cells

Count the lines that stop in each H3 cell, with a count per mode. With group_by=all, you get one total for everything you send instead. For long cell lists, POST /v1/transport/transit/lines/cells takes the same fields as a JSON body.

The endpoint also takes the following common parameters:

Each result has a cell, a count of the lines that stop there and mode_counts, the number of lines per mode. With group_by=all, there is one row with cell_count, count and mode_counts.

The rollup is distinct for count and mode_counts, so a line through ten H3 cells is counted once, and sum for cell_count.

Errors

This endpoint returns the same errors as /v1/transport/transit/stations/cells.

1. Send one cell, get one row
Copy link

Put the id of one H3 cell in cells. You get back one row for that cell. count is the number of lines that stop in it, and mode_counts splits them by mode.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines/cells?cells=89195da4d03ffff"

You get

{
  "resolution": 9,
  "results": [
    {
      "cell": "89195da4d03ffff",
      "count": 16,
      "mode_counts": {
        "bus": 14,
        "underground": 2
      }
    }
  ],
  "next_cursor": null
}

2. Send several cells, get one row for each
Copy link

Separate the cell ids with commas. You get one row for each cell, in the order you sent them. These seven cells lie between Euston and St Pancras. The map shades each cell by its number of lines, from 4 to 67. Select a cell to see its row.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff"
200 · 7 H3 cells

Shade = count4677 H3 cells; click a cell to open its row.

3. Add them up: one row for all the cells
Copy link

Add group_by=all to get one total row instead. The same seven cells are served by 124 lines. A line that stops in several of the cells is counted once.

For a long list of cells, send POST /v1/transport/transit/lines/cells with the same fields in a JSON body. See Long requests.

You send

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines/cells?cells=89195da4d03ffff,89195da4d07ffff,89195da4d0bffff,89195da4d0fffff,89195da4d13ffff,89195da4d17ffff,89195da4d1bffff&group_by=all"

You get

{
  "resolution": 9,
  "results": [
    {
      "cell_count": 7,
      "count": 124,
      "mode_counts": {
        "rail": 101,
        "bus": 19,
        "overground": 2,
        "underground": 2
      }
    }
  ],
  "next_cursor": null,
  "rollup": {
    "cell_count": "sum",
    "count": "distinct",
    "mode_counts": "distinct"
  }
}

4. No cell ids yet? Send an area
Copy link

Send bbox (south, west, north, east) for a box, or near and radius_m for a circle. You get one row for every cell in the area, and each row has its cell id. This box around King's Cross holds 39 cells.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/transit/lines/cells?bbox=51.522,-0.140,51.538,-0.110"

Major roads
Copy link

GET /v1/transport/roads

Get the major roads that have an entry or exit in a location, with one row per road and direction. With near, results are sorted nearest first; otherwise they are sorted by id.

Major roads are motorways and freeways: roads Overture Maps classes as motorway. Ramps between two major roads are left out.

The endpoint also takes the following common parameters:

Each result has these fields:

  • id (rd_gb_…)
  • name, often null
  • ref, such as M1
  • direction: northbound, southbound, eastbound, westbound or null
  • access_counts: the number of entries and exits the road has inside the location, as {entry, exit}

Errors

CodeHTTPWhen
location_required400The request has no near or bbox. Roads don't take cells or at.
not_available_in_country404The location is in a country with no road data.
too_many_results400There are over 10,000 entries and exits in the location. Use a smaller location.

All the location and paging error codes also apply.

Examples

The major roads within 10 km of King's Cross. The only one is the M1, which has one row for each direction.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/roads?near=51.5307,-0.1238&radius_m=10000"
200 · 2 major roads
RefrefDirectiondirectionEntriesaccess_counts.entryExitsaccess_counts.exit
M1southbound01
M1northbound20

All 2 shown

One road
Copy link

GET /v1/transport/roads/{id}

Get one major road in one direction, with its entries and exits counted along its whole length. To list them, use GET /v1/transport/roads/access?road=<id>.

The response has the same fields as a list result, but access_counts covers the whole road.

Errors

CodeHTTPWhen
invalid_id400The id is not a road id (rd_gb_…).
not_found404There is no road with this id.
Examples

The M1 northbound, which has 49 entries and 49 exits.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/roads/rd_gb_5dd25d5e19ad"
200 · one road
Ididrd_gb_5dd25d5e19ad
Namename—
RefrefM1
Directiondirectionnorthbound
Entriesaccess_counts.entry49
Exitsaccess_counts.exit49

Road entries and exits
Copy link

GET /v1/transport/roads/access

Get the junctions, ramps and slip roads where you get on or off a major road. You can search in a location, or along one road with road. With near, results are sorted nearest first; otherwise they are sorted by id.

Parameters
Copy link

ParameterTypeDefaultWhat it doesExample
typeentry | exitbothOnly return entries (on-ramps and slip roads onto the road) or only exits.type=entry
roadroad id—Only return this road's entries and exits. It takes the place of a location, so don't send one with it.road=rd_gb_5dd25d5e19ad

The endpoint also takes the following common parameters:

Each result has these fields:

  • id: ra_gb_on-… for an entry, ra_gb_off-… for an exit
  • type: entry or exit
  • road, as {id, name, ref}: the major road it joins (with road, the road you asked for)
  • name: the local road it joins, often null
  • lat and lng, in degrees
  • cell: its resolution-9 H3 cell
  • distance_m: the distance in metres, only with near

Errors

CodeHTTPWhen
location_required400The request has none of near, bbox or road.
too_many_locations400road is sent with near or bbox.
invalid_type400type is not entry or exit.
invalid_id400road is not a road id.
not_available_in_country404The location is in a country with no road data.
too_many_results400There are over 10,000 entries and exits in the location.

All the location and paging error codes also apply.

Examples

The nearest motorway entries to King's Cross are two slip roads onto the M1 northbound at Staples Corner, 8.7 km away.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/roads/access?near=51.5307,-0.1238&radius_m=10000&type=entry"
200 · 2 entries and exits

2 pins inside the 10,000 m circle; a pin opens its row.

One entry or exit
Copy link

GET /v1/transport/roads/access/{id}

Get one entry or exit.

The response has the same fields as a list result, without distance_m.

Errors

CodeHTTPWhen
invalid_id400The id is not an entry or exit id (ra_gb_on-… or ra_gb_off-…).
not_found404There is no entry or exit with this id.
Examples

The M1 northbound entry at Staples Corner.

Request

curl -H "X-Application-Id: YOUR_APP_ID" -H "X-Api-Key: YOUR_APP_KEY" \
  "https://data.traveltimeapp.com/v1/transport/roads/access/ra_gb_on-7a1d7c4e-d65c-4d9b-b963-790bc7213b59"
200 · one entry or exit

1 pin; it opens its row.

Try these requests in the playground →