Trainline+API.SH

Trainline API

Search Trainline stations, read route timetables and lowest fares, and pull UK live departure boards as clean JSON.

The API.SH Trainline API turns public Trainline pages into structured JSON. Look up stations and cities across Great Britain and Europe, read what Trainline publishes about a route (average and fastest journey time, trains per day, first and last train, operators, distance, the lowest fare, a sample timetable, reviews and FAQ), and follow trains in Great Britain in real time with live departure and arrival boards and each service's calling points.

  • 5 endpoints
  • from $1 / 1,000 calls
  • 1,000 free credits / month
  • failed calls free
Trainline station and city search
GET https://api.api.sh/trainline/v1/locations
{"q": "manchester","locale": "en-GB","count": 17,"locations": [{"code": "urn:trainline:generic:loc:MAN2968gb","name": "Manchester Piccadilly","short_code": "MAN","type": "station","country_code": "GB","subtitle": null,"attributes": ["MainStation","BusStation","… 1 more"],"time_zone": "Europe/London","language": "en","connections": ["atoc","nationalexpress"],"score": 0.40811986,"slug": "manchester-piccadilly"},{"code": "urn:trainline:generic:loc:115gb","name": "Manchester","short_code": "115","type": "stationGroup","country_code": "GB","subtitle": "Any","attributes": ["BusStation","category:point"],"time_zone": "Europe/London","language": "en","connections": ["atoc","distribusion","… 1 more"],"score": 0.21027617,"slug": "manchester"},"… 15 more"],"cached": false,"credits_used": 1}
1 credit · $1 per 1,000 calls

What you can build with the Trainline API

Rail route comparison

Compare journey times, trains per day, operators and the lowest fare across city pairs to plan a trip, a relocation or a travel product.

Live departure screens

Show the next trains from a station with scheduled and expected times, platforms and delay or cancellation flags, filtered to one destination if you like.

Delay and punctuality tracking

Poll a station's board and a train's calling points to log how late services run and where they are now.

Station lookup for travel apps

Resolve what a user types into Trainline station codes, slugs, time zones and the carriers that serve each station.

Travel content and SEO pages

Fill route pages with real journey times, distances, operators and fares-from, plus the questions travelers ask about the route.

Trainline data you get

Field names from real responses. Numbers come parsed, URLs absolute, dates in ISO 8601.

Trainline UK live arrivals/trainline/v1/arrivals
urlhttps://www.thetrainline.com/liv…checked_at2026-11-05T10:58:00updated_at2026-11-05T10:58:47.568Zcount50
station[]name · code · slug
services[]id · scheduled · expected · on_time · cancelled · delayed · platform · operator · origin · destination
Trainline UK live departures/trainline/v1/departures
urlhttps://www.thetrainline.com/liv…checked_at2026-11-05T10:51:00updated_at2026-11-05T10:51:41.112Zcount42
station[]name · code · slug
services[]id · scheduled · expected · on_time · cancelled · delayed · platform · operator · origin · destination
Trainline station and city search/trainline/v1/locations
qmanchesterlocaleen-GBcount17
locations[]code · name · short_code · type · country_code · subtitle · attributes · time_zone · language · connections · score · slug

Trainline API endpoints and prices

Every Trainline endpoint costs 1 credit per call: credits are $1 per 1,000 on a monthly plan, $2 pay-as-you-go. Pricing

Search and discovery1
Trainline station and city search
/trainline/v1/locations
params q +2 optionaldocstry
$1 · $2 PAYG
1 credit
Posts and media2
Trainline UK live arrivals
/trainline/v1/arrivals
params station +2 optionaldocstry
$1 · $2 PAYG
1 credit
Trainline UK live departures
/trainline/v1/departures
params station +2 optionaldocstry
$1 · $2 PAYG
1 credit
More data2
Trainline route: times, trains per day, fares from
/trainline/v1/route
params from, todocstry
$1 · $2 PAYG
1 credit
Trainline UK train calling points
/trainline/v1/service
params station +2 optionaldocstry
$1 · $2 PAYG
1 credit

Call the Trainline API

Trainline station and city search: GET https://api.api.sh/trainline/v1/locations

curl "https://api.api.sh/trainline/v1/locations?q=manchester" \
  -H "x-api-key: $APISH_KEY"
  1. Create a free accountConfirm your email and get 1,000 free credits every month. No card needed.
  2. Create an API keyOne key works for all 918 platforms.
  3. Send the requestJSON back in one call. Add output=csv or output=ndjson for files.

Why API.SH for Trainline data

  • Public data only: no Trainline login, cookies or account needed
  • One key and one response shape for Trainline and 917 other platforms
  • Built and maintained by API.SH, not third-party publishers
  • Pay per call; errors on our side cost nothing
  • No rate limits: run as many calls in parallel as you need
  • Live status for every endpoint

API.SH vs the official Trainline API

Trainline's Global API is a wholesale booking API sold to travel companies and agencies through Trainline Partner Solutions; it needs a commercial agreement. API.SH needs no partner contract and returns Trainline's public route, station and UK live board data as JSON with one key.

Skip writing and maintaining your own Trainline scraper or testing Apify actors one by one: API.SH gives you one key, one JSON shape and a fixed price per call.

Trainline API questions

What Trainline data can I get?+

Station and city search (/trainline/v1/locations), route pages with journey times, trains per day, operators, lowest fare, sample timetable, reviews and FAQ (/trainline/v1/route), UK live departures (/trainline/v1/departures) and arrivals (/trainline/v1/arrivals), and a train's calling points with live times (/trainline/v1/service).

How much does the Trainline API cost?+

Every Trainline endpoint costs 1 credit per call. On a monthly plan 1,000 credits cost $1 (Starter is $50/month for 50,000 credits). Pay-as-you-go is $2 per 1,000 credits, with top-ups from $15 that never expire.

Is there a free trial?+

Yes. Every account gets 1,000 free credits every month. That is 1,000 calls to /trainline/v1/arrivals at 1 credit each.

Is there an official Trainline API?+

Trainline sells its Global API to travel businesses under a partner agreement. It is not open for self-serve sign-up. API.SH reads Trainline's public pages and needs no agreement.

Do I need a Trainline account or login?+

No. API.SH reads public Trainline pages only. No endpoint uses a login, cookies or anyone's account, and it never books tickets.

Is there a free Trainline API?+

Trainline does not offer a free public API. With API.SH you can start on the free monthly credits and only pay for more calls when you need them.

Can I see which platform my train leaves from?+

Yes, for stations in Great Britain. /trainline/v1/departures returns the platform when it has been announced, along with the scheduled and expected time.

How do I get started?+

1. Sign up at api.sh. 2. Copy your API key. 3. Call /trainline/v1/departures with station=london-euston, or /trainline/v1/route with from=london and to=manchester. Request examples and every parameter are in the docs at https://api.sh/docs. You can also use the JS or Python SDK, Google Sheets, Zapier, Make, n8n or the MCP server at https://api.sh/mcp.

Does the Trainline API have a rate limit?+

No. API.SH puts no rate limit on your key: send as many Trainline calls in parallel as you need and pay only for the calls that run. If Trainline itself slows down, the call returns 503 with a retry-after header and is not charged.

More travel & events APIs all travel & events APIs →

Start with 1,000 free credits
Every month, on every account. One key works for all 918 platforms.
Get a free API key