Delhi Metro/ API
NCR Metro API · DMRC + NMRC

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.

REST JSON No auth v1 + v2 DMRC · NMRC
1

Make your first request

No API key. Plan a journey, or list lines. Station codes work in either upstream vocabulary on the v2 planner.

Terminal
# Plan a journey (v2 · Sarthi with DMRC fallback)
curl '/api/v2/journeys/plan?from_station_code=AIIMS&to_station_code=ASDM&strategy=least-distance'
Terminal
# List Delhi Metro lines
curl /api/v1/dmrc/lines
i
Tip

Prefer a browser? Use the live playground, open a sample plan, or explore every route in the OpenAPI explorer.

2

Error envelope

Successful responses return the domain payload directly (no outer wrapper). Failures use one stable shape for both local validation and upstream problems.

4xx / 502 · application/json
{
  "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.

3

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.

200 OK · PlannedJourney
{
  "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"
  ]
}
4

Health

Liveness probe for deploys and local development.

Path parameters

None.

Query parameters

None.

Response · 200 OK
application/json
{
  "status": "ok"
}
5

DMRC endpoints (v1)

Delhi Metro lines, stations, journeys, notifications, and map assets. Click any route for parameters and sample payloads.

Path parameters

None.

Query parameters

None.

Response · 200 OK
application/json
[
  {
    "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"
  }
]
Path parameters
NameTypeDescription
line_codestringrequiredDMRC line code, e.g. LN3, LN10, LN11.
Query parameters

None.

Response · 200 OK
application/json
[
  {
    "id": 1,
    "station_name": "Samaypur Badli",
    "station_code": "SPB",
    "station_facility": [],
    "metro_lines": [],
    "interchange": false,
    "status": "1"
  }
]
Path parameters

None.

Query parameters
NameTypeDescription
querystringoptionalStation name keyword. Empty returns the full station list.
filterstringoptional`all` (default), `least-distance`, or `minimum-interchange`.
Response · 200 OK
application/json
[
  {
    "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"
      }
    ]
  }
]
Path parameters
NameTypeDescription
station_codestringrequiredDMRC station code, e.g. RG, AIIMS, ASDM.
Query parameters

None.

Response · 200 OK
application/json
{
  "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": []
}
Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin station code.
to_station_codestringrequiredDestination station code.
strategystringoptional`least-distance` (default) or `minimum-interchange`.
journey_timedatetimeoptionalOptional ISO-8601 departure time for timed planning.
Response · 200 OK
application/json
{
  "from_station": "AIIMS",
  "to_station": "ASDM",
  "total_time": "00:28:00",
  "total_stations": 12,
  "fare": {
    "normal": 40,
    "special": 30
  },
  "route": []
}
Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin station code.
to_station_codestringrequiredDestination station code.
journey_timedatetimeoptionalOptional ISO-8601 departure.
Response · 200 OK
application/json
{
  "from_station": "AIIMS",
  "to_station": "ASDM",
  "total_time": "00:28:00",
  "total_stations": 12,
  "fare": {
    "normal": 40,
    "special": 30
  },
  "route": []
}
Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin station code.
to_station_codestringrequiredDestination station code.
journey_timedatetimeoptionalOptional ISO-8601 departure.
Response · 200 OK
application/json
{
  "from_station": "AIIMS",
  "to_station": "ASDM",
  "total_time": "00:28:00",
  "total_stations": 12,
  "fare": {
    "normal": 40,
    "special": 30
  },
  "route": []
}
Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin station code.
to_station_codestringrequiredDestination station code.
strategystringoptional`least-distance` (default) or `minimum-interchange`.
Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin station code.
to_station_codestringrequiredDestination station code.
journey_timedatetimeoptionalOptional ISO-8601 departure.
Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
page_slugstringrequiredPage slug from the notifications feed.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequired`network`, `airport-express`, or `rapid-metro`.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequired`network`, `airport-express`, or `rapid-metro`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any` (default).
Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequired`network`, `airport-express`, or `rapid-metro`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any` (default).
Response

/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.

Path parameters
NameTypeDescription
familystringrequired`network`, `airport-express`, or `rapid-metro`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any` (default).
Response

/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.

Path parameters
NameTypeDescription
asset_idstringrequiredAsset id from `/maps/assets`.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

6

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.

Path parameters

None.

Query parameters

None.

Response · 200 OK
application/json
[
  {
    "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"
  }
]
Path parameters
NameTypeDescription
line_codestringrequiredNMRC line code. Currently only `AQUA`.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters
NameTypeDescription
querystringoptionalStation name keyword.
filterstringoptional`all` (default), `least-distance`, or `minimum-interchange`.
Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
station_codestringrequiredNMRC station code, e.g. NM01.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters

None.

Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequiredCurrently only `network` is populated for NMRC.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequiredMap family, usually `network`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any`. PDF is empty for NMRC.
Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

Path parameters
NameTypeDescription
familystringrequiredMap family, usually `network`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any`.
Response

/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.

Path parameters
NameTypeDescription
familystringrequiredMap family, usually `network`.
Query parameters
NameTypeDescription
formatstringoptional`image`, `pdf`, or `any`.
Response

/download returns a 307 redirect to the upstream static URL. /file streams the bytes through this API.

Path parameters
NameTypeDescription
asset_idstringrequiredAsset id from `/nmrc/maps/assets`.
Query parameters

None.

Response · 200 OK

See the OpenAPI schema for the exact response model, or try it in the playground.

7

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.

Path parameters

None.

Query parameters
NameTypeDescription
from_station_codestringrequiredOrigin code in either DMRC or NMRC vocabulary.
to_station_codestringrequiredDestination code in either DMRC or NMRC vocabulary.
strategystringoptional`least-distance` (default) or `minimum-interchange`.
journey_timedatetimeoptionalISO-8601 departure, Delhi local time. Affects applicable fare.
exclude_airport_linebooleanoptionalAvoid Airport Express. Honoured by Sarthi only.
sourcestringoptionalPin to `sarthi` or `dmrc` instead of the fallback chain.
networkstringoptional`dmrc` (default) or `nmrc`. Cross-network plans auto-stitch.
Response · 200 OK
application/json
{
  "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"
  ]
}
Delhi Metro API · open source OpenAPI · ReDoc · GitHub