1 credit per call15 endpoints9 datapointsChecked working 6 Dec 2026
Trainline API
Trainline API for stations, journey search, fare calendars, ticket options, calling points and cards as JSON. 15 endpoints, 1 credit per successful call.
{
"success": true,
"data": {
"card_count": 42,
"cards": [
{
"code": "urn:trainline:atoc:card:TSU",
"name": "16-17 Saver",
"description": "16-17 Saver",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
},
{
"code": "urn:trainline:atoc:card:YNG",
"name": "16-25 Railcard",
"description": "16-25 Railcard",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
},
{
"code": "urn:trainline:atoc:card:W18",
"name": "18 Saver - Transport for Wales",
"description": "18 Saver - Transport for Wales",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
}
]
},
"meta": {
"endpoint_family": "cards"
}
}Sample data
What one call returns
A recorded run of cards: the fields and shapes you will get, shortened to 3 items.
| # | codestring | namestring | descriptionstring | languagestring | carriersstring[] | requires_numberboolean | has_expiration_dateboolean | is_loyalty_cardboolean | business_onlyboolean |
|---|---|---|---|---|---|---|---|---|---|
| 1 | urn:trainline:atoc:card:TSU | 16-17 Saver | 16-17 Saver | en | [1 item] | false | false | false | false |
| 2 | urn:trainline:atoc:card:YNG | 16-25 Railcard | 16-25 Railcard | en | [1 item] | false | false | false | false |
| 3 | urn:trainline:atoc:card:W18 | 18 Saver - Transport for Wales | 18 Saver - Transport for Wales | en | [1 item] | false | false | false | false |
[
{
"code": "urn:trainline:atoc:card:TSU",
"name": "16-17 Saver",
"description": "16-17 Saver",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
},
{
"code": "urn:trainline:atoc:card:YNG",
"name": "16-25 Railcard",
"description": "16-25 Railcard",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
},
{
"code": "urn:trainline:atoc:card:W18",
"name": "18 Saver - Transport for Wales",
"description": "18 Saver - Transport for Wales",
"language": "en",
"carriers": [
"atoc"
],
"requires_number": false,
"has_expiration_date": false,
"is_loyalty_card": false,
"business_only": false
}
]code,name,description,language,carriers,requires_number,has_expiration_date,is_loyalty_card,business_only urn:trainline:atoc:card:TSU,16-17 Saver,16-17 Saver,en,"[""atoc""]",false,false,false,false urn:trainline:atoc:card:YNG,16-25 Railcard,16-25 Railcard,en,"[""atoc""]",false,false,false,false urn:trainline:atoc:card:W18,18 Saver - Transport for Wales,18 Saver - Transport for Wales,en,"[""atoc""]",false,false,false,false
Recorded 12 Nov 2026 · 3 items shown · 9 datapoints per itemGET /v1/trainline/cards
9 datapoints
Identity
- namestring
Other
- codestring
- descriptionstring
- languagestring
- carriersstring[]
- requires_numberboolean
- has_expiration_dateboolean
- is_loyalty_cardboolean
- business_onlyboolean
Playground
Run this API
curl "https://api.perceptlayer.com/v1/trainline/cards" \
-H "X-API-Key: $API_KEY"Trainline · 15 endpoints
Endpoints
Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.
| Endpoint | Required parameters | Returns | Cost |
|---|---|---|---|
GET/v1/trainline/cards | none | codenamedescriptionlanguagecarriersrequires_number+3 more | 1 credit |
GET/v1/trainline/cards-discounts | none | codenamedescriptionshort_namegrouplanguage+6 more | 1 credit |
GET/v1/trainline/fares-best | none | origindestinationprice_fromduration_minutesis_reversepath | 1 credit |
GET/v1/trainline/fares-calendar | origindestinationdate_fromdate_to+1 optional | origindestinationdate_fromdate_tocurrencydays | 1 credit |
GET/v1/trainline/fares-calendar-return | origindestinationdate_fromdate_toreturn_fromreturn_to+1 optional | origindestinationdate_fromdate_tocurrencyreturn_from+2 more | 1 credit |
GET/v1/trainline/fares-calendar-times | origindestinationdate_fromdate_to+1 optional | origindestinationdate_fromdate_tocurrencydays | 1 credit |
GET/v1/trainline/journeys | origindestinationdate+9 optional | origindestinationjourney_typecurrencytransport_modesearch_id+4 more | 1 credit |
GET/v1/trainline/journeys-calling-points | timetable_idcarrierdeparture_timeorigindestination | carriertimetable_idservice_datetransport_modecancelledhas_live_status+1 more | 1 credit |
GET/v1/trainline/journeys-local-transport | search_id+2 optional | search_idcurrencyalternatives | 1 credit |
GET/v1/trainline/journeys-page | search_id+4 optional | previous_search_iddirectioncurrencytransport_modesearch_idexpires_at+3 more | 1 credit |
GET/v1/trainline/journeys-price-prediction | search_idjourney_id+1 optional | search_idjourney_id | 1 credit |
GET/v1/trainline/journeys-return | search_idjourney_id+3 optional | outward_search_idoutward_journey_idcurrencytransport_modesearch_idexpires_at+3 more | 1 credit |
GET/v1/trainline/journeys-ticket-options | search_idoutward_journey_id+2 optional | search_idcurrencyticket_optionsticket_classes | 1 credit |
GET/v1/trainline/stations | query+2 optional | idnameshort_codetypecountry_codetimezone+7 more | 1 credit |
GET/v1/trainline/stations-nearby | station_id+2 optional | station_idwindowstations | 1 credit |
Overview
About the Trainline API
What you can get
The Trainline API returns Trainline rail and coach data as JSON through 15 endpoints. Most of them accept currency (GBP or EUR).
- Stations:
stationstakes aquery, withlimitandlocale;stations-nearbytakes astation_id, withwindow(0000-0600, 0600-1200, 1200-1800 or 1800-2400) andlocale. - Journey search:
journeystakes anorigin,destinationanddate, withtime,journey_type(single, return or open_return),return_date,return_time,adults,children,child_ageandtransport_mode(all, train or coach). - Journey details:
journeys-page,journeys-return,journeys-ticket-options,journeys-price-predictionandjourneys-local-transporttake asearch_id.journeys-returnandjourneys-price-predictionalso take ajourney_id, andjourneys-ticket-optionsanoutward_journey_id(with an optionalinward_journey_id).journeys-calling-pointstakes atimetable_id,carrier,departure_time,originanddestination. - Fare calendars:
fares-calendarandfares-calendar-timestake anorigin,destination,date_fromanddate_to;fares-calendar-returnaddsreturn_fromandreturn_to.fares-besttakes no parameters. - Cards:
cardsandcards-discountstake no parameters.
How a call works
Scan return fares over a range of dates: GET /v1/trainline/fares-calendar-return?origin=urn:trainline:generic:loc:182gb&destination=urn:trainline:generic:loc:115gb&date_from=2027-01-04&date_to=2027-01-06&return_from=2027-01-07&return_to=2027-01-09 with your key in the X-API-Key header. The journey-detail endpoints take a search_id and journey IDs rather than stations and dates. journeys-page moves through a search with page (next or previous) and direction (outward or inward). Every successful call costs 1 credit; failed calls cost nothing.
More travel APIs
Use cases
Watch single and return fares on a route across a range of dates
Use the Trainline API to watch single and return fares on a route across a range of datesCompare train and coach options on a route with `transport_mode`
Use the Trainline API to compare train and coach options on a route with `transport_mode`Look up stations by name for a travel planner or booking tool
Use the Trainline API to look up stations by name for a travel planner or booking toolList the calling points of a chosen service
Use the Trainline API to list the calling points of a chosen serviceFAQ
Questions
Do I need a Trainline API key?
No. You call this Trainline API with your Perceptlayer key in the `X-API-Key` header, with no Trainline login.
How much does the Trainline API cost?
Each successful call costs one credit. New accounts get free credits to start, and credit packs bring the price down as you scale.
What format are responses in?
Every endpoint returns JSON, with no HTML parsing on your side.
Can I search coach journeys too?
Yes. `journeys`, `journeys-page` and `journeys-return` take `transport_mode`, set to all, train or coach.
Is this the official Trainline API?
No. Perceptlayer is an independent service and is not affiliated with Trainline. It returns Trainline data as JSON with a Perceptlayer key, so there is no Trainline developer account, app review or partner approval to get first. It only reads data: if Trainline has an official API and you need to act on your own Trainline account, such as posting, managing orders or reading private data, use that one.
Should I build a Trainline scraper instead?
You can, but a Trainline scraper is code you maintain: page changes break it, requests get blocked, and Trainline's terms govern how you collect data. The Trainline API gives you 15 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.
Try the Trainline API with 100 free credits
No credit card. Failed calls are never billed.