enquiry.indianrail.gov.in 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.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/ca465a89-6791-41cd-aead-47677fe7a343/get_trains' \ -H 'X-API-Key: $PARSE_API_KEY'
Get list of all available trains with their numbers and names from Indian Railways.
No input parameters required.
{
"type": "object",
"fields": {
"trains": "array of strings, each in format 'TRAIN_NUMBER - TRAIN_NAME'"
},
"sample": {
"data": {
"trains": [
"17289 - CCT MYS EXPRESS",
"22637 - WEST COAST SFEXP",
"22638 - WESTCOAST SF EXP"
]
},
"status": "success"
}
}About the enquiry.indianrail.gov.in 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.
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.
- Build a train route planner that resolves station names to codes via
get_stationsand then queriesget_trains_between_stationsfor available services. - Generate a timetable display for a specific train using the
stationListfromget_train_schedule, showing halt durations and cumulative distance. - Populate autocomplete fields in a booking UI using the full train and station lists from
get_trainsandget_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_stationslist.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 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.
Does Indian Railways have an official developer API?+
What does `get_trains_between_stations` return beyond just train names?+
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?+
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?+
Are trains from all Indian Railways zones included in `get_trains`?+
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.