Developer guide

Train Seat Availability API Guide

RailKit checks Indian Railways seat availability for a particular train, station pair, travel date, class, and quota. The response includes availability by date and a fare breakdown when the data source provides it.

GET /api/v1/seats/:trainNo/:fromStnCode/:toStnCode/:date/:coach/:quota

Get started

  1. Create a RailKit account and generate an API key. Keep that key on your server.
  2. Use the five-digit train number and station codes for the segment the passenger will travel.
  3. Set the travel date in DD-MM-YYYY format, the class (for example, 3A for AC three-tier), and the quota (for example, GN for General).
Get an API key

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, getAvailability } from "railkit";

configure(process.env.RAILKIT_API_KEY);
const result = await getAvailability(
  "12904", "NZM", "BDTS", process.env.JOURNEY_DATE, "3A", "GN",
);
if (result.success) {
  console.log(result.data.availability, result.data.fare?.totalFare);
}

REST API

Run from a server terminal. Set RAILKIT_API_KEY and replace the example inputs with your own.

export JOURNEY_DATE="DD-MM-YYYY"

curl "https://api.railkit.in/api/v1/seats/12904/NZM/BDTS/$JOURNEY_DATE/3A/GN" \
  -H "x-api-key: $RAILKIT_API_KEY" \
  -H "accept: application/json"

Response example

{
  "success": true,
  "data": {
    "train": { "trainNo": "12904", "from": "NZM", "to": "BDTS", "travelClass": "3A", "quota": "GN" },
    "fare": { "totalFare": 1670 },
    "availability": [{
      "date": "1-9-2026",
      "status": "WAITLIST",
      "availabilityText": "WL 23",
      "rawStatus": "RLWL31/WL23",
      "canBook": true
    }]
  }
}
  • This example shows selected fields. Each availability entry describes the date in that entry. Display the date alongside the status.
  • Use availabilityText for display and status for application logic. A waitlisted journey can have canBook set to true.
  • Use fare.totalFare when present. For a dedicated price breakdown, use the fare lookup endpoint.

Data freshness

Availability and fare can change between lookup and booking. Show when you checked and refresh before the user proceeds. Present waitlist predictions as estimates of confirmation.

Errors and recovery

  • For invalid input, confirm the route, date format, class, and quota against the endpoint reference.
  • For authorization errors, check the API key and whether the account supports REST access.
  • On rate limits, wait before retrying. If upstream data is unavailable, show that status instead of reporting zero seats.