# Indian Railways train schedule API

Get Indian Railways schedules by five-digit train number via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as number, output, raw, and retrieve structured data including source train number, source timetable validity start, and source timetable validity end for timetable, and service details.

Documentation: https://openany.si/indian-railways/indian-railways-train-schedule-api/0a4aa8c0-189e-4789-8faa-17f7512b08cd/
API ID: 0a4aa8c0-189e-4789-8faa-17f7512b08cd
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/indian-rail/v1/train
Page update time: 2026-12-03T02:46:56.517Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:46:54.557Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Usage and limits
## Indian Railways Train Schedule API

Set number to the source train-number string. Stops retain day offsets, arrival or departure labels and distance\_km; run days, timetable validity and fare availability are separate source structures.

## What You Can Build

- **Timetable**: Preserve stop day and source validity context.
- **Service details**: Keep amenities, classes and fare availability distinct.

## Returned Data

| Field | Meaning |
| --- | --- |
| `number` | Source train number |
| `run_days_at_source` | Run days at the originating station |
| `valid_from` | Source timetable validity start |
| `valid_to` | Source timetable validity end |
| `stops[].day` | Stop day within the run |
| `stops[].distance_km` | Source route distance in kilometres |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Indian Railways train schedule API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "number": {
          "type": "string",
          "description": "5-digit train number."
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      },
      "required": [
        "number"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "avg_speed_kmh": {
      "type": "integer"
    },
    "cached": {
      "type": "boolean"
    },
    "category": {
      "type": "string"
    },
    "classes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "coaches": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "class": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "coach": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "type": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          }
        }
      }
    },
    "credits_used": {
      "type": "integer"
    },
    "destination": {
      "type": "object",
      "properties": {
        "arrival": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "distance_km": {
      "type": "integer"
    },
    "duration": {
      "type": "string"
    },
    "duration_min": {
      "type": "integer"
    },
    "fares": {
      "type": "object",
      "properties": {
        "1A": {
          "type": "object",
          "properties": {
            "adult": {
              "type": "integer"
            },
            "child": {
              "type": "null"
            },
            "tatkal": {
              "type": "null"
            }
          }
        },
        "2A": {
          "type": "object",
          "properties": {
            "adult": {
              "type": "integer"
            },
            "child": {
              "type": "integer"
            },
            "tatkal": {
              "type": "null"
            }
          }
        },
        "3A": {
          "type": "object",
          "properties": {
            "adult": {
              "type": "integer"
            },
            "child": {
              "type": "integer"
            },
            "tatkal": {
              "type": "null"
            }
          }
        }
      }
    },
    "fetched_at": {
      "type": "string"
    },
    "food_in_fare": {
      "type": "boolean"
    },
    "full_name": {
      "type": "string"
    },
    "gauge": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "note": {
      "type": "null"
    },
    "number": {
      "type": "string"
    },
    "pantry": {
      "type": "boolean"
    },
    "premium_tatkal": {
      "type": "boolean"
    },
    "rake_shared_with": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "run_days": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "run_days_at_source": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "source": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "departure": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "special": {
      "type": "boolean"
    },
    "stop_count": {
      "type": "integer"
    },
    "stops": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "arrival": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "code": {
            "type": "string"
          },
          "day": {
            "type": "integer"
          },
          "departure": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "distance_km": {
            "type": "integer"
          },
          "division": {
            "type": "string"
          },
          "halt_min": {
            "type": "integer"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "quota": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "remark": {
            "type": "null"
          },
          "seq": {
            "type": "integer"
          },
          "zone": {
            "type": "string"
          }
        }
      }
    },
    "train_id": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "valid_from": {
      "type": "string"
    },
    "valid_to": {
      "type": "string"
    },
    "zone": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/indian-rail/v1/train?number=12951&output=json&raw=0' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "avg_speed_kmh": 89,
  "cached": false,
  "category": "Rajdhani",
  "classes": [
    "1A",
    "2A",
    "3A"
  ],
  "coaches": [
    {
      "class": null,
      "coach": "ENG",
      "position": 1,
      "type": null
    },
    {
      "class": "LPR",
      "coach": "LPR",
      "position": 2,
      "type": "LPR"
    },
    {
      "class": "3A",
      "coach": "BE1",
      "position": 3,
      "type": "BE"
    },
    {
      "class": "3A",
      "coach": "B1",
      "position": 4,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B2",
      "position": 5,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B3",
      "position": 6,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B4",
      "position": 7,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B5",
      "position": 8,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B6",
      "position": 9,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B7",
      "position": 10,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B8",
      "position": 11,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B9",
      "position": 12,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B10",
      "position": 13,
      "type": "B"
    },
    {
      "class": "3A",
      "coach": "B11",
      "position": 14,
      "type": "B"
    },
    {
      "class": "PC",
      "coach": "PC",
      "position": 15,
      "type": "PC"
    },
    {
      "class": "1A",
      "coach": "H1",
      "position": 16,
      "type": "H"
    },
    {
      "class": "2A",
      "coach": "A1",
      "position": 17,
      "type": "A"
    },
    {
      "class": "2A",
      "coach": "A2",
      "position": 18,
      "type": "A"
    },
    {
      "class": "2A",
      "coach": "A3",
      "position": 19,
      "type": "A"
    },
    {
      "class": "2A",
      "coach": "A4",
      "position": 20,
      "type": "A"
    },
    {
      "class": "2A",
      "coach": "A5",
      "position": 21,
      "type": "A"
    },
    {
      "class": "LPR",
      "coach": "LPR",
      "position": 22,
      "type": "LPR"
    },
    {
      "class": "VP",
      "coach": "VP",
      "position": 23,
      "type": "VP"
    }
  ],
  "credits_used": 1,
  "destination": {
    "arrival": "08:32",
    "code": "NDLS",
    "name": "New Delhi"
  },
  "distance_km": 1384,
  "duration": "15:32",
  "duration_min": 932,
  "fares": {
    "1A": {
      "adult": 5335,
      "child": null,
      "tatkal": null
    },
    "2A": {
      "adult": 3235,
      "child": 1820,
      "tatkal": null
    },
    "3A": {
      "adult": 2405,
      "child": 1405,
      "tatkal": null
    }
  },
  "fetched_at": "2026-11-19T12:25:15.482Z",
  "food_in_fare": true,
  "full_name": "Mumbai Central New Delhi MUMBAI RAJDHANI",
  "gauge": "BG",
  "name": "NDLS TEJAS RAJ",
  "note": null,
  "number": "12951",
  "pantry": true,
  "premium_tatkal": false,
  "rake_shared_with": [
    "12952",
    "12953",
    "12954"
  ],
  "run_days": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "run_days_at_source": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "source": {
    "code": "MMCT",
    "departure": "17:00",
    "name": "Mumbai Central"
  },
  "special": false,
  "stop_count": 8,
  "stops": [
    {
      "arrival": null,
      "code": "MMCT",
      "day": 1,
      "departure": "17:00",
      "distance_km": 0,
      "division": "BCT",
      "halt_min": 0,
      "lat": 18.9707165064074,
      "lng": 72.8192871809006,
      "name": "Mumbai Central",
      "platform": "3",
      "quota": "PQ",
      "remark": null,
      "seq": 1,
      "zone": "WR"
    },
    {
      "arrival": "17:20",
      "code": "BVI",
      "day": 1,
      "departure": "17:22",
      "distance_km": 30,
      "division": "BCT",
      "halt_min": 2,
      "lat": 19.2293923720121,
      "lng": 72.8569051623344,
      "name": "Borivali",
      "platform": "6",
      "quota": null,
      "remark": null,
      "seq": 2,
      "zone": "WR"
    },
    {
      "arrival": "19:43",
      "code": "ST",
      "day": 1,
      "departure": "19:48",
      "distance_km": 263,
      "division": "BCT",
      "halt_min": 5,
      "lat": 21.2048831301752,
      "lng": 72.8409326076508,
      "name": "Surat",
      "platform": "1",
      "quota": "RL",
      "remark": null,
      "seq": 3,
      "zone": "WR"
    },
    {
      "arrival": "21:06",
      "code": "BRC",
      "day": 1,
      "departure": "21:16",
      "distance_km": 392,
      "division": "BRC",
      "halt_min": 10,
      "lat": 22.3106665548763,
      "lng": 73.1803286075592,
      "name": "Vadodara Jn",
      "platform": "2",
      "quota": "RL",
      "remark": null,
      "seq": 4,
      "zone": "WR"
    },
    {
      "arrival": "00:25",
      "code": "RTM",
      "day": 2,
      "departure": "00:28",
      "distance_km": 653,
      "division": "RTM",
      "halt_min": 3,
      "lat": 23.3403925393936,
      "lng": 75.0501381011963,
      "name": "Ratlam Jn",
      "platform": "5",
      "quota": "RL",
      "remark": null,
      "seq": 5,
      "zone": "WR"
    },
    {
      "arrival": "01:08",
      "code": "NAD",
      "day": 2,
      "departure": "01:10",
      "distance_km": 695,
      "division": "RTM",
      "halt_min": 2,
      "lat": 23.4560419890135,
      "lng": 75.4127311706543,
      "name": "Nagda Jn",
      "platform": "1",
      "quota": "RL",
      "remark": null,
      "seq": 6,
      "zone": "WR"
    },
    {
      "arrival": "03:15",
      "code": "KOTA",
      "day": 2,
      "departure": "03:20",
      "distance_km": 920,
      "division": "KOTA",
      "halt_min": 5,
      "lat": 25.2237331266396,
      "lng": 75.8811950683594,
      "name": "Kota Jn",
      "platform": "1",
      "quota": "RL",
      "remark": null,
      "seq": 7,
      "zone": "WCR"
    },
    {
      "arrival": "08:32",
      "code": "NDLS",
      "day": 2,
      "departure": null,
      "distance_km": 1384,
      "division": "DLI",
      "halt_min": 0,
      "lat": 28.6429164488347,
      "lng": 77.2196066379548,
      "name": "New Delhi",
      "platform": "3",
      "quota": null,
      "remark": null,
      "seq": 8,
      "zone": "NR"
    }
  ],
  "train_id": "2633",
  "type": "RAJDHANI",
  "valid_from": "2026-11-19",
  "valid_to": "2031-11-20",
  "zone": "WR"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### Should the train number remain a string?
Keep the source five-digit form and any leading zeros.

### Are stop times all on the departure date?
No. Retain each stop's day and the time labels for multi-day services.

### Does pantry mean food is included?
No. pantry and food_in_fare describe separate source attributes.

### Does this schedule confirm live running or seat inventory?
No. Use Live Train Status for source operational observations; timetable and fare fields do not create a reservation.

### How do I bypass cached results?
Pass fresh=1. A cache bypass retrieves available source data; it does not make unpublished or restricted records available.

### Can I request CSV or NDJSON?
This OpenAny implementation serves JSON only. Omit output or set output=json.

## Available implementations
- apish: https://openany.si/indian-railways/indian-railways-train-schedule-api/0a4aa8c0-189e-4789-8faa-17f7512b08cd/

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
