Agency slugs and SDK clients
Each property is a
CommuterRailClient, with the same methods as mta.lirr and mta.metroNorth.
Look up stops and routes
Installmta-js 2.7.0 or later and set MTA_API_KEY in your environment:
stops() accepts an optional name filter. routes() lists the agency’s routes, and routeStops() returns the stops served by a route:
mta-js, CommuterRailRoute exposes that value as the optional shortName property.
Get departures
Thestop parameter accepts a stop or station ID, stop code, or exact name:
departures() method is available on capMetro, bart, triRail, brightline, and pace.
Check vehicles and alerts
Feed limitations
- BART: BART publishes no vehicle positions, so
mta.bart.vehicles()has no positions to return. - Tri-Rail: Departures are usually empty because its live feed has no stop IDs or event times. Vehicle positions work.
- Brightline: There is no alerts feed, so
mta.brightline.alerts()returns an empty list. - UTA: Departures are always empty because its trip updates have no stop IDs.
- JTA: Departures are usually empty because realtime stop IDs do not match its static GTFS.
- PRT: Realtime covers buses only, not light rail, and there is no alerts feed.
- MARTA: Realtime covers buses only.
- VIA: Its feeds are served over HTTP.