# Railyatri — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search trains between stations and get real-time information including live train status, timetables, seat availability, and PNR confirmation details. Find the perfect journey by autocompleting station and train names while checking current availability and train schedules.

**Category:** Travel | **Website:** [railyatri.in/](https://railyatri.in/) | **Docs:** [parse.bot/marketplace/88d9ba3f-bef0-4066-92b7-decd50eaff4b/railyatri-in-api](https://parse.bot/marketplace/88d9ba3f-bef0-4066-92b7-decd50eaff4b/railyatri-in-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_live_train_status

Retrieve the live running status of a train including current position, delay, platform, and upcoming stations. Also returns the full route with all intermediate stops. When the train is not currently running, train_info.status will indicate that and stations will be empty, but full_route is still populated.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `train_number` | string | Yes | 5-digit train number (from search_train_autocomplete) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/get_live_train_status \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"train_number":"<string>"}'
```

### get_pnr_status

Check the status of a PNR (Passenger Name Record) number. Returns booking status information when the PNR is valid and found in the system. A status of false indicates the PNR was not found or is expired.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `pnr_number` | string | Yes | 10-digit PNR number |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/get_pnr_status \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pnr_number":"<string>"}'
```

### get_seat_availability

Check seat availability and fares for a train between two stations. Returns availability for multiple upcoming dates with fare details, waitlist position, and confirmation probability. Requires a valid train_number that stops at both from_code and to_code.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `class_type` | string | No | Travel class code |
| `date` | string | No | Travel date in YYYY-MM-DD format. Defaults to today (IST) if not provided. |
| `from_code` | string | Yes | Source station code (from search_station_autocomplete) |
| `quota` | string | No | Booking quota code |
| `to_code` | string | Yes | Destination station code (from search_station_autocomplete) |
| `train_number` | string | Yes | 5-digit train number (from search_train_autocomplete) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/get_seat_availability \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"class_type":"<string>","date":"<string>","from_code":"<string>","quota":"<string>","to_code":"<string>","train_number":"<string>"}'
```

### get_train_fare

Retrieve ticket fares for all available travel classes on a specific train between two stations. Returns fare breakdown per class including ticket fare, catering charges, total fare, current availability status, and confirmation probability. The train must run between the specified stations. Results reflect the fare and availability for a specific travel date.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `date` | string | No | Travel date in YYYY-MM-DD format. Defaults to 7 days from today if not provided. |
| `from_code` | string | Yes | Source station code (from search_station_autocomplete) |
| `quota` | string | No | Booking quota code |
| `to_code` | string | Yes | Destination station code (from search_station_autocomplete) |
| `train_number` | string | Yes | 5-digit train number (from search_train_autocomplete) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/get_train_fare \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date":"<string>","from_code":"<string>","quota":"<string>","to_code":"<string>","train_number":"<string>"}'
```

### get_train_timetable

Retrieve the static timetable/schedule for a train including all stops with arrival/departure times, halt duration, day number, distance from source, and platform. Also returns the train's days of operation.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `train_number` | string | Yes | 5-digit train number (from search_train_autocomplete) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/get_train_timetable \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"train_number":"<string>"}'
```

### search_station_autocomplete

Search for stations by partial code or name. Returns matching stations with their code, name, city, and coordinates. Use to resolve station codes for search_trains_between_stations or get_seat_availability.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Partial station code or name to search for |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/search_station_autocomplete \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

### search_train_autocomplete

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.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Partial train number or name to search for |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/search_train_autocomplete \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

### search_trains_between_stations

Search for trains running between two stations on a specific date. Returns all available trains with departure/arrival times, duration, available classes, run days, distance, and pantry availability. The date must be in the future.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `date` | string | Yes | Travel date in YYYY-MM-DD format (must be a future date) |
| `from_code` | string | Yes | Source station code (from search_station_autocomplete) |
| `to_code` | string | Yes | Destination station code (from search_station_autocomplete) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-railyatri-in-api-88d9ba3f/search_trains_between_stations \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"date":"<string>","from_code":"<string>","to_code":"<string>"}'
```
