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

fetch('https://www.mtaapi.dev/api/v1/bus/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.bus namespace provides access to real-time bus data sourced from the MTA’s Bus Time API. Use mta.bus.arrivals to get the next predicted buses at a specific stop, and mta.bus.vehicles to see where every active bus on a route is right now, including its coordinates, bearing, next stop, and passenger occupancy status.

mta.bus.arrivals(params)

Returns upcoming bus arrival predictions for a single stop. Pass an optional route to limit results to one route serving that stop.

Parameters

stopId
string
required
The MTA bus stop ID to query (for example, '308214'). Look up stop IDs with mta.stops.near or from the MTA’s published stop data.
route
string
Optional route filter (for example, 'M23'). When omitted, all routes serving the stop are returned.
limit
number
Maximum number of upcoming arrivals to return. Must be between 1 and 100.
includeRaw
boolean
When true, the response includes the raw upstream feed payload alongside the normalized arrivals. Useful for debugging or accessing fields not yet surfaced by the normalized API.

Code example

import { MTA } from 'mta-js'

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

const response = await mta.bus.arrivals({
  stopId: '308214',
  route: 'M23',
  limit: 5,
})

for (const arrival of response.arrivals) {
  console.log(`${arrival.route}${arrival.headsign} — vehicle ${arrival.vehicleId}`)
}

mta.bus.vehicles(params)

mta.bus.vehicles(params)

Returns active bus vehicles. Pass route to scope to a single route, or vehicleId to look up a specific vehicle. Data is refreshed approximately every 30 seconds and reflects the most recent position reported by each vehicle’s onboard GPS unit.

Parameters

route
string
Optional bus route ID to filter on (for example, 'B63' for the Brooklyn route along Fifth Avenue, or 'M15' for the Manhattan crosstown route on First and Second Avenue). Route IDs are case-sensitive and match MTA’s published route identifiers.
vehicleId
string
Optional MTA vehicle ID to look up a single vehicle (for example, 'MTA_8741').
limit
number
Maximum number of vehicles to return. Must be between 1 and 100.
includeRaw
boolean
When true, the response includes the raw upstream feed payload alongside the normalized vehicle list.

TypeScript signature

interface BusVehiclesParams {
  route?: string
  vehicleId?: string
  limit?: number
  includeRaw?: boolean
}

interface BusVehicle {
  vehicleId: string
  lat: number
  lon: number
  bearing: number
  nextStop: string
  occupancyStatus: string
}

interface BusVehiclesResponse {
  route: string
  vehicles: BusVehicle[]
}

mta.bus.vehicles(params: BusVehiclesParams): Promise<BusVehiclesResponse>

Response fields

route
string
required
The route ID that was queried, echoed back in the response.
vehicles
object[]
required
An array of active vehicles on the route. Returns an empty array if no vehicles are currently in service.

Code example

import { MTA } from 'mta-js'

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

const response = await mta.bus.vehicles({ route: 'B63', limit: 10 })

console.log(`${response.vehicles.length} buses active on route ${response.route}`)

for (const vehicle of response.vehicles) {
  console.log(
    `Bus ${vehicle.vehicleId} at (${vehicle.lat}, ${vehicle.lon}) ` +
    `heading ${vehicle.bearing}° — next stop: ${vehicle.nextStop} ` +
    `— occupancy: ${vehicle.occupancyStatus}`
  )
}

Example response

{
  "route": "B63",
  "vehicles": [
    {
      "vehicleId": "MTA_8741",
      "lat": 40.6765,
      "lon": -73.9927,
      "bearing": 342,
      "nextStop": "5 AV/ATLANTIC AV",
      "occupancyStatus": "MANY_SEATS_AVAILABLE"
    },
    {
      "vehicleId": "MTA_8804",
      "lat": 40.6621,
      "lon": -73.9891,
      "bearing": 162,
      "nextStop": "5 AV/65 ST",
      "occupancyStatus": "FEW_SEATS_AVAILABLE"
    }
  ]
}
Use bearing together with lat and lon to render animated bus icons on a map that point in the correct direction of travel.

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
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