Skip to content

Real-Time Bus Predictions API

by wmata.com

API keyHTTPSTransportation
Open documentation ↗

Overview

Real-time bus prediction methods.

Real-Time Bus Predictions is a transportation API from wmata.com. Requests are authenticated with an API key. It is served over HTTPS. Its OpenAPI description documents 2 endpoints.

At a glance

Authentication
API key
HTTPS
Yes
CORS
Unknown
Base URL
http://api.wmata.com/NextBusService.svc
Version
1.0
Endpoints
2
Spec updated
2021-06-21

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "http://api.wmata.com/NextBusService.svc/Predictions" \
  -H "Accept: application/json" \
  -H "X-API-Key: YOUR_API_KEY"
JavaScript
const response = await fetch("http://api.wmata.com/NextBusService.svc/Predictions", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "X-API-Key": "YOUR_API_KEY",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "http://api.wmata.com/NextBusService.svc/Predictions",
    headers={
    "Accept": "application/json",
    "X-API-Key": "YOUR_API_KEY",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/PredictionsXML - Next Buses
GET/json/jPredictionsJSON - Next Buses

Questions

Does the Real-Time Bus Predictions API need an API key?

Yes. The Real-Time Bus Predictions API uses API key authentication; the documentation explains how to get credentials.

Does the Real-Time Bus Predictions API support HTTPS?

Yes, the Real-Time Bus Predictions API is served over HTTPS.

How many endpoints does the Real-Time Bus Predictions API have?

Its OpenAPI description lists 2 endpoints in version 1.0. All of them are shown on this page.

What are alternatives to the Real-Time Bus Predictions API?

Other Transportation APIs include airportsapi, Transport for London, England, Uber, Transport for Spain, Amadeus for Developers.

Compare alternatives →

Listed from APIs.guru (CC0).