Regional transit REST
Get ordered NJ Transit rail stations for a route
Get ordered station patterns for an NJ Transit rail route from static GTFS.
GET
https://www.mtaapi.dev
/
api
/
v1
/
nj-transit
/
rail
/
routes
/
{route}
/
stations
mta-js
import { MTA } from "mta-js";
const mta = new MTA({ apiKey: process.env.MTA_API_KEY });
const data = await mta.njTransit.rail.routeStations({ route: "NEC", direction: "north" });{
"route": {
"id": "<string>",
"gtfsId": "<string>",
"shortName": "<string>",
"longName": "<string>",
"type": 123,
"color": "<string>",
"textColor": "<string>"
},
"mode": "subway",
"directions": [
{
"direction": "<string>",
"stops": [
{
"id": "<string>",
"name": "<string>",
"displayName": "<string>",
"lat": 123,
"lon": 123,
"mode": "subway",
"parentId": "<string>",
"arrivals": [
{
"mode": "subway",
"route": {
"id": "<string>",
"gtfsId": "<string>",
"shortName": "<string>",
"longName": "<string>",
"type": 123,
"color": "<string>",
"textColor": "<string>"
},
"stop": {
"id": "<string>",
"name": "<string>",
"displayName": "<string>",
"lat": 123,
"lon": 123,
"mode": "subway",
"parentId": "<string>"
},
"direction": "north",
"arrivalTime": "<string>",
"minutes": 123,
"realtime": true,
"source": "<string>",
"destination": "<string>",
"displayDirection": "<string>",
"headsign": "<string>",
"departureTime": "<string>",
"tripId": "<string>",
"raw": "<unknown>"
}
]
}
],
"headsigns": [
"<string>"
]
}
]
}Authorizations
bearerAuthapiKeyAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Query Parameters
Minimum string length:
1Response
200 - application/json
Response for status 200
Available options:
subway, bus, path, nj-transit-rail, nyc-ferry, lirr, metro-north Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Available options:
subway, bus, path, nj-transit-rail, nyc-ferry, lirr, metro-north Hide child attributes
Hide child attributes
Available options:
subway, bus, path, nj-transit-rail, lirr, metro-north Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Available options:
subway, bus, path, nj-transit-rail, nyc-ferry, lirr, metro-north Available options:
north, south, east, west, unknown, uptown, downtown ⌘I
mta-js
import { MTA } from "mta-js";
const mta = new MTA({ apiKey: process.env.MTA_API_KEY });
const data = await mta.njTransit.rail.routeStations({ route: "NEC", direction: "north" });{
"route": {
"id": "<string>",
"gtfsId": "<string>",
"shortName": "<string>",
"longName": "<string>",
"type": 123,
"color": "<string>",
"textColor": "<string>"
},
"mode": "subway",
"directions": [
{
"direction": "<string>",
"stops": [
{
"id": "<string>",
"name": "<string>",
"displayName": "<string>",
"lat": 123,
"lon": 123,
"mode": "subway",
"parentId": "<string>",
"arrivals": [
{
"mode": "subway",
"route": {
"id": "<string>",
"gtfsId": "<string>",
"shortName": "<string>",
"longName": "<string>",
"type": 123,
"color": "<string>",
"textColor": "<string>"
},
"stop": {
"id": "<string>",
"name": "<string>",
"displayName": "<string>",
"lat": 123,
"lon": 123,
"mode": "subway",
"parentId": "<string>"
},
"direction": "north",
"arrivalTime": "<string>",
"minutes": 123,
"realtime": true,
"source": "<string>",
"destination": "<string>",
"displayDirection": "<string>",
"headsign": "<string>",
"departureTime": "<string>",
"tripId": "<string>",
"raw": "<unknown>"
}
]
}
],
"headsigns": [
"<string>"
]
}
]
}