Discover/Gov API
live

Gov APIindianrail.gov.in ↗

Query Indian Railways station codes, trains between stations, live seat availability (GNWL/RAC/WL), and fare breakdowns via 4 structured endpoints.

Endpoint health
verified 2h ago
search_stations
get_trains_between_stations
get_seat_availability
get_fare
4/4 passing latest checkself-healing
Endpoints
4
Updated
2h ago

What is the Gov API?

The Indian Railways API exposes 4 endpoints that cover station search, reserved train listings between any two stations, live seat availability with status breakdowns across consecutive dates, and per-class fare details — all sourced from indianrail.gov.in. The get_trains_between_stations endpoint returns structured fields including departure and arrival times, available classes, and quota codes, replacing manual lookups on the IRCTC reservation enquiry site.

This call costs2 credits / call— charged only on success
Try it
Station code prefix or part of a station name, at least 2 characters, case-insensitive (e.g. 'mumbai' or 'NDL').
→ api.parse.bot/scraper/f908405b-e5c2-48b7-b976-84771aec0a20/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/f908405b-e5c2-48b7-b976-84771aec0a20/search_stations?query=mumbai' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace indianrail-gov-in-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""Walkthrough: Indian Railways train enquiry — bounded, re-runnable."""
from parse_apis.indianrail_gov_in_api import IndianRail, InputNotFound

client = IndianRail()

# Find station codes matching a city name.
for station in client.stations.search(query="mumbai", limit=5):
    print(station.station_code, station.station_name)

# Pick the first matching station to use as destination.
dest = client.stations.search(query="mumbai", limit=1).first()
if dest is not None:
    # Search trains from Delhi (NDLS) to the discovered station.
    try:
        for train in client.trains.search(
            from_station="NDLS",
            to_station=dest.station_code,
            journey_date="2026-10-16",
            limit=3,
        ):
            print(
                train.train_number,
                train.train_name,
                train.departure_time, "→", train.arrival_time,
                f"{train.distance_km} km",
            )
            # Nested schedule shows which days the train runs.
            if train.runs_on.sat:
                print("  ^ runs on Saturday")
    except InputNotFound:
        print("station code not recognized upstream")

    # Fetch the full result wrapper for metadata alongside trains.
    result = client.train_results.fetch(
        from_station="NDLS",
        to_station=dest.station_code,
        journey_date="2026-10-16",
    )
    print(f"{result.count} trains, quota codes: {result.quota_codes}")

    # Check seat availability for the first train found.
    first_train = client.trains.search(
        from_station="NDLS",
        to_station=dest.station_code,
        journey_date="2026-10-16",
        limit=1,
    ).first()
    if first_train is not None:
        avail = client.availabilities.get(
            from_station="NDLS",
            to_station=dest.station_code,
            train_number=first_train.train_number,
            journey_date="2026-10-16",
            travel_class="3A",
        )
        print(avail.status, avail.status_kind)
        for day in (avail.availability or [])[:3]:
            print(f"  {day.date}: {day.status} (count={day.count})")

        # Get the fare breakdown for the same train.
        fare = client.fares.get(
            train_number=first_train.train_number,
            from_station="NDLS",
            to_station=dest.station_code,
            journey_date="2026-10-16",
            travel_class="3A",
        )
        print(f"Total fare: {fare.currency} {fare.total_fare} ({fare.distance_km} km)")

print("exercised: stations.search / trains.search / train_results.fetch / availabilities.get / fares.get")
All endpoints · 4 totalmissing one? ·

Finds railway stations whose code or name matches a query, returning the station code to use with get_trains_between_stations. One round trip: the site's full station list is fetched and filtered locally; stations whose code starts with the query come first, then stations whose name contains it. Up to 200 matches are returned; an empty list means no station matched.

Input
ParamTypeDescription
queryrequiredstringStation code prefix or part of a station name, at least 2 characters, case-insensitive (e.g. 'mumbai' or 'NDL').
Response
{
  "type": "object",
  "fields": {
    "count": "number of stations returned (integer, max 200)",
    "query": "the query as searched (trimmed)",
    "stations": "array of matching stations, each with station_code (short code used by the railway) and station_name"
  },
  "sample": {
    "data": {
      "count": 2,
      "query": "mumbai",
      "stations": [
        {
          "station_code": "BCT",
          "station_name": "MUMBAI CENTRAL"
        },
        {
          "station_code": "MMCT",
          "station_name": "MUMBAI CENTRAL"
        }
      ]
    },
    "status": "success"
  }
}

About the Gov API

Station Search and Train Discovery

The search_stations endpoint accepts a partial station name or code prefix (minimum 2 characters) and returns up to 200 matches, each with a station_code and station_name. Station codes returned here feed directly into get_trains_between_stations, which requires from_station and to_station codes plus an optional journey_date in ISO YYYY-MM-DD format. Each train in the response carries train_number, train_name, departure_time, arrival_time, the actual boarding and alighting station codes, and an available_classes list. Setting flexible_with_date: true also populates alternate_date_trains with results for nearby dates.

Live Seat Availability

The get_seat_availability endpoint takes a train_number, from_station, to_station, travel_class, and quota code (e.g. GN for General, TQ for Tatkal) and returns an availability array spanning roughly two weeks from the requested journey_date. Each entry includes date, status (raw site string such as GNWL101/WL20), status_kind (available, rac, waitlist, or other), and a numeric count parsed from the status. The top-level status and status_kind fields reflect the specific journey_date queried.

Fare Breakdown

The get_fare endpoint returns a full fare breakdown for one adult on a given train, class, and quota. Response fields include base_fare, reservation_charge, fuel_amount, service_tax, tatkal_fare, total_fare, and distance_km. All amounts are in INR. The currency field is always INR. Quota codes and class codes come from the quota_codes and available_classes fields of a prior get_trains_between_stations response, making the workflow composable across endpoints.

Reliability & maintenanceVerified

The Gov API is a managed, monitored endpoint for indianrail.gov.in — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when indianrail.gov.in changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official indianrail.gov.in API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
2h ago
Latest check
4/4 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Build a train planner that shows all reserved trains between two cities on a given date, using departure and arrival times from get_trains_between_stations.
  • Display live seat availability for a shortlist of trains, surfacing GNWL, RAC, and WL counts per class from get_seat_availability.
  • Compare Tatkal vs General quota fares across travel classes using the base_fare and tatkal_fare fields from get_fare.
  • Auto-complete station search in a booking UI with station_code and station_name results from search_stations.
  • Alert users when a waitlisted train shows available seats on an alternate date using alternate_date_trains from get_trains_between_stations.
  • Estimate total trip cost including service tax and fuel surcharge for multi-leg journeys using get_fare distance_km and total_fare fields.
  • Monitor daily seat availability trends across a two-week window using the availability array from get_seat_availability.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo2005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min
Team$300/mo20,000300 req/min
Company$1,000/mo100,000500 req/min

Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does Indian Railways have an official developer API?+
The Indian Railways Ministry operates indianrail.gov.in as a public passenger enquiry portal but does not publish a documented developer API or offer API keys for programmatic access. This Parse API exposes the same enquiry data in a structured JSON format.
What does get_seat_availability actually return, and how many dates does it cover?+
It returns an array of consecutive dates starting at your requested journey_date — typically around 14 entries, though fewer may appear close to the advance reservation window limit. Each entry has a raw status string (e.g. GNWL101/WL20), a parsed status_kind (available, rac, waitlist, or other), and a numeric count extracted from the status. The top-level status and count fields reflect only the queried journey_date.
Can I look up unreserved (general/second class) train availability or platform number data?+
Not currently. The API covers reserved-class availability (classes like 2A, 3A, SL, CC) and fare data for those classes. Unreserved compartment availability and platform assignments are not included. You can fork this API on Parse and revise it to add an endpoint targeting the unreserved enquiry section.
Are cancelled trains or diverted routes reflected in get_trains_between_stations results?+
The results reflect what the indianrail.gov.in enquiry surface returns for the queried date; it does not add a separate cancellation or diversion flag. If a train is cancelled or its routing changed on a given date, the response will mirror whatever the site reports. There is no dedicated cancelled_trains or diversion field in the current response shape.
Does the API cover train schedules (full timetable) or PNR status?+
Not currently. The four endpoints cover station search, trains between two stations, seat availability, and fare enquiry. Full route timetables and PNR status are not exposed. You can fork this API on Parse and revise it to add those endpoints.
Page content last updated . Spec covers 4 endpoints from indianrail.gov.in.
Related APIs in TravelSee all →
irctc.co.inapi API
Access data from irctc.co.inAPI.
irctc.co.in API
Search for trains between Indian Railway stations and instantly check fares, seat availability, and schedules all in one place. Book your journey with real-time information about train options and pricing through IRCTC Railway data.
enquiry.indianrail.gov.in API
Search for trains between Indian stations, check schedules, and look up station details to plan your rail journeys. Get real-time train information with support for captcha-protected searches to ensure reliable access to Indian Railways data.
railyatri.in API
Search trains between stations and get real-time information including live train status, timetables, seat availability, and PNR confirmation details. Find the perfect journey by autocompleting station and train names while checking current availability and train schedules.
amtrak.com API
Search for Amtrak trains across stations, compare fares, and discover discounts to plan your rail journey with current pricing and availability. Get detailed train information, autocomplete station names, and find the cheapest routes for your travel dates.
thetrainline.com API
Search UK train stations and find the cheapest fares across date ranges, then generate direct booking links to complete your purchase on Trainline.com. Get real-time journey information to compare prices and book your tickets in seconds.
nationalrail.co.uk API
Check live train departure and arrival times at UK stations, search for specific stations, and get real-time service disruption alerts. Stay informed about rail service delays and changes to plan your journeys efficiently.
onlineupsrtc.co.in API
Access data from onlineupsrtc.co.in.