Trainline Stations API Documentation Find rail and coach stations, cities and station groups by name, city or station code. Each result has a station id, a type (station or station group), the country, coordinates, the time zone and the carriers that serve it. Use the id as origin or destination in the journey and fare endpoints. Always take station ids from this endpoint: an id typed by hand can return no journeys.
Run this endpoint
Endpoint
Parameters
Start with the required fields, then add optional filters only when your use case needs them.
Runnable path
1 required parameter needed before sending a request.
2 optional filters available.
string
Required
Station, city or code, 2 to 100 characters. Example: london.
coffee shops
integer
Optional
Number of results, 1 to 30. Defaults to 10.
10
string
Optional
Language of the names, e.g. en-GB or de-DE. Defaults to en-GB.
en-US
Response Schema
Example response fields are illustrative; inspect the JSON before integrating.
Example response fields
Scan these fields before integrating.
data
meta
success
{
"data": {
"query": "london",
"locale": "en-GB",
"stations": [
{
"id": "urn:trainline:generic:loc:182gb",
"name": "London",
"type": "stationGroup",
"score": 1,
"parent": null,
"carriers": [
"atoc",
"benerail",
"benemoove",
"distribusion",
"pao_sncf",
"nationalexpress",
"eurostardirect"
],
"latitude": null,
"subtitle": "Any",
"timezone": "Europe/London",
"longitude": null,
"attributes": [
"BusStation",
"category:point"
],
"short_code": "182",
"country_code": "GB"
},
{
"id": "urn:trainline:generic:loc:EUS1444gb",
"name": "London Euston",
"type": "station",
"score": 0.42039064,
"parent": {
"name": "London",
"type": "stationGroup"
},
"carriers": [
"atoc",
"benerail",
"benemoove",
"pao_sncf",
"nationalexpress"
],
"latitude": 51.5284,
"subtitle": null,
"timezone": "Europe/London",
"longitude": -0.1346,
"attributes": [
"BusStation",
"category:train"
],
"short_code": "EUS",
"country_code": "GB"
}
]
},
"meta": {
"billable": true,
"endpoint_family": "stations"
},
"success": true
}
Errors
Handle these documented responses before retrying or showing customer-facing failures.
Validation Error
A required parameter is missing or invalid. This response is not billable.
{
"errors": {
"origin": [
"The origin is a station id from the stations endpoint."
]
},
"message": "The request validation failed"
}Upstream Unavailable
Trainline did not answer in time. Scrappa retries on other exits first. This response is not billable. Retry after a few seconds.
{
"meta": {
"billable": false,
"retryable": true,
"endpoint_family": "stations"
},
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "The Trainline service is temporarily unavailable. Please retry."
},
"success": false
}Generate Code with AI
Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.
Try It Live
Test this endpoint in our interactive playground with real data.