Trainline Locations API
Trainline stations and places matching a name, best match first, with the urn codes that /fares accepts.
https://api.maviapi.com/v1/sites/thetrainline/locations1 credit per callParameters
| Name | Required | Example | Description |
|---|---|---|---|
qstring in query | Optional | london | search term, a station or place name (e.g. "london", "paris nord") |
Response fields
querye.g."london"locations
namee.g."London"codee.g."urn:trainline:generic:loc:182gb"typee.g."stationGroup"countrye.g."GB"subtitlee.g."Any"pagination
counte.g.30has_moree.g.falsenext_cursorfetched_ate.g."2026-11-27T10:15:54.995Z"agee.g.0Example request
Set MAVI_KEY to your API key. A successful call costs 1 credit per call, and a failed call costs nothing.
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.