# Railyatri — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/railyatri/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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.beta.paywithlocus.com/api/wrapped/credits/railyatri/get-live-train-status \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/get-pnr-status \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/get-seat-availability \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/get-train-fare \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/get-train-timetable \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/search-station-autocomplete \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/search-train-autocomplete \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/railyatri/search-trains-between-stations \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"date":"<string>","from_code":"<string>","to_code":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.