RailYatri APIrailyatri.in ↗
Access live train status, PNR lookup, seat availability, timetables, and trains between stations from RailYatri via a single JSON API.
What is the RailYatri API?
The RailYatri API exposes 8 endpoints covering live train positions, static timetables, PNR status checks, seat availability with fare breakdowns, and station-to-station train searches. The get_live_train_status endpoint returns real-time delay, current station, platform, and the full route with coordinates and food data. Autocomplete helpers for both trains and stations let you resolve codes before calling any of the data 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
Train Discovery and Lookup
Start with search_train_autocomplete (accepts a partial train number or name) to get a train_number and train_name. Pair it with search_station_autocomplete to resolve station_code, city, and lat/lng coordinates for any partial station name or code. Both endpoints return arrays you can use immediately as inputs to the data endpoints.
Schedules, Live Status, and Fares
get_train_timetable returns the static schedule for a given train_number: every stop with arrival, departure, halt, day (day number from source), distance, and platform. The days_of_run array tells you which days of the week the train operates.
get_live_train_status adds a real-time layer: train_info includes current_station, delay, status, last_updated, platform, and whether today is a run day (is_run_day). The full_route array adds food_data and coordinates per stop. When a train is not currently running, stations will be empty and train_info.status will say so explicitly.
get_train_fare returns a fares array broken down by class_code and quota, with ticket_fare, catering_charge, total_fare, current availability, and confirmation probability (cp_perc). It also returns distance in km and duration for the segment.
Availability and Booking Lookups
get_seat_availability checks seat availability for a specific train, class, quota, and date range. Each item in the availability array includes availablity_status, ticket_fare, total_fare, seat_avl_text, and cp_perc (confirmation probability percentage). search_trains_between_stations lists all trains on a route for a given date, including departure, arrival, duration, available classes, pantry flag, and run_days. get_pnr_status accepts a 10-digit PNR and returns a status boolean indicating whether the record was found.
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 real-time delay and platform information for a train on a departure board app using
get_live_train_status. - Build a route planner that lists all trains between two stations on a chosen date with fares and class availability.
- Let users check whether their PNR is still active before traveling using
get_pnr_status. - Show a full stop-by-stop timetable with halt durations and platform numbers from
get_train_timetable. - Render a seat availability calendar for a specific train and class using the multi-date
availabilityarray fromget_seat_availability. - Offer a train-name autocomplete widget backed by
search_train_autocompleteto reduce input errors. - Compare fares across all travel classes on a given segment using the
faresarray fromget_train_fare.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 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.
Does RailYatri have an official developer API?+
What does `get_live_train_status` return when the train is not running today?+
train_info.is_run_day will reflect that, train_info.status will include a descriptive message, and the stations array will be empty. The full_route array with static stop data and coordinates is still returned.What confirmation probability data is available for seat availability?+
get_seat_availability and get_train_fare return a cp_perc field per date or class entry, representing the estimated probability that a waitlisted ticket will be confirmed. Neither endpoint exposes coach-level seat maps or berth-by-berth allocation.Does the API cover historical train running data or past PNR records?+
Can I look up trains for a past date using `search_trains_between_stations`?+
date parameter must be a future date. Past dates will not return valid results. If you need timetable data without a date constraint, use get_train_timetable with a train_number instead. You can fork this API on Parse and revise it to handle date validation or fallback logic.