Skip to main content
Beyond realtime arrivals, mta-js exposes the catalog behind the system: the list of routes, the ordered stations on a subway line, the ordered stops on a bus route, and batch lookups to resolve stop IDs you already have. Use these to build route pickers, draw a route map, or hydrate saved stop IDs into names and coordinates.
These endpoints require a hosted apiKey. See Authentication to get one.

Prerequisites

  • mta-js installed (npm install mta-js)
  • An MTA API key set as MTA_API_KEY in your environment
1

List routes for a picker

mta.routes.list() returns the route catalog. Pass the modes you care about, or omit for everything.
2

Get the ordered stations on a subway route

mta.subway.routeStations() returns the route’s stop patterns. Pass a direction to order them in the rider’s direction of travel.
3

Get the ordered stops on a bus route

mta.bus.routeStops() is the bus equivalent, returning ordered stops grouped by direction.
4

Hydrate stop IDs you already have

When you have stored stop IDs (favorites, a saved trip), resolve them in one call with mta.stops.byIds(). Each result keeps its requestedId and a found flag; set includeRoutes to attach the routes serving each stop.
These guides use the SDK. For the raw REST endpoints, see Routes, Subway Route Stations, Bus Route Stops, and Stops by ID.