railyatri.in APIrailyatri.in ↗
Access live train status, PNR checks, seat availability, timetables, and trains between stations from RailYatri via a single REST API.
curl -X GET 'https://api.parse.bot/scraper/3dba3431-db8a-42f9-b36f-788630e9c873/search_train_autocomplete?query=rajdhani' \ -H 'X-API-Key: $PARSE_API_KEY'
Search for trains by number or name for autocomplete suggestions. Returns a list of matching trains with their numbers and names.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | Partial train number or name to search for |
{
"type": "object",
"fields": {
"trains": "array of objects with train_number and train_name"
},
"sample": {
"data": {
"trains": [
{
"train_name": "HOWRAH - NEW DELHI Rajdhani Express",
"train_number": "12301"
},
{
"train_name": "NEW DELHI - HOWRAH Rajdhani Express",
"train_number": "12302"
}
]
},
"status": "success"
}
}About the railyatri.in API
The RailYatri API exposes 7 endpoints covering Indian Railways data including live train tracking, static timetables, PNR lookups, seat availability with fare breakdowns, and station-to-station train searches. The get_live_train_status endpoint returns real-time position, delay, and per-station arrival and departure data for any active train. Autocomplete endpoints for both trains and stations make it straightforward to resolve names to the codes and numbers required by other endpoints.
Core Endpoints and Data
The API centers on two real-time lookups and two static ones. get_live_train_status accepts a 5-digit train_number and returns a train_info object with current_station, delay, and is_run_day, plus an stations array of upcoming stops with per-station arrival/departure times and delay figures, and a full_route covering every stop on the route. get_train_timetable returns the static schedule for the same train: each station in the stations array carries arrival, departure, halt, day, distance, and platform, along with top-level days_of_run indicating which days the service operates.
Availability and PNR
get_seat_availability takes a train_number, from_code, to_code, and optionally date, quota (e.g. GN, TQ), and class_type (1A, 2A, 3A, SL, CC, 2S). It returns an availability array with one object per upcoming date, each containing availablity_status, ticket_fare, total_fare, and seat_avl_text for the chosen class and quota. A last_updated timestamp indicates data freshness. get_pnr_status accepts a 10-digit pnr_number and returns a status boolean indicating whether PNR data was located.
Search and Autocomplete
search_trains_between_stations takes from_code, to_code, and a date in YYYY-MM-DD format and returns a trains array with per-train departure, arrival, duration, run_days, train_type, and total_trains count. The two autocomplete endpoints — search_train_autocomplete and search_station_autocomplete — accept partial names or codes. The station endpoint is especially useful because it returns lat, lng, and city alongside station_code, which other endpoints require as input.
- Display live delay and current position for a train on a journey-tracking dashboard using
get_live_train_status. - Show seat availability and fares across Tatkal and General quota for a specific train and class before booking.
- Build a train-search interface for a given origin-destination pair and travel date using
search_trains_between_stations. - Provide a PNR status checker widget that confirms whether a booking record exists.
- Render a full station-by-station timetable including platform numbers and halt durations for a selected train.
- Power autocomplete inputs for both station and train name fields using station codes and coordinates from the search endpoints.
- Alert travelers when a train's
delayvalue fromget_live_train_statusexceeds a defined threshold.
| 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 RailYatri have an official public developer API?+
What does get_pnr_status actually return beyond a boolean?+
status boolean indicating whether PNR data was found — passenger names, coach/berth assignments, and booking-class details are not included in the response. You can fork this API on Parse and revise it to add those fields if they become available.Does the live train status endpoint work when a train is not running on a given day?+
train_info object includes an is_run_day field that indicates whether the train is scheduled to operate on the current date. When the train is not actively running, real-time position and delay data will not be populated, but static route data in full_route is still returned.Can I retrieve historical train running data or delays over past dates?+
get_live_train_status reflects current-day status and get_train_timetable returns static scheduled times. You can fork the API on Parse and revise it to add an endpoint if RailYatri exposes historical data on the source site.How do I get the station codes required by get_seat_availability and search_trains_between_stations?+
search_station_autocomplete accepts a partial station name or code in the query parameter and returns matching stations with their station_code values. Pass those codes as from_code and to_code in the availability and train-search endpoints.