Co APIirctc.co.inAPI ↗
Query Indian Railways train schedules, seat availability with fares, trains between stations, and station codes via a structured JSON API.
What is the Co API?
The IRCTC API exposes 4 endpoints covering Indian Railways public enquiry data: trains between two stations, seat availability with full fare breakdowns, stop-by-stop timetables, and a station code lookup. The get_availability endpoint returns per-day availability status and an itemized fare object including base fare, reservation charge, superfast charge, and dynamic fare components — all in INR.
curl -X GET 'https://api.parse.bot/scraper/4cb03185-74ea-4b58-9a5b-c0662c659aa0/search_trains?to_station=BCT&from_station=NDLS&journey_date=2026-09-17' \ -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 irctc-co-inapi-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.
"""Walkthrough: IRCTC Indian Railways API — search trains, check availability, view schedule."""
from parse_apis.irctc_co_inapi_api import Irctc, Quota, InputNotFound
client = Irctc()
# Find stations in Mumbai to resolve the correct station code.
station = client.stations.search("mumbai", limit=3).first()
if station is not None:
print(station.station_code, station.station_name, station.city)
# Search direct trains from Delhi to Mumbai on a given date.
for train in client.trains.search(from_station="NDLS", to_station="BCT", journey_date="2026-09-17", limit=5):
print(train.train_number, train.train_name, train.departure_time, "->", train.arrival_time, train.available_classes)
# Drill into the first train to check seat availability in its first offered class.
train = client.trains.search(from_station="NDLS", to_station="BCT", journey_date="2026-09-17", limit=1).first()
if train is not None:
try:
avail = train.check_availability(
travel_class=train.available_classes[0],
journey_date="2026-09-17",
quota=Quota.GENERAL,
)
print(avail.train_name, avail.travel_class, avail.fare.total_fare, avail.fare.currency)
for day in avail.days:
print(day.date, day.status, day.current_booking)
except InputNotFound as e:
print("availability not found:", e.message)
# View the full stop-by-stop schedule for the same train.
sched = train.schedule()
print(sched.train_name, sched.origin_station, "->", sched.destination_station)
if sched.stops is not None:
for stop in sched.stops[:3]:
print(stop.serial_number, stop.station_name, stop.arrival_time, stop.departure_time)
print("exercised: stations.search / trains.search / check_availability / schedule")
Lists direct trains running between two stations on a journey date, one row per train, with departure/arrival times, running days, distance and the classes offered. Station inputs accept any code in the IRCTC station master (search_stations gives codes for a city); the site groups city stations, so a search for NDLS to BCT also returns trains from H NIZAMUDDIN (NZM) or to BANDRA TERMINUS (BDTS), and each row carries its own from_station/to_station. Optional travel_class narrows the list to trains offering that class (applied after the site returns the full list; total_direct_trains keeps the unfiltered count). A pair with no direct trains returns an empty trains list. Dates in the past or beyond the advance reservation period are rejected with a validation error. All times are local Indian time (IST). One upstream request, no pagination.
| Param | Type | Description |
|---|---|---|
| to_stationrequired | string | Destination station code, 1-5 letters (station_code from search_stations), e.g. BCT. |
| from_stationrequired | string | Origin station code, 1-5 letters (station_code from search_stations), e.g. NDLS. |
| journey_date | string | Journey date, ISO YYYY-MM-DD (IST calendar). Omitted = today in India. |
| travel_class | string | Two-character class code to keep only trains offering it; values observed in available_classes include 1A, 2A, 3A, 3E, SL, 2S. Omitted = all trains. |
{
"type": "object",
"fields": {
"quotas": "array of quota codes the site offers for this search (usable as quota in get_availability)",
"trains": "array of train rows: train_number (5-digit string), train_name, from_station/to_station (actual boarding/alighting station codes), departure_time/arrival_time (HH:MM IST), duration (HH:MM), distance_km (integer), runs_on (array of Mon..Sun), available_classes (array of class codes), train_type (array of site type codes, e.g. R = Rajdhani, O = other), flexi_fare (boolean)",
"to_station": "destination station code as requested",
"from_station": "origin station code as requested",
"journey_date": "ISO date searched",
"travel_class": "class filter applied, or null",
"total_direct_trains": "integer count of direct trains the site returned before any class filter"
},
"sample": {
"data": {
"quotas": [
"SS",
"PT",
"GN",
"HP",
"LD",
"DP",
"TQ"
],
"trains": [
{
"runs_on": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun"
],
"duration": "15:40",
"flexi_fare": false,
"to_station": "MMCT",
"train_name": "MMCT TEJAS RAJ",
"train_type": [
"R"
],
"distance_km": 1384,
"arrival_time": "08:35",
"from_station": "NDLS",
"train_number": "12952",
"departure_time": "16:55",
"available_classes": [
"1A",
"2A",
"3A"
]
}
],
"to_station": "BCT",
"from_station": "NDLS",
"journey_date": "2026-09-17",
"travel_class": null,
"total_direct_trains": 14
},
"status": "success"
}
}About the Co API
Train Search and Availability
The search_trains endpoint accepts from_station and to_station codes plus an optional journey_date (ISO YYYY-MM-DD, IST) and an optional travel_class filter. It returns a list of direct trains with departure and arrival times, running days, distance, and the available_classes each train offers. It also returns the list of valid quota codes (e.g. general, tatkal, ladies) that can be passed to get_availability.
Once you have a train_number from search_trains, call get_availability with the same station pair, a travel_class, and a quota code. The response includes an availability array with one row per departure day (typically the queried date plus the next few days), each carrying a status string and a current_booking boolean. The fare object breaks the ticket cost into base_fare, reservation_charge, superfast_charge, dynamic_fare, tatkal_fare, catering_charge, and total_fare, all in INR.
Timetables and Station Lookup
get_train_schedule returns the complete halt sequence for any 5-digit train_number: each stop includes station_code, station_name, arrival_time and departure_time (HH:MM IST, null at origin or terminus), halt_time, cumulative distance_km, and a day counter for overnight trains. The response also surfaces runs_on (Mon–Sun running days), origin_station, and destination_station.
search_stations resolves plain-text city or station names to the station codes required by every other endpoint. A minimum 2-character query performs a case-insensitive substring match across codes, names, states, and aliases, returning up to 200 results with a total_matches count showing how many matched before the cap. An exact code match is ranked first.
The Co API is a managed, monitored endpoint for irctc.co.inAPI — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when irctc.co.inAPI 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 irctc.co.inAPI 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?+
- Build a train planner that checks seat availability and fares across multiple quotas before booking.
- Display real-time berth status for a specific train, class, and date using
get_availabilitystatus strings. - Render a full station-by-station route map from
get_train_schedulestops with cumulative distances. - Autocomplete station code fields in a booking form using
search_stationscity/name queries. - Compare total fares between general and tatkal quotas for the same train and class.
- Filter only trains offering a specific class (e.g. 1A or SL) on a route using
search_trainswithtravel_class. - Identify running days and overnight day offsets for multi-day train journeys from the
runs_onand stop day fields.
| 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 IRCTC offer an official developer API for train enquiry data?+
What does `get_availability` return beyond a simple available/not-available flag?+
availability array with one entry per departure day, each containing a status string (the site's exact availability label) and a current_booking boolean. It also returns a fare object with base_fare, reservation_charge, superfast_charge, dynamic_fare, tatkal_fare, catering_charge, and total_fare in INR, plus distance_km, train_name, and last_updated indicating data freshness.How many days of availability does `get_availability` return?+
availability array typically contains the queried date plus the next few departure days — observed as around 4 rows total. The exact count depends on what the source returns for that train and quota combination on a given query.Does the API cover PNR status or live train running status?+
Can I look up trains that require a connection or transfer, not just direct trains?+
search_trains returns only direct trains between the two given station codes. Multi-leg or connecting route planning is not covered. You can fork this API on Parse and revise it to add an endpoint that chains multiple search_trains calls for indirect routes.