SDK Reference
mta.subway.arrivals() — real-time subway predictions
Reference for mta.subway in mta-js. Fetch real-time arrival predictions for any subway stop and route, with Unix timestamps and direction of travel.
GET
Get subway arrivals
TheDocumentation Index
Fetch the complete documentation index at: https://mtaapi.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
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
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.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.Optional direction filter. Accepts the feed values
'north', 'south', 'east', 'west', 'unknown', plus the rider-facing aliases 'uptown' (→ north) and 'downtown' (→ south).Maximum number of arrivals to return, between
1 and 100. Defaults to 20.When
true, each arrival includes the underlying GTFS-RT entity on a raw field. Defaults to false.TypeScript signature
Response fields
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
Example response
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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Minimum string length:
1Minimum string length:
1Available options:
north, south, uptown, downtown Required range:
1 <= x <= 100Response
200 - application/json
Response for status 200
Available options:
subway, bus, lirr, metro-north Available options:
north, south, east, west, unknown, uptown, downtown Previous
DirectionReference for mta.subway.direction in mta-js. Resolve a rider-facing destination string into a typed north/south direction, terminal, and display label.
Next
Get subway arrivals