Transport for United States API

⭐ Beginner's Pick Transportation / No Auth Required Beginner HTTP
Free to Use Varies (check documentation)

Overview

Transport for United States (NextBus API) provides real-time public transit predictions for buses and light rail in various US cities. You can get live arrival predictions, route lists, stop locations, and vehicle positions for agencies like San Francisco Muni. No authentication is required — just specify the agency and route in your XML-based request.

💡

Beginner Tip

Start with the agencyList command to see all supported agencies, then use routeList to get routes for a specific agency. The predictions command gives you live arrival times for a specific stop.

Available Data

match scores and results
team standings
player statistics
schedule and fixtures
Use case: Integrate nextbus 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

body.predictions.direction Directional group containing a list of arrival predictions.
body.predictions.direction.prediction Array of individual arrival predictions for the stop.
prediction.seconds Seconds until the vehicle arrives at the stop.
prediction.minutes Minutes until the vehicle arrives, rounded down.
prediction.vehicle Vehicle ID of the incoming transit vehicle.
body.predictions.routeTitle Human-readable name of the transit route.

Implementation Example

const url = "https://retro.umoiq.com/xmlFeedDocs/";
const response = await fetch(url);
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

Error: Agency not found The agency tag used in the request does not match a supported agency.
First call https://retro.umoiq.com/service/publicXMLFeed?command=agencyList to get the correct agency tags.
XML parse error in your code The API returns XML by default, which may be unexpected if you are parsing JSON.
Parse the XML response using an XML parser in your language (e.g., xml2js for Node.js, ElementTree for Python).
No predictions available The stop tag or route tag may be incorrect, or no vehicles are currently running.
Verify stop and route tags using the routeConfig command before requesting predictions.

Matrix Score Breakdown

🌐 Reachability 15/30
⚡ Speed 20/20
🔒 Security 5/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 166ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS NO
CORS UNKNOWN
Category Transportation
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →