Delhi Metro API
Typed REST API for Delhi NCR metro passenger data — lines, stations, fares, routes, first/last trains, network maps, and notifications for DMRC and NMRC, plus a unified v2 journey planner.
Stable REST under /api/v1 and /api/v2, typed with Pydantic, with unified error envelopes for upstream failures. DMRC and NMRC share the same response schemas so clients can switch networks without a second contract.
Make your first request
No API key. Plan a journey, or list lines. Station codes work in either upstream vocabulary on the v2 planner.
# Plan a journey (v2 · Sarthi with DMRC fallback)
curl '/api/v2/journeys/plan?from_station_code=AIIMS&to_station_code=ASDM&strategy=least-distance'
# List Delhi Metro lines
curl /api/v1/dmrc/lines
Prefer a browser? Use the live playground, open a sample plan, or explore every route in the OpenAPI explorer.
Error envelope
Successful responses return the domain payload directly (no outer wrapper). Failures use one stable shape for both local validation and upstream problems.
{
"detail": "Upstream DMRC request failed.",
"upstream_status_code": 502
}
400 / 404 are caller-visible request errors (upstream_status_code is null). 502 means the upstream DMRC, Sarthi, or NMRC request failed.
API versions
/api/v1 wraps operator resources one-for-one (DMRC passenger API + NMRC public HTML). /api/v2 is the normalized journey planner: Sarthi first, legacy DMRC fallback, with automatic cross-network stitching at Sector 52/51.
{
"source": "sarthi",
"fallback_reason": null,
"strategy": "least-distance",
"from_station": {
"name": "AIIMS",
"code": "AIIMS",
"slug": "aiims",
"legacy_code": "AIIMS",
"sarthi_code": "AIIMS"
},
"to_station": {
"name": "Anand Vihar ISBT",
"code": "ASDM",
"slug": "anand-vihar-isbt",
"legacy_code": "ASDM",
"sarthi_code": "ASDM"
},
"total_time": "00:38:26",
"total_distance_km": 18.4,
"fare": {
"normal": 50.0,
"special": 40.0,
"applicable": 50.0,
"breakdown": []
},
"legs": [
{
"kind": "metro",
"network": "dmrc",
"line_name": "Yellow Line",
"line_color": "#FFD200",
"from_station": "AIIMS",
"to_station": "Rajiv Chowk",
"platform_name": "Platform 1",
"direction": "up",
"towards_station": "Samaypur Badli",
"duration": "00:10:00",
"distance_km": 4.2
}
],
"exclude_airport_line": false,
"separate_tickets": false,
"networks": [
"dmrc"
]
}
Health
Liveness probe for deploys and local development.
None.
None.
{
"status": "ok"
}DMRC endpoints (v1)
Delhi Metro lines, stations, journeys, notifications, and map assets. Click any route for parameters and sample payloads.
None.
None.
[
{
"id": 3,
"name": "Yellow Line",
"line_color": "Yellow",
"line_code": "LN3",
"primary_color_code": "#FFD200",
"secondary_color_code": null,
"class_primary": "yellow",
"class_secondary": null,
"start_station": "Samaypur Badli",
"end_station": "HUDA City Centre",
"show_in_frontend": true,
"status": "1"
}
]| Name | Type | Description | |
|---|---|---|---|
line_code | string | required | DMRC line code, e.g. LN3, LN10, LN11. |
None.
[
{
"id": 1,
"station_name": "Samaypur Badli",
"station_code": "SPB",
"station_facility": [],
"metro_lines": [],
"interchange": false,
"status": "1"
}
]None.
| Name | Type | Description | |
|---|---|---|---|
query | string | optional | Station name keyword. Empty returns the full station list. |
filter | string | optional | `all` (default), `least-distance`, or `minimum-interchange`. |
[
{
"id": 42,
"station_name": "Rajiv Chowk",
"station_code": "RC",
"station_facility": [],
"metro_lines": [
{
"line_id": 3,
"line_code": "LN3",
"line_name": "Yellow Line",
"line_color": "Yellow",
"primary_color_code": "#FFD200"
}
]
}
]| Name | Type | Description | |
|---|---|---|---|
station_code | string | required | DMRC station code, e.g. RG, AIIMS, ASDM. |
None.
{
"id": 12,
"station_name": "Rajouri Garden",
"station_code": "RG",
"station_status": "1",
"station_type": "Elevated",
"latitude": "28.649",
"longitude": "77.123",
"metro_lines": [],
"platforms": [],
"gates": [],
"station_facility": []
}None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin station code. |
to_station_code | string | required | Destination station code. |
strategy | string | optional | `least-distance` (default) or `minimum-interchange`. |
journey_time | datetime | optional | Optional ISO-8601 departure time for timed planning. |
{
"from_station": "AIIMS",
"to_station": "ASDM",
"total_time": "00:28:00",
"total_stations": 12,
"fare": {
"normal": 40,
"special": 30
},
"route": []
}None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin station code. |
to_station_code | string | required | Destination station code. |
journey_time | datetime | optional | Optional ISO-8601 departure. |
{
"from_station": "AIIMS",
"to_station": "ASDM",
"total_time": "00:28:00",
"total_stations": 12,
"fare": {
"normal": 40,
"special": 30
},
"route": []
}None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin station code. |
to_station_code | string | required | Destination station code. |
journey_time | datetime | optional | Optional ISO-8601 departure. |
{
"from_station": "AIIMS",
"to_station": "ASDM",
"total_time": "00:28:00",
"total_stations": 12,
"fare": {
"normal": 40,
"special": 30
},
"route": []
}None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin station code. |
to_station_code | string | required | Destination station code. |
strategy | string | optional | `least-distance` (default) or `minimum-interchange`. |
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin station code. |
to_station_code | string | required | Destination station code. |
journey_time | datetime | optional | Optional ISO-8601 departure. |
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
page_slug | string | required | Page slug from the notifications feed. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | `network`, `airport-express`, or `rapid-metro`. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | `network`, `airport-express`, or `rapid-metro`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any` (default). |
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | `network`, `airport-express`, or `rapid-metro`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any` (default). |
/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | `network`, `airport-express`, or `rapid-metro`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any` (default). |
/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.
| Name | Type | Description | |
|---|---|---|---|
asset_id | string | required | Asset id from `/maps/assets`. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
NMRC endpoints (v1)
Noida Metro Aqua Line, same path shapes and schemas as DMRC. Scraped from public NMRC pages with checked-in table fallbacks when HTML cannot be read.
None.
None.
[
{
"id": 1,
"name": "Aqua Line",
"line_color": "Aqua",
"line_code": "AQUA",
"primary_color_code": "#00A8E8",
"secondary_color_code": null,
"class_primary": "aqua",
"class_secondary": null,
"start_station": "Noida Sector 51",
"end_station": "Depot Station",
"show_in_frontend": true,
"status": "1"
}
]| Name | Type | Description | |
|---|---|---|---|
line_code | string | required | NMRC line code. Currently only `AQUA`. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
| Name | Type | Description | |
|---|---|---|---|
query | string | optional | Station name keyword. |
filter | string | optional | `all` (default), `least-distance`, or `minimum-interchange`. |
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
station_code | string | required | NMRC station code, e.g. NM01. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
None.
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | Currently only `network` is populated for NMRC. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | Map family, usually `network`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any`. PDF is empty for NMRC. |
See the OpenAPI schema for the exact response model, or try it in the playground.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | Map family, usually `network`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any`. |
/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.
| Name | Type | Description | |
|---|---|---|---|
family | string | required | Map family, usually `network`. |
| Name | Type | Description | |
|---|---|---|---|
format | string | optional | `image`, `pdf`, or `any`. |
/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.
| Name | Type | Description | |
|---|---|---|---|
asset_id | string | required | Asset id from `/nmrc/maps/assets`. |
None.
See the OpenAPI schema for the exact response model, or try it in the playground.
Journey planner (v2)
One normalized PlannedJourney regardless of upstream. Cross-network trips set source: "combined", include a walking transfer leg, and split fares in fare.breakdown.
None.
| Name | Type | Description | |
|---|---|---|---|
from_station_code | string | required | Origin code in either DMRC or NMRC vocabulary. |
to_station_code | string | required | Destination code in either DMRC or NMRC vocabulary. |
strategy | string | optional | `least-distance` (default) or `minimum-interchange`. |
journey_time | datetime | optional | ISO-8601 departure, Delhi local time. Affects applicable fare. |
exclude_airport_line | boolean | optional | Avoid Airport Express. Honoured by Sarthi only. |
source | string | optional | Pin to `sarthi` or `dmrc` instead of the fallback chain. |
network | string | optional | `dmrc` (default) or `nmrc`. Cross-network plans auto-stitch. |
{
"source": "sarthi",
"fallback_reason": null,
"strategy": "least-distance",
"from_station": {
"name": "AIIMS",
"code": "AIIMS",
"slug": "aiims",
"legacy_code": "AIIMS",
"sarthi_code": "AIIMS"
},
"to_station": {
"name": "Anand Vihar ISBT",
"code": "ASDM",
"slug": "anand-vihar-isbt",
"legacy_code": "ASDM",
"sarthi_code": "ASDM"
},
"total_time": "00:38:26",
"total_distance_km": 18.4,
"fare": {
"normal": 50.0,
"special": 40.0,
"applicable": 50.0,
"breakdown": []
},
"legs": [
{
"kind": "metro",
"network": "dmrc",
"line_name": "Yellow Line",
"line_color": "#FFD200",
"from_station": "AIIMS",
"to_station": "Rajiv Chowk",
"platform_name": "Platform 1",
"direction": "up",
"towards_station": "Samaypur Badli",
"duration": "00:10:00",
"distance_km": 4.2
}
],
"exclude_airport_line": false,
"separate_tickets": false,
"networks": [
"dmrc"
]
}