Overview

The LA Metro API provides real-time positions of Metro buses and trains across Los Angeles, along with route and schedule data. It requires no API key, so you can start making requests immediately without any registration. This is a great API for learning how to work with real-time vehicle tracking and public transit data.

Beginner Tip

Begin by fetching all active vehicle positions from the /vehicles endpoint to see buses and trains moving in real time. Combine latitude and longitude values with a mapping library like Leaflet to build a live transit map.

Available Data

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

match scores and results
team standings
player statistics
schedule and fixtures
vehicle make and model
year and specifications

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "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 identifier of the vehicle, typically the bus or train number.
latitude Current latitude of the vehicle, updated in near-real-time as the vehicle moves.
longitude Current longitude of the vehicle.
heading Direction the vehicle is traveling in degrees (0 = north, 90 = east, etc.).
route_id The route the vehicle is currently operating on, such as 720 or 805.
seconds_since_report How many seconds have passed since the vehicle last reported its position; lower values mean fresher data.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.metro.net/agencies/lametro/vehicles/";
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

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

Empty vehicles array No vehicles are actively reporting at that moment, which can happen during very early morning hours.
Try the request during normal service hours (roughly 5 AM to midnight) and check the Metro service alerts page for outages.
CORS error in the browser The API may not send permissive CORS headers for all endpoints when called directly from a browser.
Make requests from a backend server (Node.js, Python, etc.) instead of directly from client-side JavaScript.
404 on agency or route endpoint The agency slug or route ID in the URL path is incorrect.
Use the /agencies/ endpoint to list all valid agency slugs, then drill down to routes and vehicles using the returned identifiers.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Beginner
Listing details not endpoint-verified

Related Tags

Similar APIs

View All →