RailYatri APIrailyatri.in ↗
Access live train status, PNR checks, seat availability, timetables, and trains between stations from RailYatri via a single REST API.
What is the RailYatri 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.
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'
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 railyatri-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.
"""
RailYatri API – search trains, check live status, timetables, and seat availability.
"""
from parse_apis.railyatri_api import RailYatri, TravelClass, Quota, TrainSummary, RouteStop
railyatri = RailYatri()
# Search for stations by name
for station in railyatri.stations.search(query="mumbai"):
print(station.station_name, station.station_code, station.city)
# Search for trains between two stations on a given date
for train_summary in railyatri.trains.between_stations(from_code="NDLS", to_code="HWH", date="2026-06-20"):
print(train_summary.train_name, train_summary.departure, train_summary.arrival, train_summary.duration)
print(train_summary.classes, train_summary.run_days)
# Navigate from summary to full Train detail (C9 nav-op)
full_train = train_summary.details()
print(full_train.train_number, full_train.train_name)
break
# Get a specific train by number and check its timetable
train = railyatri.trains.get(train_number="12301")
timetable = train.timetable()
print(timetable.train_name, timetable.source, timetable.destination)
for stop in timetable.stations:
print(stop.station_name, stop.station_code, stop.arrival, stop.departure)
# Check live running status
status = train.live_status()
print(status.train_info.number, status.train_info.name, status.train_info.message)
for route_stop in status.full_route:
print(route_stop.station_name, route_stop.station_code, route_stop.distance_from_source)
# Check seat availability with typed enums
avail = train.seat_availability(
from_code="HWH",
to_code="NDLS",
class_type=TravelClass.THIRD_AC,
quota=Quota.GENERAL,
)
for entry in avail.availability:
print(entry.availablity_date, entry.seat_avl_text, entry.ticket_fare, entry.total_fare)
# Check PNR status
pnr = railyatri.pnrstatuses.check(pnr_number="1234567890")
print(pnr.status)
Search for trains by partial number or name. Returns matching trains with their number and full name. Useful for resolving a train_number before calling get_live_train_status, get_train_timetable, or get_seat_availability.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | Partial train number or name to search for |
{
"type": "object",
"fields": {
"trains": "array of objects each containing 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 API
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.
The RailYatri API is a managed, monitored endpoint for railyatri.in — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when railyatri.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 railyatri.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.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- 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 | 100 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.