Boston MBTA Transit API

⭐ Beginner's Pick Transportation / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The Boston MBTA Transit API gives you real-time data for the Massachusetts Bay Transportation Authority, including train, bus, and ferry arrivals. You can retrieve live predictions, alerts, and schedule data for all MBTA routes. An API key is required and can be obtained for free on the MBTA developer portal.

💡

Beginner Tip

Register for a free API key at https://api-v3.mbta.com/ to get higher rate limits — unauthenticated requests are heavily throttled. Use the /predictions endpoint with a stop ID to get live arrival times.

Available Data

prediction result with confidence score
input name or text
statistical data

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

id Unique prediction identifier combining route, stop, and trip information.
attributes.arrival_time ISO 8601 timestamp of the predicted arrival time at the stop, or null if this is the first stop.
attributes.departure_time ISO 8601 timestamp of the predicted departure time from the stop.
attributes.status Human-readable status string such as "Arriving", "Boarding", or "Departed".
relationships.route.data.id The route identifier such as "Red", "Green-B", or "1" linking to the /routes endpoint.
relationships.stop.data.id The stop identifier linking to the /stops endpoint for location details.

Implementation Example

const url = "https://www.mbta.com/developers/v3-api";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

429 Too Many Requests Exceeded the rate limit, especially without an API key
Register for a free API key at https://api-v3.mbta.com/ and include it in the api_key query parameter or X-API-Key header.
Empty predictions array Querying a stop that currently has no scheduled service
Check the MBTA service calendar and verify the stop ID is correct using the /stops endpoint first.
400 Bad Request Invalid filter parameter or unknown stop ID
Look up valid stop IDs using GET /stops and use exact IDs like "place-sstat" for South Station.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 2/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →