Transportation — entry 008 of 69

Bay Area Rapid Transit

Verified Jul 2026

Official real-time transit API for Bay Area Rapid Transit, covering the BART rail network across San Francisco, Oakland, and the wider East Bay. Endpoints return station lists, real-time and scheduled arrival predictions (ETD), route and schedule data, and system advisories in XML or JSON, accessed with a free shared or self-registered API key.

BART is the rapid transit system of the San Francisco Bay Area. Its legacy API gives real-time departure estimates, schedules, and station data. Every request needs a key parameter.

transittransportationreal-timegovernmentbay-area
AuthenticationAPI KeySign up with the provider to obtain credentials.
HTTPSSupportedTraffic is encrypted in transit.
CORSEnabledCallable directly from browser JavaScript.
PricingFreeNo paid tier — free for the documented use case.
FormatsJSON, XMLResponses can be requested as JSON or XML.

GreatAPIs Score

Score84out of 100
Authentication15/25API key required
Pricing20/20Free to use
Docs14/20Documentation URL provided
Formats15/15Supports 2 response formats
Freshness20/20Verified within 6 months

Embed this badge

Scored 84 on greatapis.com
<a href="https://greatapis.com/api/bay-area-rapid-transit/"><img src="https://greatapis.com/badge/bay-area-rapid-transit.svg" alt="Scored 84 on greatapis.com"></a>

Auth quickstart

  1. Register for your own key at https://api.bart.gov/api/register.aspx. The registration page is titled "BART API Key Registration".
  2. Add the key as the key query parameter on every call.
  3. For a first test, use the public key MW9S-E7SL-26DU-VV8V. BART prints it in its own examples at https://api.bart.gov/docs/overview/examples.aspx. It worked in a live probe. Use your own key in production.
Stored keyNo key stored

Your key is stored only in this browser (localStorage) and sent directly to the API — never to greatapis.

Get live departures for a station

GEThttps://api.bart.gov/api/etd.aspx?cmd=etd&orig=12th&key=MW9S-E7SL-26DU-VV8V&json=y

200 application/json; charset=utf-8

{"?xml":{"@version":"1.0","@encoding":"utf-8"},"root":{"@id":"1","uri":{"#cdata-section":"http://api.bart.gov/api/etd.aspx?cmd=etd&orig=12th&json=y"},"date":"09/28/2026","time":"05:03:03 PM PDT","station":[{"name":"12th St. Oakland City Center","abbr":"12TH","etd":[{"destination":"Antioch","abbreviation":"ANTC","limited":"0","estimate":[{"minutes":"11","platform":"3","direction":"North","length":"9","color":"YELLOW","hexcolor":"#ffff33","bikeflag":"1","delay":"66","cancelflag":"0","dynamicflag":"0"}]}]}],"message":""}}

The etd array is truncated to its first destination, and its estimate array to its first train. The live call returned 6 destinations with 3 estimates each. The estimate object is unchanged.

Developer reference

Gotchas & limits

  • Add json=y. Without it, the same call returns XML (<?xml version="1.0" ...><root>...).
  • The JSON is converted from XML. The top-level key is ?xml, and the data sits under root. Text nodes appear as #cdata-section, and every number is a string ("minutes":"12").
  • BART's docs show <minutes>Leaving</minutes> as a possible value. minutes can be the word Leaving instead of a number. Test for that before you parse it.
  • A bad key returns HTTP 400 with a JSON error body: {"root":{"message":{"error":{"text":"Invalid key","details":"The api key was missing or invalid."}}}}.
  • A bad station code returns HTTP 400 with "Invalid orig": The orig station parameter ZZZZ is missing or invalid. Station codes are the four-letter abbreviations, such as 12TH.
  • The key sits in the URL. Do not put your own key in front-end code that you publish.