Docs › Places and transport
Railway stations API
Indian Railways station codes to stations, and back.
About 4,000 stations with their code, state, railway zone and elevation, from Wikipedia's list of railway stations in India. No official open list exists; this one is kept by volunteers, so some codes are out of date and many entries lack a state or zone.
Station for a code
GET/v1/stations/{code}
| Parameter | Description |
|---|---|
codepath, required | Station code, such as MAS or NDLS. |
curl
curl "https://api.dharun.dev/v1/stations/MAS"JavaScript
const response = await fetch("https://api.dharun.dev/v1/stations/MAS");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/stations/MAS", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response
{
"data": {
"code": "MAS",
"name": "Puratchi Thalaivar Dr. M.G. Ramachandran Central Railway Station",
"stateCode": "TN",
"state": "Tamil Nadu",
"zone": {
"code": "SR",
"name": "Southern"
},
"elevationM": 3
},
"meta": {
"source": {
"name": "List of railway stations in India",
"url": "https://en.wikipedia.org/w/index.php?title=List_of_railway_stations_in_India&oldid=1371613797",
"licence": "CC BY-SA 4.0",
"version": "revision 1371613797",
"retrieved": "2026-10-13",
"attribution": "Station codes adapted from the Wikipedia article \"List of railway stations in India\", licensed CC BY-SA 4.0. This dataset is shared under the same licence."
},
"note": "From a community-kept list: a few codes are out of date (Mumbai CSMT is listed under its old code CSTM) and many stations lack a state or zone."
}
}Search stations
GET/v1/stations
By name (an exact code comes first, then names starting with the text), state or zone.
| Parameter | Description |
|---|---|
qquery | Part of a station name, or a code. |
statequery | State code or name, for example TN or Tamil Nadu. |
zonequery | Zone code, such as SR. See /v1/stations/zones. |
limitquery | Results per page, 1 to 100. |
offsetquery | Results to skip. |
curl
curl "https://api.dharun.dev/v1/stations?q=chennai"JavaScript
const response = await fetch("https://api.dharun.dev/v1/stations?q=chennai");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/stations?q=chennai", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response, with lists and long text shortened
{
"data": [
{
"code": "MSB",
"name": "Chennai Beach",
"stateCode": "TN",
"state": "Tamil Nadu",
"zone": null,
"elevationM": null
},
{
"code": "MS",
"name": "Chennai Egmore",
"stateCode": "TN",
"state": "Tamil Nadu",
"zone": null,
"elevationM": null
},
{
"code": "MSF",
"name": "Chennai Fort",
"stateCode": "TN",
"state": "Tamil Nadu",
"zone": null,
"elevationM": null
}
],
"meta": {
"total": 5,
"limit": 20,
"offset": 0,
"source": {
"name": "List of railway stations in India",
"url": "https://en.wikipedia.org/w/index.php?title=List_of_railway_stations_in_India&oldid=1371613797",
"licence": "CC BY-SA 4.0",
"version": "revision 1371613797",
"retrieved": "2026-10-13",
"attribution": "Station codes adapted from the Wikipedia article \"List of railway stations in India\", licensed CC BY-SA 4.0. This dataset is shared under the same licence."
},
"note": "From a community-kept list: a few codes are out of date (Mumbai CSMT is listed under its old code CSTM) and many stations lack a state or zone."
}
}Railway zones
GET/v1/stations/zones
curl
curl "https://api.dharun.dev/v1/stations/zones"JavaScript
const response = await fetch("https://api.dharun.dev/v1/stations/zones");
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
console.log(body.data);Python
import requests
response = requests.get("https://api.dharun.dev/v1/stations/zones", timeout=10)
body = response.json()
if not response.ok:
raise RuntimeError(body["error"]["message"])
print(body["data"])Response, with lists and long text shortened
{
"data": [
{
"code": "CR",
"name": "Central"
},
{
"code": "ER",
"name": "Eastern"
},
{
"code": "ECR",
"name": "East Central"
}
],
"meta": {
"total": 19
}
}Data source
List of railway stations in India, revision 1371613797. Retrieved 2026-10-13. Licence: CC BY-SA 4.0. Station codes adapted from the Wikipedia article "List of railway stations in India", licensed CC BY-SA 4.0. This dataset is shared under the same licence.
Using an AI assistant? Connect the MCP server and it can call this API by itself.