TL;DR
The MBTA API v3 provides real-time and scheduled data for all Massachusetts Bay Transportation Authority services — subway (Red, Orange, Blue, Green, Mattapan), commuter rail, bus, ferry, and the Silver Line. It follows the JSON:API specification with support for filtering, pagination, includes (relationships), and spatial queries. The API is ideal for building Boston-specific transit apps, arrival prediction tools, and service alert dashboards. Basic access requires no API key.
Quick start: https://api-v3.mbta.com/routes
No API key needed — just make a request!
How to Use This API
1. List All Routes
https://api-v3.mbta.com/routes
2. Get Stops on the Red Line
https://api-v3.mbta.com/stops?filter[route]=Red
3. Predictions for Park Street
https://api-v3.mbta.com/predictions?filter[stop]=place-pktrm&sort=departure_time
4. JavaScript — Next Train Times
fetch('https://api-v3.mbta.com/predictions?filter[stop]=place-harsq&filter[route]=Red')
.then(r => r.json())
.then(d => {
d.data.forEach(p => {
const attrs = p.attributes;
console.log(`To ${attrs.direction}: ${attrs.departure_time}`);
});
});
5. Python — Get Active Alerts
import requests
resp = requests.get('https://api-v3.mbta.com/alerts', params={
'filter[activity]': 'BOARDING',
'sort': '-updated_at'
})
alerts = resp.json()
for a in alerts['data'][:5]:
print(a['attributes']['header'])
https://api-v3.mbta.com/routes
API Details
- API URL
https://api-v3.mbta.com- Documentation
- mbta.com/developers
- Category
- Transport
- Authentication
- Not Required (basic access)
- Geographic Coverage
- USA — Greater Boston, Massachusetts
Frequently Asked Questions
- Do I need an API key for the MBTA API?
- No, anonymous access works for the v3 API. Registering for a free API key (from MBTA Developer Portal) raises the rate limit from 20 to 60 requests per minute.
- What transit modes are covered?
- Subway/light rail (Red, Orange, Blue, Green, Mattapan), Commuter Rail (12 lines), Bus (170+ routes), Ferry (4 routes), and the Silver Line BRT.
- Can I get real-time vehicle positions?
- Yes, the
/vehiclesendpoint returns real-time GPS positions for subway trains and some buses, including latitude, longitude, speed, and bearing. - What are the stop IDs?
- Stops use IDs like
place-pktrm(Park Street),place-harsq(Harvard Square),place-sstat(South Station). These can be found via the/stopsendpoint. - How does the JSON:API format work?
- Responses use the JSON:API spec with
data(primary array),included(related resources),links(pagination), and support forincludeparameter to eager-load relationships. - Does the API include fare information?
- Yes, the
/fare_productsendpoint describes fare types. Real-time fare calculation is available via/fareendpoints with origin/destination parameters.
What You Can Build
- Boston subway arrival time display for stations
- Commuter rail schedule app with delay alerts
- Multi-modal trip planner combining bus and T
- Service disruption dashboard with real-time alerts
- Commute cost calculator with fare information