Trainline

HealthyRead-only

Train ticket fares and departure times between any two stations on Trainline (thetrainline.com). Generated from www.thetrainline.com.

Base URL
https://api.maviapi.com/v1/sites/thetrainline
2
Endpoints
329ms
p50 latency
25
Calls / 30d
GET/fares

Initial release

Cheapest single fares and departure times between two stations, by day. Resolves free-text place names to Trainline stations, then prices the route.

Bearer auth. Pass your key as Authorization: Bearer <key> on every request.
stringRequiredin query

Origin: a place/station name (resolved to the best match) or a Trainline urn code

stringRequiredin query

Destination: a place/station name or a Trainline urn code

stringOptionalin query

First day of the window (YYYY-MM-DD, UTC). Defaults to today.

integerOptionalin query

Number of days from `date` to price (1-14)

stringOptionalin query

Fare currency

integerOptionalin query

Max days to return

integerOptionalin query

Days to skip (pagination)

booleanOptionalin query

Bypass and repopulate the cache

dataobject
cachedboolean
sourcestring
paginationobject
Try itLive
GET
https://api.maviapi.com/v1/sites/thetrainline/fares?from=london&to=manchester&date=2026-08-11&days=3&currency=GBP&limit=50&offset=0&refresh=false
Request
curl "https://api.maviapi.com/v1/sites/thetrainline/fares?from=london&to=manchester&date=2026-08-11&days=3&currency=GBP&limit=50&offset=0&refresh=false" \
-H "Authorization: Bearer $MAVI_KEY"
Example767 B
{
  "data": {
    "origin": {
      "name": "London",
      "code": "urn:trainline:generic:loc:182gb"
    },
    "destination": {
      "name": "Manchester Piccadilly",
      "code": "urn:trainline:generic:loc:MAN2968gb"
    },
    "currency": "GBP",
    "journey_type": "single",
    "date_from": "2026-08-11",
    "date_to": "2026-08-13",
    "cheapest_price": 14,
    "cheapest_date": "2026-08-11",
    "days": [
      {
        "date": "2026-08-11",
        "cheapest_price": 14,
        "currency": "GBP",
        "departures": [
          "2026-08-11T05:43:00.000Z"
        ]
      }
    ]
  },
  "cached": false,
  "source": "thetrainline:graphql",
  "pagination": {
    "total": 3,
    "limit": 50,
    "offset": 0,
    "count": 3,
    "has_more": false
  }
}

Get all the data, no code

Collect every page of GET /fares into a dataset, then download it as CSV or JSON. One credit per page; the download is free.