Discover/National Rail API
live

National Rail APInationalrail.co.uk

Access UK National Rail data via 6 endpoints: live departures/arrivals, station details, CRS codes, disruptions, and engineering works.

Endpoint health
verified 3d ago
get_stations
get_disruptions
get_station_details
get_live_arrivals
get_live_departures
6/6 passing latest checkself-healing
Endpoints
6
Updated
21d ago

What is the National Rail API?

The National Rail API exposes 6 endpoints covering live UK train departure and arrival boards, full station metadata, and real-time network disruptions. Call get_live_departures with a 3-letter CRS code to retrieve scheduled and estimated times, platform numbers, operators, and service status for any staffed station. Station endpoints return CRS codes, coordinates, accessibility details, and facility data drawn directly from the nationalrail.co.uk estate.

Try it

No input parameters required.

api.parse.bot/scraper/63073631-1d9b-4af5-b9a2-ffd95836d0bc/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/63073631-1d9b-4af5-b9a2-ffd95836d0bc/get_stations' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace nationalrail-co-uk-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""National Rail API — stations, live boards, and disruptions."""
from parse_apis.national_rail_api import NationalRail, StationNotFound

client = NationalRail()

# Search for stations by name — limit caps total items fetched.
for station in client.stations.search(query="Manchester", limit=3):
    print(station.name, station.crs_code, station.classification)

# Get detailed info for a specific station by slug.
try:
    detail = client.stationdetails.get(slug="london-euston")
    print(detail.name, detail.crs_code, detail.address.postcode)
except StationNotFound as exc:
    print(f"Station not found: {exc}")

# Live departure board — construct a Station by CRS code, then list departures.
euston = client.station(crs_code="EUS")
for dep in euston.departures.list(limit=5):
    print(dep.rid, dep.destination, dep.platform, dep.scheduled)

# Live arrivals at the same station.
for arr in euston.arrivals.list(limit=5):
    print(arr.rid, arr.origin, arr.platform, arr.estimated)

# Network-wide disruption report — single object with all categories.
report = client.disruptionreports.get()
for indicator in report.service_indicators[:3]:
    print(indicator.name, indicator.status)

print("exercised: stations.search / stationdetails.get / departures.list / arrivals.list / disruptionreports.get")
All endpoints · 6 totalmissing one? ·

Retrieve the full list of UK rail stations and their CRS codes. Returns all stations including National Rail, London Underground, and Docklands Light Railway classifications. No parameters required — returns the complete station reference dataset in a single page.

Input

No input parameters required.

Response
{
  "type": "object",
  "fields": {
    "stations": "array of station objects each containing crsCode, name, classification, and state flags"
  },
  "sample": {
    "data": {
      "stations": [
        {
          "name": "Tower Gateway",
          "crsCode": "1DA",
          "kbState": 0,
          "ojpState": 1,
          "dlrLuState": 1,
          "darwinState": 0,
          "classification": "DOCKLAND_LIGHT_RAILWAY"
        },
        {
          "name": "London Euston",
          "crsCode": "EUS",
          "kbState": 2,
          "ojpState": 1,
          "dlrLuState": 1,
          "darwinState": 4,
          "classification": "LONDON"
        }
      ]
    },
    "status": "success"
  }
}

About the National Rail API

Station Data

get_stations returns the full list of UK rail stations as an array of objects, each with a crsCode, name, classification (National Rail, London Underground, or Docklands Light Railway), and state flags. Use search_stations with a query parameter — partial name or CRS abbreviation — to get autocomplete-style matches with coordinates. For deeper detail, get_station_details accepts a URL slug (e.g. london-euston) and returns structured data including address, location, stationOperator, stationAccessibility, ticket buying options, transport links, and platform-level facilities.

Live Departure and Arrival Boards

get_live_departures and get_live_arrivals both accept a crs parameter and return a board object with a generatedAt timestamp and a services array. Each service entry includes scheduled and estimated times, the calling destination or origin station, the operator, platform number, and a service status string. These boards reflect the same real-time data presented on nationalrail.co.uk, making them suitable for journey monitoring and alerting tools.

Disruptions and Engineering Works

get_disruptions requires no parameters and returns four top-level arrays: disruptions (active incidents), cleared_disruptions (recently resolved incidents), engineering_works (planned possessions and line closures), and service_indicators (per-operator performance summaries). This gives a network-wide picture of current and upcoming service impacts without needing to poll individual station boards.

Reliability & maintenanceVerified

The National Rail API is a managed, monitored endpoint for nationalrail.co.uk — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when nationalrail.co.uk changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official nationalrail.co.uk API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
3d ago
Latest check
6/6 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Display a live departure board on a travel app using get_live_departures with a station's CRS code
  • Alert commuters to delays or cancellations by polling get_disruptions for active incidents
  • Build a station finder with autocomplete backed by search_stations returning CRS codes and coordinates
  • Show accessibility and facility information for a station using get_station_details fields like stationAccessibility
  • Monitor engineering works to surface weekend line closures before a user books travel
  • Populate a CRS-code lookup table from get_stations for use in journey planning integrations
  • Track per-operator service performance using service_indicators from the disruptions endpoint
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min

One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does National Rail have an official developer API?+
Yes. National Rail provides the Darwin Data Feeds service for licensed developers, available at https://www.nationalrail.co.uk/developers/. It requires registration and offers push-based STOMP feeds. This Parse API provides REST-based access without requiring a Darwin licence or feed subscription.
What does `get_live_departures` actually return per service?+
Each entry in the services array includes the scheduled departure time, estimated departure time (or 'On time'), the destination station name, the operating company, platform number where allocated, and a status string. The board also carries a generatedAt timestamp so you know exactly how fresh the data is.
Does the API cover journey planning — fare prices, ticket booking, or specific calling points?+
Not currently. The API covers station metadata, live boards (scheduled/estimated times, platforms, operators), and network disruptions. It does not return fare prices, bookable tickets, or the full intermediate calling-point sequence for a service. You can fork this API on Parse and revise it to add an endpoint that exposes calling points or fare data.
How current is the disruptions data from `get_disruptions`?+
The endpoint reflects the disruptions and engineering works currently published on nationalrail.co.uk. There is no pagination — it returns the full current snapshot in a single call, so freshness depends on how frequently you poll it. Cleared disruptions are included in the cleared_disruptions array alongside active ones.
Can I look up a station's CRS code if I only know part of the name?+
Yes. Pass a partial name or abbreviation as the query parameter to search_stations. The response includes a payload with matched stations, each carrying its crsCode and coordinates. This is the same autocomplete data used by the nationalrail.co.uk search box.
Page content last updated . Spec covers 6 endpoints from nationalrail.co.uk.
Related APIs in TravelSee all →
thetrainline.com API
Search UK train stations and find the cheapest fares across date ranges, then generate direct booking links to complete your purchase on Trainline.com. Get real-time journey information to compare prices and book your tickets in seconds.
trainline.eu API
Search for train stations and routes across the UK and Europe, then find and compare available journeys with schedules and pricing. Book your ideal train trip by accessing real-time travel options directly from Trainline.com.
railyatri.in API
Search trains between stations and get real-time information including live train status, timetables, seat availability, and PNR confirmation details. Find the perfect journey by autocompleting station and train names while checking current availability and train schedules.
amtrak.com API
Search for Amtrak trains across stations, compare fares, and discover discounts to plan your rail journey with current pricing and availability. Get detailed train information, autocomplete station names, and find the cheapest routes for your travel dates.
rfi.it API
Check real-time train schedules and station information across Italy's railway network, search for stations, and get live alerts about delays and service disruptions. Monitor train circulation status and access detailed station mappings to plan your journeys efficiently.
trenitalia.com API
Search for trains across Italy, check real-time train status and delays, view station departure and arrival boards, and find available tickets all in one place. Get live traffic information and detailed train itineraries to plan your journey with complete visibility into schedules and service disruptions.
enquiry.indianrail.gov.in API
Search for trains between Indian stations, check schedules, and look up station details to plan your rail journeys. Get real-time train information with support for captcha-protected searches to ensure reliable access to Indian Railways data.
bart.gov API
Track live BART train departures and arrival estimates across all Bay Area stations in real-time. Find your nearest station and see exactly when the next train is arriving on every platform.