Developer guide
Live Train Tracking API Guide
Look up a train's latest reported movement by five-digit train number and journey start date. V1 returns the full NTES route, stoppage and intermediate station times, journey metrics, Hindi names when available, and detailed coach composition.
GET /api/v1/trains/:trainNumber/live/:date
Get started
- Get a RailKit API key and keep it on your server.
- Use a five-digit train number and its journey start date in DD-MM-YYYY format. Date must be today or within the previous five days in India time.
- Read statusNote, lastUpdate, currentStationCode, progress, and timeline. Stoppages include actual and scheduled times; intermediate points include scheduled times only. Treat last reported position as an estimate, not GPS location.
SDK and REST examples
Every plan supports the Node.js SDK. Direct REST access requires Advance or Scale. See current plan limits.
Node.js SDK
Install with npm install railkit. Set the API key and journey inputs in your server environment before running the example.
import { configure, trackTrain } from "railkit";
configure(process.env.RAILKIT_API_KEY);
const result = await trackTrain(process.env.TRAIN_NUMBER, process.env.JOURNEY_DATE);
if (result.success) {
console.log(result.data.statusNote, result.data.lastUpdate);
}REST API
Run from a server terminal. Set RAILKIT_API_KEY and replace the example inputs with your own.
export RAILKIT_API_KEY="your_api_key"
export TRAIN_NUMBER="12345"
export JOURNEY_DATE="$(TZ=Asia/Kolkata date +%d-%m-%Y)"
curl "https://api.railkit.in/api/v1/trains/$TRAIN_NUMBER/live/$JOURNEY_DATE" \
-H "x-api-key: $RAILKIT_API_KEY" \
-H "accept: application/json"Response example
{
"success": true,
"data": {
"trainNo": "12345",
"trainName": "Example Express",
"trainNameHindi": "उदाहरण एक्सप्रेस",
"date": "17-Oct-2026",
"statusNote": "Arrived at RAMPUR HAT (RPH)",
"lastUpdate": "17-Oct-2026 19:19 IST",
"currentStationCode": "RPH",
"totalStations": 161,
"totalStoppageStations": 18,
"totalDistanceKm": 998,
"averageSpeedKmph": 61.29,
"progress": {
"journeyStatus": "running",
"currentStationIndex": 50,
"totalStations": 161,
"passedStations": 49,
"remainingStations": 111,
"currentDistanceKm": 207,
"distanceRemainingKm": 791,
"percent": 20.74
},
"timeline": [
{
"type": "stoppage",
"status": "passed",
"stationCode": "HWH",
"stationName": "HOWRAH JN",
"stationNameHindi": "हावड़ा जं",
"platform": "15",
"distanceKm": "0",
"arrival": { "scheduled": "SRC", "actual": "SRC", "delay": "" },
"departure": { "scheduled": "16:05 17-Oct", "actual": "16:06 17-Oct", "delay": "00:01" }
},
{
"type": "intermediate",
"status": "passed",
"stationCode": "SYAE",
"stationName": "Example intermediate station",
"distanceKm": "3",
"arrival": { "scheduled": "16:10" },
"departure": { "scheduled": "16:10" }
}
],
"coachPosition": [{
"type": "HA1",
"number": "HA1",
"position": "4",
"id": "710580",
"operatedBy": "ER",
"coachType": "LWFCWAC",
"coachNo": "194544",
"manufacturedIn": 2019,
"coachClass": "1A+2A",
"variant": "1A-10-2A-28-V1"
}],
"coachPositionTimeline": [{
"fromStationCode": "HWH",
"fromStationName": "HOWRAH JN",
"coachPosition": [{
"type": "HA1", "number": "HA1", "position": "4", "id": "710580",
"operatedBy": "ER", "coachType": "LWFCWAC", "coachNo": "194544",
"manufacturedIn": 2019, "coachClass": "1A+2A", "variant": "1A-10-2A-28-V1"
}]
}]
}
}- statusNote summarizes reported movement. Stoppage points carry scheduled and actual arrival/departure; intermediate points carry scheduled arrival/departure only.
- totalStations counts stoppage and intermediate points; totalStoppageStations counts only stoppages. Hindi names appear when NTES provides them. Missing intermediate English names can be filled from the local station catalog.
- averageSpeedKmph is route distance divided by scheduled running time after interior station dwell is subtracted.
- Coach metadata includes position label, upstream record ID, owning railway, transportation type, stock number, derived manufacture year, class, and variant. coachPositionTimeline is present when composition changes along the route.
- lastUpdate may be empty before movement begins. Check it before showing a 'live' badge.
- Example response is illustrative; actual fields and times vary by journey and provider.
Data freshness
Train movement comes from upstream reports and may lag real-world location. Show the returned lastUpdate beside the status. A journey that has not started can have no fresh update; this API does not guarantee a fixed refresh interval.
Errors and recovery
- 400: Train number or date is invalid. Use five digits and a supported journey date.
- 401 or 403: API key is missing, invalid, or inactive.
- 404: No live record for that train and journey date. Check whether the train runs that day.
- 429: Request limit reached. Reduce polling frequency and retry with backoff.
- 5xx or upstream failure: Keep the last known status with its timestamp, then retry later.