Travel
MBTA logo

MBTA API

mbta.com

Boston MBTA transit - schedules, stops, routes, real-time departures, and alerts.

Actions
11
Category
Travel
Login
Not required
Output
JSON

Call the MBTA API

Submit a task, then poll the job until it settles. This example runs act_mbta_line_schedule_map.

curl -X POST https://api.anakin.io/v1/wire/task \
  -H "X-API-Key: $ANAKIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_id": "act_mbta_line_schedule_map",
    "params": {
      "line_id": "Red",
      "direction_id": "0"
    }
  }'

11 actions on mbta.com

Read

  • Line Schedule Map

    act_mbta_line_schedule_mapread2 credits / call

    Returns map markers and geometry for stops on an MBTA line and direction.

    line_id
    string · required
    direction_id
    string · required
  • Line Schedule Stops

    act_mbta_line_schedule_stopsread2 credits / call

    Returns the full stop tree and schedule structure for an MBTA line direction.

    line_id
    string · required
    direction_id
    string · required
  • Popular Stations

    act_mbta_popular_stationsread1 credit / call

    Returns popular stations and airports with stop IDs, coordinates, and line features.

  • Route Metadata

    act_mbta_route_metadataread2 credits / call

    Returns route display metadata such as names, colors, and types for given route IDs.

    route_ids_csv
    string · required
  • Route Service Alerts

    act_mbta_route_service_alertsread2 credits / call

    Returns active service alerts filtered by given route IDs.

    route_ids_csv
    string · required
  • Stop Metadata

    act_mbta_stop_metadataread1 credit / call

    Returns station metadata including address, accessibility, and parking for a stop ID.

    stop_id
    string · required
  • Stop Realtime Departures

    act_mbta_stop_realtime_departuresread2 credits / call

    Returns live and scheduled departure board entries for a stop.

    stop_id
    string · required
    last_stop_departures
    boolean
    future_departures
    boolean
  • Stop Route Patterns

    act_mbta_stop_route_patternsread1 credit / call

    Returns route patterns and route IDs serving a stop.

    stop_id
    string · required
  • Subway Line Schedule

    act_mbta_subway_line_schedule_ssrread1 credit / call

    Returns the stop tree and schedule structure for a subway line.

    line_id
    string · required
  • Trip Planner Results

    act_mbta_trip_planner_results_ssrread2 credits / call

    Returns trip planner results for an encoded origin and destination plan.

    trip_plan_blob
    string · required

Write

Write actions change state on mbta.com and run as the account you connect.

  • Stop Station Search

    act_mbta_stop_station_searchwrite2 credits / call

    Returns stops and stations matching a query with ranked IDs and coordinates.

    search_query
    string · required
    algolia_indexes_with_params
    array

MBTA API questions

Is there an API for MBTA?
MBTA does not offer a public data API for this, but Anakin Wire provides 11 maintained endpoints for mbta.com. You call Anakin's REST API with an action ID and parameters and get structured JSON back; Anakin handles the browser, proxies, anti-bot, and parsing.
How do I scrape MBTA data?
POST to https://api.anakin.io/v1/wire/task with your API key, the action ID, and its parameters, then poll GET /v1/wire/jobs/{id} until the job settles. There is nothing to install and no scraper to maintain — when mbta.com changes its markup, Anakin updates the action.
Do I need a MBTA account?
No. Every MBTA action listed here runs anonymously — no account and no credentials required.
What does the MBTA API cost?
Usage-based credits, charged per call and refunded automatically when a job fails. New accounts start with 300 free credits and no card. See anakin.io/pricing for the current rates.

More Travel APIs

All Travel sites