Transport for Washington, US API

Transportation / OAuth Advanced HTTPS
Varies by plan (check documentation)

Overview

Transport for Washington, US (WMATA API) provides real-time and scheduled data for Washington DC's Metro rail and bus system. You can access live train predictions, bus arrivals, rail station information, and service alerts. An API key is required — sign up for a free developer account at developer.wmata.com which allows 10 calls/second and 50,000 calls/day.

💡

Beginner Tip

Register at developer.wmata.com for a free subscription key. Use the "Default Tier" subscription — it allows 10 calls/second and 50,000 calls/day, which is more than enough for personal projects.

Available Data

match scores and results
team standings
player statistics
schedule and fixtures
Use case: Integrate washington metro transport api data into web and mobile applications

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

Trains List of train arrival predictions for the requested station.
Trains[].Car Number of cars on the train (e.g., 6 or 8).
Trains[].Destination Final destination station name of the train.
Trains[].Line Metro line color code (e.g., RD for Red, BL for Blue).
Trains[].Min Minutes until arrival — BRD means boarding, ARR means arriving.
Trains[].LocationName Name of the station being queried.

Implementation Example

const url = "https://developer.wmata.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "Authorization": "Bearer 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

401 Unauthorized API key is missing or not passed correctly in the request header.
Include your key as a query parameter or header: api_key: YOUR_API_KEY.
400 Bad Request Station code or stop ID is invalid or formatted incorrectly.
Use the /Rail.svc/json/jStations endpoint to retrieve all station codes and their names first.
Stale predictions Caching the response for too long — train positions update every 20 seconds.
Set cache TTL to 20-30 seconds maximum to ensure predictions remain accurate for users.

Matrix Score Breakdown

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

Partially tested on Apr 5, 2026

Technical Specifications

Auth OAuth
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Advanced
Verified: 2026-04-04

Similar APIs

View All →