Skip to content
Alpha — Headcode is currently in alpha. APIs and data may change without notice.

Train order

The train order endpoint returns the sequence in which trains are expected at each platform of a station.

GET /v1/train-orders/{station_id}

The {station_id} parameter accepts a station CRS code.

The response groups trains by platform. Each platform lists up to three upcoming trains in order:

{
"station": "KGX",
"platforms": [
{
"platform": "1",
"trains": [
{
"position": 1,
"rid": "202605141A45",
"train_id": "1A45",
"public_departure": "10:03",
"working_departure": "10:02:30"
},
{
"position": 2,
"rid": "202605141B50",
...
}
]
}
]
}

Use the platform query parameter to return only a single platform:

GET /v1/train-orders/KGX?platform=1

Station boards and train order answer different questions:

Departure boardTrain order
ScopeAll platformsPer-platform
OrderingBy scheduled timeBy expected platform sequence
DepthConfigurable (up to 100)Up to 3 trains per platform
FiltersTOC, destination, calling pointPlatform only

Use departure boards for passenger-facing “what’s leaving next?” views. Use train order when display position at a specific platform matters — for example, platform indicator screens or operational displays.

Not all stations have train order data. If no train order exists for a station, the endpoint returns a 404 with error code HEADCODE.TRAIN_ORDERS.NOT_FOUND. Design your application to fall back to the departure board filtered by platform when train order is not available.