Train Route

GETGET /v1/train/:number/route?date=YYYY-MM-DD

Description

Station-by-station route for a train on a given date: every stop with scheduled and actual arrival/departure times, halt flag, journey day, platform, cumulative distance and coordinates.

Parameters

NameInTypeRequiredDescription
numberPATHstringYESPath param — 5-digit train number, e.g. 12919.
dateQUERYstringNOQuery param — journey date in YYYY-MM-DD. Omit for today. Allowed: yesterday to +7 days (status), yesterday to +90 days (schedule/route).

Code Example

javascript
const res = await fetch(
  "https://railway-engine.apkscope.workers.dev/v1/train/12919/route",
  { headers: { "x-api-key": "YOUR_KEY" } },
);

const { status, data, error } = await res.json();
if (status === "SUCCESS") {
  for (const stop of data.stops) {
    console.log(
      stop.sequence, stop.station.code, stop.station.name,
      "arr", stop.scheduledArrival, "dep", stop.scheduledDeparture,
      "PF", stop.platform, stop.distanceKm + "km",
    );
  }
} else {
  console.error(status, error?.code, error?.message);
}

Notes

Errors: 400 INVALID_REQUEST, 404 TRAIN_NOT_FOUND, 429 RATE_LIMITED, 503 PROVIDER_UNAVAILABLE. Actual times are null when no observation exists yet for that stop — the API reports missing data instead of inventing it. Two stops are shown here; real routes have many more.

Response Example

JSON response
200JSON