Skip to content

Trainline Fares API

The fare window between two places: origin, destination, the window's dates, its cheapest day and price, and `days`, the list of priced days in date order, each with its cheapest single (one-way) fare and the departure times of the cheapest trains. Days Trainline holds no fare data for may be missing or come back with date and cheapest_price null.

GEThttps://api.maviapi.com/v1/sites/thetrainline/fares5 credits per call

Parameters

NameRequiredExampleDescription
fromstring in queryOptionallondonorigin, a place or station name (best match is used, as in /locations) or a Trainline urn code
tostring in queryOptionalmanchesterdestination, a place or station name or a Trainline urn code
datestring in queryOptionalNonefirst day of the window, YYYY-MM-DD (UTC); defaults to today
daysinteger in queryOptional3number of days to price starting at `date`, 1-14
currencystring in queryOptionalGBPcurrency of the fares (GBP, EUR, USD, CHF, DKK, SEK or NOK)One of GBP, EUR, USD, CHF, DKK, SEK, NOK

Response fields

originobject2 fields
namestringe.g."London"
codestringe.g."urn:trainline:generic:loc:182gb"
destinationobject2 fields
namestringe.g."Manchester Piccadilly"
codestringe.g."urn:trainline:generic:loc:MAN2968gb"
currencystringe.g."GBP"
journey_typestringe.g."single"
date_fromstringe.g."2026-11-27"
date_tostringe.g."2026-11-29"
cheapest_pricenumbere.g.21.9
cheapest_datestringe.g."2026-11-28"
daysobject[]4 fields
datestringe.g."2026-11-27"
cheapest_priceintegere.g.36
currencystringe.g."GBP"
departuresstring[]
paginationobject3 fields
countintegere.g.3
has_morebooleane.g.false
next_cursornull
fetched_atstringe.g."2026-11-27T10:16:44.709Z"
ageintegere.g.0

Example request

Set MAVI_KEY to your API key. A successful call costs 5 credits per call, and a failed call costs nothing.

cURL
curl 'https://api.maviapi.com/v1/sites/thetrainline/fares' \
  -H "Authorization: Bearer $MAVI_KEY"

Trainline Fares API questions

What you get, what it costs and how to call it.

What does the Trainline Fares API return?

The fare window between two places: origin, destination, the window's dates, its cheapest day and price, and `days`, the list of priced days in date order, each with its cheapest single (one-way) fare and the departure times of the cheapest trains. Days Trainline holds no fare data for may be missing or come back with date and cheapest_price null. The response has origin, destination, currency, journey_type, date_from, date_to, cheapest_price, cheapest_date and 4 more.

Which parameters does the Trainline Fares API take?

Every parameter of GET /fares is optional. You can pass from, to, date, days and currency.

How much does one Trainline Fares API call cost?

One successful call costs 5 credits. A failed call costs nothing. On the Hobby plan ($49 a month for 250,000 credits), 1,000 calls cost about $0.98. The Free plan gives you 1,000 credits a month, with no credit card required. See plans and credit prices for everything after that.

How do I call the Trainline Fares API?

Send an HTTPS GET request to https://api.maviapi.com/v1/sites/thetrainline/fares with your API key in the Authorization header, as in the example request on this page. Create a key on your API keys page, or try the endpoint first in the console with the free test key.

Is the Trainline Fares API official?

No. It is an independent, hosted API from maviapi for the public data on thetrainline.com, and it is not made, endorsed or supported by Trainline. Its parameters and response fields are documented on this page.