BART API Case Study


The Bay Area Rapid Transit District (BART) is a leader in the "Open Government" movement, providing General Transit Feed Specification (GTFS) data for their routes, XML data for their advisories, and RSS feeds. They wanted to expand this to allow developers wider access to all of the BART data, including trip planning, real-time ETD information, station information, and much more.


BART wanted to build an Application Programming Interface (API) to provide access to their data for developers as part of an "open data" initiative. They also wanted to make sure it wouldn't impact their regular web server, 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 the extensive XML structure that is currently used to drive the BART website, Web Master Designs created a complete API solution which incorporates all of the data that BART wanted. To reduce the impact on the production website, the API was implemented on a secondary server 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 currently XML, with the potential for adding JSON support in the future. The registration process utilizes an MSSQL server as well as the GovDelivery API (beta).


Although just now being rolled out, the API has been a hit with developers so far. It's being used to drive the BART automated phone trip planner, an IVR system that provides trip planning functionality, which is helping to reduce calls to the BART customer service center. Developers are currently working on applications for the iPhone and Palm Pre utilizing 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."

- Tim 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

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


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.