Route Information API
Command: routes
Inputs
Parameter | Description |
---|---|
cmd=routes | Requests information regarding current lines. (Required) |
key=<key> | API registration key. (Required) |
date=<mm/dd/yyyy> | Specifies a specific date to use. This will determine the appropriate schedule for that date, and give back information about the lines for that schedule. Date can also be specified as "today" or "now". (Optional) |
json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
- Route Information sometimes changes with schedule changes as routes are reconfigured. This may affect the name and abbreviation of the route.
Results
XML Sample
<?xml version="1.0" encoding="utf-8" ?> <root> <uri><![CDATA[ https://api.bart.gov/api/route.aspx?cmd=routes ]]></uri> <routes> <route> <name>Pittsburg/Bay Point - SFIA/Millbrae</name> <abbr>PITT-SFIA</abbr> <routeID>ROUTE 1</routeID> <number>1</number> <hexcolor>#ffff33</hexcolor> <color>#ffff33</color> <direction>South</direction> </route> ... </routes> <message /> </root>
JSON Sample
{ "?xml":{ "@version":"1.0", "@encoding":"utf-8" }, "root":{ "uri":{ "#cdata-section":"https://api.bart.gov/api/route.aspx?cmd=routes&json=y" }, "routes":{ "route":[ { "name":"Pittsburg/Bay Point - SFIA/Millbrae", "abbr":"PITT-SFIA", "routeID":"ROUTE 1", "number":"1", "hexcolor":"#ffff33", "color":"#ffff33", "direction":"South" }, { "name":"Daly City - Dublin/Pleasanton", "abbr":"DALY-DUBL", "routeID":"ROUTE 12", "number":"12", "hexcolor":"#0099cc", "color":"#0099cc", "direction":"North" }, { "name":"Daly City - Warm Springs/South Fremont", "abbr":"DALY-WARM", "routeID":"ROUTE 6", "number":"6", "hexcolor":"#339933", "color":"#339933", "direction":"South" }, { "name":"Dublin/Pleasanton - Daly City", "abbr":"DUBL-DALY", "routeID":"ROUTE 11", "number":"11", "hexcolor":"#0099cc", "color":"#0099cc", "direction":"South" }, { "name":"Warm Springs/South Fremont - Daly City", "abbr":"WARM-DALY", "routeID":"ROUTE 5", "number":"5", "hexcolor":"#339933", "color":"#339933", "direction":"North" }, { "name":"Warm Springs/South Fremont - Richmond", "abbr":"WARM-RICH", "routeID":"ROUTE 3", "number":"3", "hexcolor":"#ff9933", "color":"#ff9933", "direction":"North" }, { "name":"Millbrae/Daly City - Richmond", "abbr":"MLBR-RICH", "routeID":"ROUTE 8", "number":"8", "hexcolor":"#ff0000", "color":"#ff0000", "direction":"North" }, { "name":"Richmond - Warm Springs/South Fremont", "abbr":"RICH-WARM", "routeID":"ROUTE 4", "number":"4", "hexcolor":"#ff9933", "color":"#ff9933", "direction":"South" }, { "name":"Richmond - Daly City/Millbrae", "abbr":"RICH-MLBR", "routeID":"ROUTE 7", "number":"7", "hexcolor":"", "color":"#ff0000", "direction":"South" }, { "name":"Millbrae/SFIA - Pittsburg/Bay Point", "abbr":"SFIA-PITT", "routeID":"ROUTE 2", "number":"2", "hexcolor":"#ffff33", "color":"#ffff33", "direction":"North" }, { "name":"Coliseum - Oakland Int'l Airport", "abbr":"COLS-OAKL", "routeID":"ROUTE 19", "number":"19", "hexcolor":"#d5cfa3", "color":"#d5cfa3", "direction":"North" }, { "name":"Oakland Int'l Airport - Coliseum", "abbr":"OAKL-COLS", "routeID":"ROUTE 20", "number":"20", "hexcolor":"#d5cfa3", "color":"#d5cfa3", "direction":"South" } ] }, "message":"" } }
Notes
- There are no additional notes.
Usage
XML: https://api.bart.gov/api/route.aspx?cmd=routes&key=INSERT-KEY
JSON: https://api.bart.gov/api/route.aspx?cmd=routes&key=INSERT-KEY&json=y