IRCTC Connect SDK

Railway API documentation, built for production.

Install the Node.js SDK, configure your API key, and call typed methods for PNR status, train info, live tracking, station boards, train search, and seat availability.

Endpoints

7

Runtime

Node 14+

Auth

API Key

Package

irctc-connect

Installation

Terminal
npm install irctc-connect

Requirements

Node.js 14+
Active internet connection
Valid API key in environment variables

Supported Platforms

Node.js apps and scripts
Express servers
Next.js App Router projects
React Native environments

Quick Start

Call configure(apiKey) once at app startup before any request method.
javascript
import {
  configure,
  checkPNRStatus,
  getTrainInfo,
  trackTrain,
  liveAtStation,
  searchTrainBetweenStations,
  getAvailability,
  fareLookup
} from "irctc-connect";

configure(process.env.IRCTC_API_KEY);

const pnr    = await checkPNRStatus("1234567890");
const train  = await getTrainInfo("12345");
const live   = await trackTrain("12345", "06-12-2025");
const stn    = await liveAtStation("NDLS");
const search = await searchTrainBetweenStations("NDLS", "BCT");
const seats  = await getAvailability("12496","ASN","DDU","27-12-2025","2A","GN");
const fare   = await fareLookup("12313","ASN","NDLS","06-06-2026","3A","GN");

PNR Status

Get complete PNR status with passenger details, journey route, and confirmation updates.

checkPNRStatus(pnr: string)

pnr

string

10-digit PNR number

javascript
const result = await checkPNRStatus("1234567890");

if (result.success) {
  console.log(result.data.status);
  console.log(result.data.train.name);
  console.log(result.data.passengers);
}

Train Information

Retrieve route details, running schedule, stoppages, and station-level metadata.

getTrainInfo(trainNumber: string)

trainNumber

string

5-digit train number

javascript
const result = await getTrainInfo("12345");

if (result.success) {
  console.log(result.data.trainInfo.train_name);
  console.log(result.data.route.length);
}

Live Tracking

Track live train movement with station-by-station arrival and delay context.

trackTrain(trainNumber: string, date: string)

trainNumber

string

5-digit train number

date

string

Journey date in DD-MM-YYYY

javascript
const result = await trackTrain("12342", "06-12-2025");

if (result.success) {
  console.log(result.data.statusNote);
  console.log(result.data.timeline);
}

Live At Station

Get upcoming and passing trains at a station with near real-time status.

liveAtStation(stationCode: string)

stationCode

string

Station code such as NDLS, BCT, HWH

javascript
const result = await liveAtStation("NDLS");

if (result.success) {
  console.log(result.data[0]?.trainname);
}

Seat Availability

Check availability forecasts and detailed fare breakup by quota and class.

getAvailability(trainNo, fromStnCode, toStnCode, date, coach, quota)

trainNo

string

5-digit train number

fromStnCode

string

Origin station code

toStnCode

string

Destination station code

date

string

Journey date in DD-MM-YYYY

coach

string

SL, 3A, 2A, 1A, CC, EC, 2S

quota

string

GN, TQ, LD, SS

javascript
const result = await getAvailability(
  "12496", "ASN", "DDU",
  "27-12-2025", "2A", "GN"
);

Fare Lookup

Get the full fare breakdown for a journey — base fare, reservation, superfast, catering, GST, dynamic fare, and total collectible amount.

fareLookup(trainNo, fromStnCode, toStnCode, date, travelClass, quota)

trainNo

string

5-digit train number

fromStnCode

string

Origin station code

toStnCode

string

Destination station code

date

string

Journey date in DD-MM-YYYY

travelClass

string

1A · 2A · 3A · 3E · CC · EC · EA · FC · SL · 2S · VS · CH · HS · VC · VA

quota

string

GN · TQ · PT · LD · DF · FT · LB · YU · DP · HP · PH · SS

javascript
const result = await fareLookup(
  "12313", "ASN", "NDLS",
  "06-06-2026", "3A", "GN"
);

if (result.success) {
  const d = result.data;
  console.log(`${d.trainName} (${d.trainNo})`);
  console.log(`${d.from}${d.to} | ${d.distance} km`);
  console.log(`Base: ₹${d.baseFare}  GST: ₹${d.gst}  Total: ₹${d.totalFare}`);
}

Playground

The live playground is available inside your user panel. Run real API calls with your account key and inspect latency plus JSON responses.

Open Playground

Input Validation

PNR

Exactly 10 digits
Numeric input only
Reject malformed values early

Train Number

Exactly 5 digits
Treat as string to preserve zeros
No spaces or symbols

Date

DD-MM-YYYY format
Validate real calendar date
Use same format across APIs

Station Code

Uppercase station code
Examples: NDLS, BCT, HWH
Trim extra whitespace

Status Codes

CodeFull FormDescription
CNFConfirmedSeat or berth is confirmed
WLWaiting ListSeat not confirmed yet
RACReservation Against CancellationPartial seat allocation
CANCancelledTicket is cancelled
PQWLPooled Quota WLPooled quota waiting
TQWLTatkal Quota WLTatkal waiting
GNWLGeneral WLGeneral waiting list

Error Handling

Success Response

{
  success: true,
  data: { ... }
}

Error Response

{
  success: false,
  message: "Error message"
}

Common Error Scenarios

Missing configure(apiKey) call
Invalid or expired API key (401)
Inactive API key (403)
Rate limit exceeded (429)
Invalid train/PNR/date inputs
Temporary upstream timeout or API outage