Skip to main content
GET
https://www.mtaapi.dev
/
api
/
v1
/
subway
/
arrivals
Get subway arrivals
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://www.mtaapi.dev/api/v1/subway/arrivals', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
[
  {
    "route": {
      "id": "<string>",
      "shortName": "<string>",
      "longName": "<string>",
      "type": 123,
      "color": "<string>",
      "textColor": "<string>"
    },
    "stop": {
      "id": "<string>",
      "name": "<string>",
      "displayName": "<string>",
      "lat": 123,
      "lon": 123,
      "parentId": "<string>"
    },
    "arrivalTime": "<string>",
    "minutes": 123,
    "realtime": true,
    "source": "<string>",
    "destination": "<string>",
    "displayDirection": "<string>",
    "headsign": "<string>",
    "departureTime": "<string>",
    "tripId": "<string>",
    "raw": "<unknown>"
  }
]

Documentation Index

Fetch the complete documentation index at: https://mtaapi.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

The mta.subway namespace gives you access to real-time arrival data sourced directly from the MTA’s GTFS-Realtime feeds. Use mta.subway.arrivals to retrieve the next trains arriving at any subway stop for a specific route, including trip IDs, predicted arrival timestamps, and direction of travel.

mta.subway.arrivals(params)

Returns real-time arrival predictions for a given stop and route combination. Arrival times are Unix timestamps in seconds and reflect the MTA’s latest feed update, typically refreshed every 30 seconds.

Parameters

stopId
string
required
The MTA stop ID for the station you want to query (for example, 'A27' for Howard Beach–JFK Airport on the A line). You can look up stop IDs using mta.stops.near or the MTA’s static GTFS data.
route
string
The route ID to filter arrivals by (for example, 'A', '1', or 'N'). Optional — when omitted, arrivals across all routes serving the stop are returned. When supplied, only arrivals for that route are returned.
direction
string
Optional direction filter. Accepts the feed values 'north', 'south', 'east', 'west', 'unknown', plus the rider-facing aliases 'uptown' (→ north) and 'downtown' (→ south).
limit
number
Maximum number of arrivals to return, between 1 and 100. Defaults to 20.
includeRaw
boolean
When true, each arrival includes the underlying GTFS-RT entity on a raw field. Defaults to false.

TypeScript signature

interface SubwayArrivalQuery {
  stopId: SubwayStopId
  route?: SubwayRoute
  direction?: Direction | 'uptown' | 'downtown'
  limit?: number
  includeRaw?: boolean
}

interface Arrival {
  mode: TransitMode          // 'subway' | 'bus' | 'lirr' | 'metro-north'
  route: Route
  stop: Stop
  direction: Direction       // 'north' | 'south' | 'east' | 'west' | 'unknown'
  destination?: string       // headsign / terminal station name
  displayDirection?: string  // e.g. "toward 8 Av" or "northbound"
  headsign?: string
  arrivalTime: string        // ISO 8601
  departureTime?: string     // ISO 8601
  minutes: number
  tripId?: string
  realtime: boolean
  source: 'mta-gtfs-rt' | 'mta-bustime'
  raw?: unknown              // present when includeRaw: true
}

mta.subway.arrivals(params: SubwayArrivalQuery): Promise<Arrival[]>

Response fields

arrivals
Arrival[]
required
An array of upcoming arrivals, ordered by arrivalTime ascending. Returns an empty array if no arrivals are scheduled in the current feed window.

Code example

import { MTA } from 'mta-js'

const mta = new MTA({ apiKey: process.env.MTA_API_KEY })

const arrivals = await mta.subway.arrivals({
  stopId: 'L08',
  route: 'L'
})

for (const arrival of arrivals) {
  const label = arrival.displayDirection ?? arrival.destination ?? 'unknown direction'
  console.log(
    `${arrival.route.shortName}${label}${arrival.minutes} min`
  )
}

Example response

[
  {
    "mode": "subway",
    "route": { "id": "A", "shortName": "A", "color": "#0039A6" },
    "stop": { "id": "A27", "name": "Howard Beach-JFK Airport", "displayName": "Howard Beach–JFK Airport" },
    "direction": "south",
    "destination": "Ozone Park-Lefferts Blvd",
    "displayDirection": "toward Ozone Park-Lefferts Blvd",
    "arrivalTime": "2026-05-29T18:37:00.000Z",
    "minutes": 4,
    "tripId": "AFA25GEN-A078-Sunday-00_000600_A..S03R",
    "realtime": true,
    "source": "mta-gtfs-rt"
  },
  {
    "mode": "subway",
    "route": { "id": "A", "shortName": "A", "color": "#0039A6" },
    "stop": { "id": "A27", "name": "Howard Beach-JFK Airport", "displayName": "Howard Beach–JFK Airport" },
    "direction": "north",
    "destination": "Inwood-207 St",
    "displayDirection": "toward Inwood-207 St",
    "arrivalTime": "2026-05-29T18:49:00.000Z",
    "minutes": 16,
    "tripId": "AFA25GEN-A076-Sunday-00_003600_A..N03R",
    "realtime": true,
    "source": "mta-gtfs-rt"
  }
]
The MTA feed does not always include arrivals for every route at every stop. If arrivals is empty, the train may not be active in the current feed window — check during service hours and verify the stopId and route combination is valid.

mta.subway.direction(params)

The mta.subway namespace also exposes mta.subway.direction(), which resolves a rider-facing destination string (such as "Union Sq") into the north / south feed direction, the terminal the train heads toward, and a display label — handy for pre-selecting the right direction before calling arrivals. See the dedicated Direction reference for full parameters, types, and examples.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

stopId
string
required
Minimum string length: 1
route
string
Minimum string length: 1
direction
enum<string>
Available options:
north,
south,
uptown,
downtown
limit
number
Required range: 1 <= x <= 100
includeRaw
boolean

Response

200 - application/json

Response for status 200

mode
enum<string>
required
Available options:
subway,
bus,
lirr,
metro-north
route
object
required
stop
object
required
direction
enum<string>
required
Available options:
north,
south,
east,
west,
unknown,
uptown,
downtown
arrivalTime
string
required
minutes
number
required
realtime
boolean
required
source
string
required
destination
string
displayDirection
string
headsign
string
departureTime
string
tripId
string
raw
any