Delhi NCR Metro/ API
NCR Metro API · DMRC + NMRC

Delhi NCR Metro API

If you have ever tried to build anything on top of Delhi's metro data, you know it is a patchwork. Official endpoints that disagree, an Aqua Line with no API at all, and map files that change names every deploy. This API cleans that up.

A typed REST API for Delhi NCR. Lines, stations, fares, routes, first and last trains, maps, and notifications for DMRC and NMRC, plus a unified v2 planner that stitches both networks when you cross from Delhi into Noida.

It is a thin, typed wrapper. Pydantic everywhere, one predictable error shape whether you messed up or an upstream did, and the same schemas for Delhi and Noida so your app does not need two code paths. REST and JSON, no auth. If you can fetch, you can use it. /api/v1 mirrors the operators one for one, /api/v2 is the nicer planner that prefers Sarthi and falls back to the legacy route when it has to.

REST JSON No auth v1 + v2 DMRC · NMRC
1

Make your first request

No API key, no ceremony. Plan a journey or list every line with curl. On the v2 planner you can mix station codes from either operator and the API handles the translation for you.

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

Success returns the payload directly, no wrapper. Failures all look the same, which is on purpose. You get a detail string and, when an upstream is to blame, the status it returned.

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 is literal. It mirrors what each operator actually publishes, DMRC's JSON and NMRC's HTML, without pretending they are one system. /api/v2 is the opinionated planner. Sarthi answers first because its data is richer, legacy DMRC fills in when Sarthi fails, and trips that cross from Delhi to Noida are stitched automatically at the Sector 52 to 51 walk.

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)

All the Delhi Metro primitives. Lines, stations, journeys, notifications, and map assets. Open any route for params and a real sample payload.

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
NameTypeDescription
streambooleanoptionalSend Server-Sent Events (`status`, `error`, `layout`) instead of waiting for JSON.
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)

The Aqua Line, same shapes and schemas as Delhi Metro so your client does not branch. The data comes from NMRC's public pages, parsed on the server, with checked-in tables as fallback when the HTML is unavailable.

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
NameTypeDescription
streambooleanoptionalSend Server-Sent Events (`status`, `error`, `layout`) instead of waiting for JSON.
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 clean PlannedJourney no matter who answered. Cross-network trips come back with source: "combined", a walking leg for the Sector 52 to 51 bridge, and fares split in fare.breakdown because the two systems do not share tickets.

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 NCR Metro API · open source OpenAPI · ReDoc · GitHub