Skip to content

Trainline Locations API

Trainline stations and places matching a name, best match first, with the urn codes that /fares accepts.

GEThttps://api.maviapi.com/v1/sites/thetrainline/locations1 credit per call

Parameters

NameRequiredExampleDescription
qstring in queryOptionallondonsearch term, a station or place name (e.g. "london", "paris nord")

Response fields

querystringe.g."london"
locationsobject[]5 fields
namestringe.g."London"
codestringe.g."urn:trainline:generic:loc:182gb"
typestringe.g."stationGroup"
countrystringe.g."GB"
subtitlestringe.g."Any"
paginationobject3 fields
countintegere.g.30
has_morebooleane.g.false
next_cursornull
fetched_atstringe.g."2026-11-27T10:15:54.995Z"
ageintegere.g.0

Example request

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

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

Trainline Locations API questions

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

What does the Trainline Locations API return?

Trainline stations and places matching a name, best match first, with the urn codes that /fares accepts. The response has query, locations, pagination, fetched_at and age.

Which parameters does the Trainline Locations API take?

Every parameter of GET /locations is optional. You can pass q.

How much does one Trainline Locations API call cost?

One successful call costs 1 credit. A failed call costs nothing. On the Hobby plan ($49 a month for 250,000 credits), 1,000 calls cost about $0.20. 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 Locations API?

Send an HTTPS GET request to https://api.maviapi.com/v1/sites/thetrainline/locations 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 Locations 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.