Trainline Nearby Stations API Documentation List stations that travellers use together with a given station for a weekday time window. The answer has the same shape as the stations endpoint. The window is one of four fixed blocks of the day.
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 id from the stations endpoint. Example: urn:trainline:generic:loc:EUS1444gb.
1234567890
string
Optional
Weekday time window: 0000-0600, 0600-1200, 1200-1800 or 1800-2400. Defaults to 0600-1200.
example
string
Optional
Language of the names, e.g. en-GB. 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": {
"window": "0600-1200",
"stations": [
{
"id": "urn:trainline:generic:loc:MAN2968gb",
"name": "Manchester Piccadilly",
"type": "station",
"score": 0.291,
"parent": {
"name": "Manchester",
"type": "stationGroup"
},
"carriers": [
"atoc",
"benerail",
"benemoove",
"pao_sncf",
"nationalexpress"
],
"latitude": 53.4767,
"subtitle": null,
"timezone": "Europe/London",
"longitude": -2.229,
"attributes": [
"MainStation",
"BusStation",
"category:train"
],
"short_code": "MAN",
"country_code": "GB"
},
{
"id": "urn:trainline:generic:loc:BHM1127gb",
"name": "Birmingham New Street",
"type": "station",
"score": 0.247,
"parent": {
"name": "Birmingham",
"type": "stationGroup"
},
"carriers": [
"atoc",
"benerail",
"benemoove",
"pao_sncf",
"nationalexpress"
],
"latitude": 52.4782,
"subtitle": "City centre, Main",
"timezone": "Europe/London",
"longitude": -1.8984,
"attributes": [
"MainStation",
"BusStation",
"category:train"
],
"short_code": "BHM",
"country_code": "GB"
},
{
"id": "urn:trainline:generic:loc:MKC1378gb",
"name": "Milton Keynes Central",
"type": "station",
"score": 0.223,
"parent": null,
"carriers": [
"atoc",
"benerail",
"benemoove",
"pao_sncf",
"nationalexpress"
],
"latitude": 52.0343,
"subtitle": null,
"timezone": "Europe/London",
"longitude": -0.7741,
"attributes": [
"BusStation",
"category:train"
],
"short_code": "MKC",
"country_code": "GB"
}
],
"station_id": "urn:trainline:generic:loc:EUS1444gb"
},
"meta": {
"billable": true,
"endpoint_family": "stations_nearby"
},
"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_nearby"
},
"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.