Tfl

Transport for London Unified API

TfL API

Logistics & shipping#transportation

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

TfL API

Endpoints 84

AccidentStats

  • GETGets all accident details for accidents occuring in the specified year/AccidentStats/:year

AirQuality

  • GETGets air quality data feed/AirQuality

BikePoint

  • GETGets all bike point locations. The Place object has an addtionalProperties array which contains the nbBikes, nbDocks and nbSpaces numbers which give the status of the BikePoint. A mismatch in these numbers i.e. nbDocks - (nbBikes + nbSpaces) != 0 indicates broken docks./BikePoint
  • GETGets the bike point with the given id./BikePoint/:id
  • GETSearch for bike stations by their name, a bike point's name often contains information about the name of the street or nearby landmarks, for example. Note that the search result does not contain the PlaceProperties i.e. the status or occupancy of the BikePoint, to get that information you should retrieve the BikePoint by its id on /BikePoint/id./BikePoint/Search?query=string

Cabwise

  • GETGets taxis and minicabs contact information/Cabwise/search?lat=0.0&lon=0.0

Journey

  • GETGets a list of all of the available journey planner modes/Journey/Meta/Modes
  • GETPerform a Journey Planner search from the parameters specified in simple types/Journey/JourneyResults/:from/to/:to

Line

  • GETGets a list of valid modes/Line/Meta/Modes
  • GETGets a list of valid severity codes/Line/Meta/Severity
  • GETGets a list of valid disruption categories/Line/Meta/DisruptionCategories
  • GETGets a list of valid ServiceTypes to filter on/Line/Meta/ServiceTypes
  • GETGets lines that match the specified line ids./Line/:ids
  • GETGets lines that serve the given modes./Line/Mode/:modes
  • GETGet all valid routes for all lines, including the name and id of the originating and terminating stops for each route./Line/Route
  • GETGet all valid routes for given line ids, including the name and id of the originating and terminating stops for each route./Line/:ids/Route
  • GETGets all lines and their valid routes for given modes, including the name and id of the originating and terminating stops for each route/Line/Mode/:modes/Route
  • GETGets all valid routes for given line id, including the sequence of stops on each route./Line/:id/Route/Sequence/:direction
  • GETGets the line status for given line ids during the provided dates e.g Minor Delays/Line/:ids/Status/:StartDate/to/:EndDate?startDate=string&endDate=string
  • GETGets the line status of for given line ids e.g Minor Delays/Line/:ids/Status
  • GETSearch for lines or routes matching the query string/Line/Search/:query
  • GETGets the line status for all lines with a given severity A list of valid severity codes can be obtained from a call to Line/Meta/Severity/Line/Status/:severity
  • GETGets the line status of for all lines for the given modes/Line/Mode/:modes/Status
  • GETGets a list of the stations that serve the given line id/Line/:id/StopPoints
  • GETGets the timetable for a specified station on the give line/Line/:id/Timetable/:fromStopPointId
  • GETGets the timetable for a specified station on the give line with specified destination/Line/:id/Timetable/:fromStopPointId/to/:toStopPointId
  • GETGet disruptions for the given line ids/Line/:ids/Disruption
  • GETGet disruptions for all lines of the given modes./Line/Mode/:modes/Disruption
  • GETGet the list of arrival predictions for given line ids based at the given stop/Line/:ids/Arrivals/:stopPointId

Mode

  • GETReturns the service type active for a mode. Currently only supports tube/Mode/ActiveServiceTypes
  • GETGets the next arrival predictions for all stops of a given mode/Mode/:mode/Arrivals

Occupancy

  • GETGets the occupancy for a car park with a given id/Occupancy/CarPark/:id
  • GETGets the occupancy for all car parks that have occupancy data/Occupancy/CarPark
  • GETGets the occupancy for a charge connectors with a given id (sourceSystemPlaceId)/Occupancy/ChargeConnector/:ids
  • GETGets the occupancy for all charge connectors/Occupancy/ChargeConnector
  • GETGet the occupancy for bike points./Occupancy/BikePoints/:ids

Place

  • GETGets a list of all of the available place property categories and keys./Place/Meta/Categories
  • GETGets a list of the available types of Place./Place/Meta/PlaceTypes
  • GETGets the set of streets associated with a post code./Place/Address/Streets/:Postcode?postcode=string
  • GETGets all places of a given type/Place/Type/:types
  • GETGets the place with the given id./Place/:id
  • GETGets the places that lie within a geographic region. The geographic region of interest can either be specified by using a lat/lon geo-point and a radius in metres to return places within the locus defined by the lat/lon of its centre or alternatively, by the use of a bounding box defined by the lat/lon of its north-west and south-east corners. Optionally filters on type and can strip properties for a smaller payload./Place
  • GETGets any places of the given type whose geography intersects the given latitude and longitude. In practice this means the Place must be polygonal e.g. a BoroughBoundary./Place/:type/At/:Lat/:Lon?lat=string&lon=string&location.lat=0.0&location.lon=0.0
  • GETGets the place overlay for a given set of co-ordinates and a given width/height./Place/:type/overlay/:z/:Lat/:Lon/:width/:height?lat=string&lon=string&location.lat=0.0&location.lon=0.0
  • GETGets all places that matches the given query/Place/Search?name=string

Road

  • GETGets all roads managed by TfL/Road
  • GETGets the road with the specified id (e.g. A1)/Road/:ids
  • GETGets the specified roads with the status aggregated over the date range specified, or now until the end of today if no dates are passed./Road/:ids/Status
  • GETGet active disruptions, filtered by road ids/Road/:ids/Disruption
  • GETGets a list of disrupted streets. If no date filters are provided, current disruptions are returned./Road/all/Street/Disruption?startDate=2024-01-01T00:00:00Z&endDate=2024-01-01T00:00:00Z
  • GETGets a list of active disruptions filtered by disruption Ids./Road/all/Disruption/:disruptionIds
  • GETGets a list of valid RoadDisruption categories/Road/Meta/Categories
  • GETGets a list of valid RoadDisruption severity codes/Road/Meta/Severities

Search

  • GETSearch the site for occurrences of the query string. The maximum number of results returned is equal to the maximum page size of 100. To return subsequent pages, use the paginated overload./Search?query=string
  • GETSearches the bus schedules folder on S3 for a given bus number./Search/BusSchedules?query=string
  • GETGets the available searchProvider names./Search/Meta/SearchProviders
  • GETGets the available search categories./Search/Meta/Categories
  • GETGets the available sorting options./Search/Meta/Sorts

StopPoint

  • GETGets the list of available StopPoint additional information categories/StopPoint/Meta/Categories
  • GETGets the list of available StopPoint types/StopPoint/Meta/StopTypes
  • GETGets the list of available StopPoint modes/StopPoint/Meta/Modes
  • GETGets a list of StopPoints corresponding to the given list of stop ids./StopPoint/:ids
  • GETGet a list of places corresponding to a given id and place types./StopPoint/:id/placeTypes?placeTypes=string
  • GETGets all the Crowding data (static) for the StopPointId, plus crowding data for a given line and optionally a particular direction./StopPoint/:id/Crowding/:line?direction=inbound
  • GETGets all stop points of a given type/StopPoint/Type/:types
  • GETGets all the stop points of given type(s) with a page number/StopPoint/Type/:types/page/:page
  • GETGets the service types for a given stoppoint/StopPoint/ServiceTypes?id=string
  • GETGets the list of arrival predictions for the given stop point id/StopPoint/:id/Arrivals
  • GETGets the list of arrival and departure predictions for the given stop point id (overground, Elizabeth line and thameslink only)/StopPoint/:id/ArrivalDepartures?lineIds=string
  • GETGets Stopoints that are reachable from a station/line combination./StopPoint/:id/CanReachOnLine/:lineId
  • GETReturns the route sections for all the lines that service the given stop point ids/StopPoint/:id/Route
  • GETGets a distinct list of disrupted stop points for the given modes/StopPoint/Mode/:modes/Disruption
  • GETGets all disruptions for the specified StopPointId, plus disruptions for any child Naptan records it may have./StopPoint/:ids/Disruption
  • GETReturns the canonical direction, "inbound" or "outbound", for a given pair of stop point Ids in the direction from -> to./StopPoint/:id/DirectionTo/:toStopPointId
  • GETGets a list of StopPoints within {radius} by the specified criteria/StopPoint?stopTypes=string&location.lat=0.0&location.lon=0.0
  • GETGets a list of StopPoints filtered by the modes available at that StopPoint./StopPoint/Mode/:modes
  • GETSearch StopPoints by their common name, or their 5-digit Countdown Bus Stop Code./StopPoint/Search/:query
  • GETSearch StopPoints by their common name, or their 5-digit Countdown Bus Stop Code./StopPoint/Search?query=string
  • GETGets a StopPoint for a given sms code./StopPoint/Sms/:id
  • GETGets a list of taxi ranks corresponding to the given stop point id./StopPoint/:stopPointId/TaxiRanks
  • GETGet car parks corresponding to the given stop point id./StopPoint/:stopPointId/CarParks

TravelTime

  • GETGets the TravelTime overlay./TravelTimes/overlay/:z/mapcenter/:mapCenterLat/:mapCenterLon/pinlocation/:pinLat/:pinLon/dimensions/:width/:height?scenarioTitle=string&timeOfDayId=string&modeId=string&direction=Average&travelTimeInterval=0
  • GETGets the TravelTime overlay./TravelTimes/compareOverlay/:z/mapcenter/:mapCenterLat/:mapCenterLon/pinlocation/:pinLat/:pinLon/dimensions/:width/:height?scenarioTitle=string&timeOfDayId=string&modeId=string&direction=Average&travelTimeInterval=0&compareType=string&compareValue=string

Vehicle

  • GETGets the predictions for a given list of vehicle Id's./Vehicle/:ids/Arrivals

API details

Base URL
https://api.tfl.gov.uk
Authentication
An API key in the app_key query parameter
An API key in the app_id query parameter
Operations
84 operations on 84 pathsGET 84
Main resources
StopPoint 23Line 21Place 9Road 8Occupancy 5Search 5BikePoint 3Journey 2Mode 2TravelTime 2
Description format
Swagger 2.0, API version v1

How to test the Transport for London Unified API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Transport for London Unified API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the app_key query parameter. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Gets all accident details for accidents occuring in the specified year” (GET /AccidentStats/:year), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Transport for London Unified API?

TfL API It is listed under Logistics & shipping and has 84 endpoints.

Who publishes the Transport for London Unified API?

It is listed from Tfl's public API description (an OpenAPI document), not published by Tfl on Swastik Codes. Anyone who controls tfl.gov.uk can claim the profile by adding a DNS TXT record.

What is the base URL of the Transport for London Unified API?

Requests go to https://api.tfl.gov.uk. Endpoint paths are added to this base URL.

How do I authenticate with the Transport for London Unified API?

It accepts 2 methods: an API key in the app_key query parameter; an API key in the app_id query parameter.

How many endpoints does the Transport for London Unified API have?

84 operations on 84 paths (84 GET). The largest groups are StopPoint, Line, Place, Road.

Is forking the Transport for London Unified API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.