Skip to main content

BART API Case Study


The Bay Area Rapid Transit District (BART) is a leader in the "Open Government" movement and a big proponent of "open data." It was one of the first transit agencies to provide schedules in the General Transit Feed Specification (GTFS) format and was providing some additional data in XML and RSS feeds. It wanted to expand this to allow developers wider access to all of the BART data, including trip planning, real-time service, station information, and much more.


BART wanted to build an Application Programming Interface (API) to provide access to its data for developers as part of an "open data" initiative. It also wanted to make sure it wouldn't impact its existing web services, could be secured with an API key, and provided a method for registering developers with GovDelivery, BART's e-mail distribution list provider, so that developers could stay informed of changes via e-mail updates. Finally, end-user documentation and samples for the API were needed to help developers understand and make use of the new features.


Building on an extensive XML structure that we had already created to drive the BART website, Web Master Designs built a complete API solution that incorporated all of the data that BART wanted. To reduce the impact on the production website, the API was implemented on a set of secondary servers in the BART server cluster and a registration system was developed which allows developers to register for an API key. This registration process utilizes reCaptcha, a challenge-response method for ensuring the form is submitted by a human, in order to prevent script attacks.

In addition, Web Master Designs designed and implemented an online documentation site including full working examples of all the API calls and a glossary of BART transit terms. We've also been involved in monitoring and answering questions in the BART Developers Google Group, handling questions as well as requests for added functionality.

The code for the API was developed in C# using Object Oriented Programming methodologies and various libraries for ease of maintenance and expandability. The output is available in XML or JSON formats. The registration process utilizes an MSSQL server as well as the GovDelivery API.

Over time, the API has been extended to include additional information including real-time estimates, elevator and escalator service outages, and additional fields on the BART schedule. Some of these are BART internal use only, but eventually all data should be included in the external API used by third-party developers.


The API has been a hit with developers since it was launched back in 2010. Initially it was used to drive the BART automated phone trip planner, an IVR system that provides trip planning functionality, which helped to reduce calls to the BART customer service center. (This was eventually phased out with the implementation of external apps.) The API drives the real-time data on the BART website as well as all QuickPlanner trip planning calls. This accounts for approximately 2 million calls per month.

Developers have created more then 100 different apps that utilize the BART API, making approximately 60 million additional hits per month. View the BART API.


"Web Master Designs brought a tremendous amount of insight to the development of BART's open APIs. As one of the first transit agencies in the country to release real-time data, we didn't have a script to follow. Now much of what WMD did for us is part of the standard playbook at other public agencies."

- Timothy Moore, BART Website Manager

Comments on Twitter about API:
RT @SFBART: BART launches expanded API today to encourage transit app development: - @SFBART has the awesomesauce

bummed that @OneRiot API is available only through whitelisting IPs. sounds restrictive. Wish, everyone uses model...

BART receives 9.5 mil API calls/month for advisories, 31+ mil for real time arrivals, and 14+ mil for trips. Wow @timomio! #BARTAccessTech

Okay, now this just makes me want to move to California... "BART For Developers." Their train system has a data API!

BART API selected for Harvard Summer School homework assignment on AJAX and 3rd Party APIs.


Bay Area Rapid Transit (BART) connects the San Francisco peninsula with Oakland, Berkeley, Fremont, Walnut Creek, Dublin/Pleasanton, and other cities in the East Bay. For more than 35 years BART has provided fast, reliable transportation to downtown offices, shopping centers, tourist attractions, entertainment venues, universities, and other destinations for Bay Area residents and visitors alike.