Overview

The Transport for London (TfL) API offers developers access to extensive datasets related to London's public transportation network. Established in 2000, TfL is responsible for the majority of the city's transport infrastructure and services, including the London Underground (Tube), Overground, buses, Docklands Light Railway (DLR), trams, and river services. The API serves as a programmatic interface to this operational data, enabling the creation of applications that assist users with navigation, journey planning, and staying informed about service disruptions.

Developers primarily use the TfL API for building real-time journey planning applications, which can calculate optimal routes between two points using various modes of transport. This involves querying endpoints for route suggestions, estimated travel times, and inter-modal transfers. Beyond route calculation, the API provides real-time status updates for all lines and services, allowing applications to display current delays, closures, or planned engineering works. This data is critical for passengers making informed travel decisions, especially during peak hours or unexpected incidents.

The API's utility extends to public transport data analysis, where researchers and urban planners can leverage historical and real-time data to understand travel patterns, congestion points, and the impact of service changes. For instance, analyzing bus location data can inform decisions about route optimization or frequency adjustments. Integrating London transport information into broader applications, such as smart city platforms or event management tools, is another common use case. Developers can embed live service updates into websites or mobile apps for events taking place in London, ensuring attendees have up-to-date travel guidance.

Access to the TfL API requires registration and an API key for standard usage, which is provided free of charge. For higher volume usage or specific commercial applications, direct contact with TfL may be necessary to discuss terms. The platform is designed to provide comprehensive data, supporting a wide range of applications from consumer-facing mobile apps to internal operational dashboards. The API structure and data formats are well-documented, aiming to facilitate integration for developers with varying levels of experience. Developers can find detailed documentation for various API endpoints on the TfL API reference page.

While the TfL API focuses specifically on London's transport network, similar data access models are adopted by other major metropolitan transport authorities globally, such as the Google Maps Platform Public Transit API, which offers transit data for numerous cities worldwide. This demonstrates a broader industry trend towards making public transport data available to foster innovation in urban mobility.

Key features

  • Real-time Line Statuses: Provides current operational status for all Tube, Overground, DLR, and tram lines, including information on delays, disruptions, and planned closures.
  • Journey Planning: Allows users to calculate routes between two points, specifying preferred modes of transport, time of travel, and accessibility requirements.
  • Disruption Information: Offers details on specific incidents, engineering works, and events affecting transport services, often including alternative travel advice.
  • Stop Point Data: Access to static and real-time information about bus stops, Tube stations, and other transport hubs, including their locations, facilities, and live arrivals/departures.
  • Bike Point Information: Provides data on Santander Cycles docking stations, including real-time availability of bikes and empty docking spaces.
  • Road Network Information: Offers data on road traffic incidents, planned roadworks, and current traffic flow, relevant for car and cycle journey planning.
  • Fares and Tickets: Access to information regarding fare zones, ticket types, and Oyster card top-up locations.

Pricing

The Transport for London API operates on a tiered access model. Standard access, suitable for most developers and applications, is available free of charge upon registration for an API key. This tier typically accommodates a significant volume of requests. For commercial applications or those requiring exceptionally high request volumes, contact with TfL is recommended to discuss specific usage terms and potential dedicated arrangements.

Access Tier Description Cost As Of Reference
Standard Access For general development and most applications, requiring registration for an API key. Free 2026-05-28 TfL API Account Information
High Volume / Commercial For applications with exceptionally high request volumes or specific commercial needs. Contact TfL 2026-05-28 TfL API Account Information

Common integrations

  • Mobile Journey Planners: Integrating real-time line statuses and journey planning functionality into iOS and Android applications.
  • Website Widgets: Embedding live departure boards or service disruption alerts directly onto websites.
  • Smart City Dashboards: Incorporating TfL data into broader urban management and information systems.
  • Voice Assistants: Providing real-time travel updates and journey planning through platforms like Google Assistant or Amazon Alexa.
  • Data Analytics Platforms: Feeding TfL data into tools for historical analysis of transport performance and passenger flow.
  • Mapping Services: Overlaying TfL network data and real-time information onto maps from providers like Google Maps Platform.

Alternatives

  • Moovit: A global public transport app and data provider offering journey planning and real-time information for many cities.
  • Google Maps Platform: Provides comprehensive mapping solutions, including public transit data and routing for numerous locations worldwide.
  • OpenTripPlanner: An open-source multi-modal trip planner that can be deployed with custom public transport data.

Getting started

To begin using the TfL API, developers must first register for an API key on the TfL API account creation page. Once an API key and application ID are obtained, they can be used to authenticate requests. The following Python example demonstrates how to fetch the status of all Tube lines using the requests library.

import requests
import json

# Replace with your actual App ID and App Key from TfL API registration
app_id = "YOUR_APP_ID"
app_key = "YOUR_APP_KEY"

base_url = "https://api.tfl.gov.uk"
endpoint = "/Line/Mode/tube/Status"

# Construct the full URL with authentication parameters
url = f"{base_url}{endpoint}?app_id={app_id}&app_key={app_key}"

try:
    response = requests.get(url)
    response.raise_for_status()  # Raise an exception for HTTP errors (4xx or 5xx)
    line_statuses = response.json()

    print("TfL Tube Line Statuses:")
    for line in line_statuses:
        line_name = line.get('name')
        line_status = line.get('lineStatuses', [])
        
        if line_status:
            status_description = line_status[0].get('statusSeverityDescription', 'Unknown')
            reason = line_status[0].get('reason', '')
            print(f"  {line_name}: {status_description}")
            if reason:
                print(f"    Reason: {reason.strip()}")
        else:
            print(f"  {line_name}: No status information available")

except requests.exceptions.RequestException as e:
    print(f"Error fetching data: {e}")
except json.JSONDecodeError:
    print("Error decoding JSON response.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

This script makes an HTTP GET request to the TfL API's /Line/Mode/tube/Status endpoint. It then parses the JSON response to display the current status and any associated reasons for each London Underground line. Developers should consult the TfL API reference for details on other available endpoints and their specific parameters.