Discover/Gov API
live

Gov APIenquiry.indianrail.gov.in

Access Indian Railways train schedules, station lists, and trains between stations via 5 endpoints covering the enquiry.indianrail.gov.in portal.

Endpoint health
verified 9h ago
get_trains
get_stations
get_captcha
3/3 passing latest checkself-healing
Endpoints
5
Updated
21d ago

What is the Gov API?

The Indian Railways Enquiry API provides 5 endpoints covering train listings, station lookups, and schedule data from enquiry.indianrail.gov.in. The get_trains_between_stations endpoint returns departure/arrival times and class availability for a given source station code, destination station code, and travel date. Reference lists for all trains and all stations are available without any captcha requirement.

Try it

No input parameters required.

api.parse.bot/scraper/ca465a89-6791-41cd-aead-47677fe7a343/<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/ca465a89-6791-41cd-aead-47677fe7a343/get_trains' \
  -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 enquiry-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.

from parse_apis.indian_rail_enquiry_api import IndianRail, Train, Station, Captcha, TrainSchedule, ScheduleStop, TrainBetweenStations, CaptchaNotMatched

indian_rail = IndianRail()

# List all available trains
for train in indian_rail.trains.list(limit=5):
    print(train.number, train.name)

# List all stations
for station in indian_rail.stations.list(limit=5):
    print(station.name, station.code)

# Fetch a captcha image for session initialization
captcha = indian_rail.captchas.fetch()
print(captcha.captcha_image, captcha.content_type)

# Get train schedule using a constructed Train instance
train = indian_rail.train("12002")
try:
    schedule = train.schedule(captcha="solved_answer")
    print(schedule.train_name, schedule.train_number)
    for stop in schedule.station_list:
        print(stop.station_name, stop.arrival_time, stop.departure_time, stop.halt_time, stop.distance)
except CaptchaNotMatched:
    print("Captcha answer was incorrect, fetch a new captcha and retry")

# Search trains between two stations
for result in indian_rail.trainbetweenstationses.search(source="NDLS", dest="BBA", date="15-06-2026", captcha="solved_answer"):
    print(result.train_number, result.train_name, result.departure_time, result.arrival_time)
All endpoints · 5 totalmissing one? ·

Returns the complete list of trains available on Indian Railways with their numbers and names. No parameters required. The response contains thousands of trains in 'NUMBER - NAME' format.

Input

No input parameters required.

Response
{
  "type": "object",
  "fields": {
    "trains": "array of strings, each in format 'TRAIN_NUMBER - TRAIN_NAME'"
  },
  "sample": {
    "data": {
      "trains": [
        "20822 - PUNE HUMSAFAR",
        "22647 - KRBA TVCN SF EXP",
        "19209 - BVC OKHA EXP"
      ]
    },
    "status": "success"
  }
}

About the Gov API

What the API Covers

Five endpoints expose the core data from the Indian Railways enquiry portal. get_trains returns a flat array of strings in TRAIN_NUMBER - TRAIN_NAME format, covering every train in the national network. get_stations returns an equivalent list in STATION_NAME - STATION_CODE format — these station codes are the values you pass as source and dest in downstream queries.

Captcha-Gated Endpoints

Two endpoints — get_train_schedule and get_trains_between_stations — require a solved captcha before they will return data. The flow is: call get_captcha first; it returns a captchaImage field containing a base64-encoded PNG and a contentType field. Decode the image, solve it, and pass the answer as the captcha parameter alongside the session_id and encryption_key values to whichever search endpoint you need.

Schedule and Search Responses

get_train_schedule accepts a train_no (e.g. '12002') and returns trainName, trainNumber, and a stationList array. Each element of stationList carries stationName, arrivalTime, departureTime, haltTime, and cumulative distance. get_trains_between_stations accepts source, dest, and date (in dd-mm-yyyy format) and returns a trainBtwnStnsList array where each object includes trainNumber, trainName, departureTime, arrivalTime, and available class information for that service on that date.

Session Handling

The captcha step initialises a session. The session_id and encryption_key returned from that flow must be forwarded with schedule and between-stations queries. Each captcha is tied to one session, so a new get_captcha call is required for each independent search session.

Reliability & maintenanceVerified

The Gov API is a managed, monitored endpoint for enquiry.indianrail.gov.in — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when enquiry.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 enquiry.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
9h ago
Latest check
3/3 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 route planner that resolves station names to codes via get_stations and then queries get_trains_between_stations for available services.
  • Generate a timetable display for a specific train using the stationList from get_train_schedule, showing halt durations and cumulative distance.
  • Populate autocomplete fields in a booking UI using the full train and station lists from get_trains and get_stations.
  • Check class availability on a given travel date between two stations using the class information in trainBtwnStnsList.
  • Aggregate departure and arrival times across multiple trains on a corridor to find the fastest or most convenient services.
  • Validate that a station code exists before submitting it to a schedule query, by cross-referencing the get_stations list.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min

One credit = one API call regardless of which marketplace API you call. 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?+
Indian Railways does not publish a documented public developer API for the enquiry.indianrail.gov.in portal. Rail data is available through the enquiry site itself, which this API surfaces.
What does `get_trains_between_stations` return beyond just train names?+
Each object in the trainBtwnStnsList array includes trainNumber, trainName, departureTime, arrivalTime, and available class information for the queried date. The response is scoped to the specific source-dest pair and date you supply, so you need a separate call per route-date combination.
Why do I need to call `get_captcha` before schedule searches?+
The get_train_schedule and get_trains_between_stations endpoints require a session initialised by a prior get_captcha call. get_captcha returns a base64 PNG (captchaImage) that must be solved; the answer, along with session_id and encryption_key, is then passed to the search endpoint. get_trains and get_stations do not require this step.
Does the API return live running status or platform numbers for trains?+
Not currently. The API covers static schedule data (stop-by-stop arrival/departure times, halt, distance) and between-stations availability for a given date. Live running status, platform assignments, and PNR status are not exposed. You can fork the API on Parse and revise it to add those missing endpoints.
Are trains from all Indian Railways zones included in `get_trains`?+
The get_trains endpoint returns all trains listed in the enquiry.indianrail.gov.in database, which covers the national network. However, very recently added or withdrawn trains may not immediately reflect in the list, as the data reflects the current state of the portal's records.
Page content last updated . Spec covers 5 endpoints from enquiry.indianrail.gov.in.
Related APIs in TravelSee all →
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.
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.
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.
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.
trenitalia.com API
Search for trains across Italy, check real-time train status and delays, view station departure and arrival boards, and find available tickets all in one place. Get live traffic information and detailed train itineraries to plan your journey with complete visibility into schedules and service disruptions.
redbus.in API
Search and explore bus and train services on redBus.in. Look up city and station suggestions, find available routes, check schedules, and view seat layouts and fare details.
bahn.com API
Search German train schedules and stations, find connections between destinations, and compare ticket prices across Deutsche Bahn routes. Get real-time station information and transit association details to plan your train journey efficiently.
trainline.eu API
Search for train stations and routes across the UK and Europe, then find and compare available journeys with schedules and pricing. Book your ideal train trip by accessing real-time travel options directly from Trainline.com.