# Enquiry Indianrail — 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 for trains between Indian stations, check schedules, and look up station details to plan your rail journeys. Get real-time train information with support for captcha-protected searches to ensure reliable access to Indian Railways data.

**Category:** Travel | **Website:** [enquiry.indianrail.gov.in/](https://enquiry.indianrail.gov.in/) | **Docs:** [parse.bot/marketplace/0928a3f2-c5aa-4f02-9884-1f80548f3b89/enquiry-indianrail-gov-in-api](https://parse.bot/marketplace/0928a3f2-c5aa-4f02-9884-1f80548f3b89/enquiry-indianrail-gov-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-enquiry-indianrail-gov-in-api-0928a3f2/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_captcha

Fetches a captcha image for verification. Must be called before get_train_schedule or get_trains_between_stations to initialize the session. Returns a base64-encoded PNG image that the user must solve and pass as the captcha parameter to the dependent endpoint.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-enquiry-indianrail-gov-in-api-0928a3f2/get_captcha \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_stations

Returns the complete list of railway stations on Indian Railways with their names and codes. No parameters required. The response contains thousands of stations in 'STATION_NAME - STATION_CODE' format.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-enquiry-indianrail-gov-in-api-0928a3f2/get_stations \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_train_schedule

Returns the full schedule (list of stops with arrival/departure times, halt duration, and distance) for a specific train. Requires a valid solved captcha from a prior get_captcha call in the same session. If the captcha answer is incorrect, returns a stale_input error with message 'Captcha not matched'.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `captcha` | string | Yes | Solved captcha answer from the captcha image returned by get_captcha. |
| `encryption_key` | string | Yes | Encryption key from login response |
| `session_id` | string | Yes | Session ID from login response |
| `train_no` | string | Yes | Train number (e.g. '12002', '19022'). Obtainable from get_trains endpoint. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-enquiry-indianrail-gov-in-api-0928a3f2/get_train_schedule \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"captcha":"<string>","encryption_key":"<string>","session_id":"<string>","train_no":"<string>"}'
```

### get_trains

Returns the complete list of trains available on Indian Railways with their numbers and names. No parameters required. The response contains thousands of trains in 'NUMBER - NAME' format.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-enquiry-indianrail-gov-in-api-0928a3f2/get_trains \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_trains_between_stations

Search for trains running between two stations on a specific date. Returns a list of available trains with departure/arrival times and class availability. Requires a valid solved captcha from a prior get_captcha call in the same session. If the captcha answer is incorrect, returns a stale_input error with message 'Captcha not matched'.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `captcha` | string | Yes | Solved captcha answer from the captcha image returned by get_captcha. |
| `date` | string | Yes | Travel date in dd-mm-yyyy format (e.g. '15-06-2026'). |
| `dest` | string | Yes | Destination station code (e.g. 'BBA' for Babrala, 'NDLS' for New Delhi). Obtainable from get_stations endpoint. |
| `encryption_key` | string | Yes | Encryption key from login response |
| `session_id` | string | Yes | Session ID from login response |
| `source` | string | Yes | Source station code (e.g. 'NDLS' for New Delhi, 'BBA' for Babrala). Obtainable from get_stations endpoint. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-enquiry-indianrail-gov-in-api-0928a3f2/get_trains_between_stations \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"captcha":"<string>","date":"<string>","dest":"<string>","encryption_key":"<string>","session_id":"<string>","source":"<string>"}'
```
