Station Live Board

GETGET /v1/station/:code/live?hours=4

Description

Arrivals and departures for one station over a rolling window around now: every train with its scheduled times at this station, platform, expected (delayed) times, delay minutes and a live state such as at-station, upcoming, departed or scheduled. This is the departures board, driven by the same live observations as the train status endpoint.

Parameters

NameInTypeRequiredDescription
codePATHstringYESPath param - station code, e.g. NDLS, HWH, BCT.
hoursQUERYnumberNOQuery param - window in hours ahead of now. One of 2, 4, 6 or 8. Default 4.
includeIntermediateQUERYbooleanNOQuery param - include trains that pass without halting (true/false). Default false.

Code Example

javascript
const res = await fetch(
  "https://railway-engine.apkscope.workers.dev/v1/station/NDLS/live?hours=4",
  { headers: { "x-api-key": "YOUR_KEY" } },
);

const { status, data, error } = await res.json();
if (status === "SUCCESS" || status === "STALE_DATA") {
  console.log(data.station.name, data.window.from, "-", data.window.to, data.count, "trains");
  for (const t of data.trains) {
    console.log(
      t.trainNumber, t.trainName,
      "arr", t.arrival, "pf", t.platform,
      "live", t.liveStatus, "delay", t.delayMinutes,
    );
  }
} else {
  console.error(status, error?.code, error?.message);
}

Notes

Errors: 400 INVALID_REQUEST (bad code, hours outside 2/4/6/8, or a non-boolean flag), 404 STATION_NOT_FOUND, 429 RATE_LIMITED, 503 PROVIDER_UNAVAILABLE. `arrival`/`departure` are scheduled clock times (HH:MM IST) and are null at the origin or destination end of a train; `expectedArrival`/`expectedDeparture` are absolute instants including delay and are null when no observation exists. `liveStatus` values are at-station, upcoming, departed, scheduled or unknown (unknown is reported, never guessed).

Response Example

JSON response
200JSON