Route Information API
Command: routeinfo
Inputs
Parameter | Description |
---|---|
cmd=routeinfo | Requests detailed information for a specific route. (Required) |
key=<key> | API registration key. (Required) |
route=<route_num> | Specifies the specific route information to return. In addition to route number (i.e. 1, 2, ... 12) 'all' can be specified to get the configuration information for all routes. (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 routes 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 is sometimes updated with schedule changes as routes are reconfigured. This may affect the name and abbreviation of the route, as well as the number of stations.
Results
XML Sample
<?xml version="1.0" encoding="utf-8"?> <root> <uri> <![CDATA[https://api.bart.gov/api/route.aspx?cmd=routeinfo&route=6]]> </uri> <routes> <route> <name>Daly City - Warm Springs/South Fremont</name> <abbr>DALY-WARM</abbr> <routeID>ROUTE 6</routeID> <number>6</number> <origin>DALY</origin> <destination>WARM</destination> <direction></direction> <hexcolor>#339933</hexcolor> <color>#339933</color> <num_stns>20</num_stns> <config> <station>DALY</station> <station>BALB</station> <station>GLEN</station> <station>24TH</station> <station>16TH</station> <station>CIVC</station> <station>POWL</station> <station>MONT</station> <station>EMBR</station> <station>WOAK</station> <station>LAKE</station> <station>FTVL</station> <station>COLS</station> <station>SANL</station> <station>BAYF</station> <station>HAYW</station> <station>SHAY</station> <station>UCTY</station> <station>FRMT</station> <station>WARM</station> </config> </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=routeinfo&route=6&json=y" }, "routes":{ "route":{ "name":"Daly City - Warm Springs/South Fremont", "abbr":"DALY-WARM", "routeID":"ROUTE 6", "number":"6", "origin":"DALY", "destination":"WARM", "direction":"", "hexcolor":"#339933", "color":"#339933", "num_stns":"20", "config":{ "station":[ "DALY", "BALB", "GLEN", "24TH", "16TH", "CIVC", "POWL", "MONT", "EMBR", "WOAK", "LAKE", "FTVL", "COLS", "SANL", "BAYF", "HAYW", "SHAY", "UCTY", "FRMT", "WARM" ] } } }, "message":null } }
Notes
- The configuration section lists the stations along the route in order from origin to destination.
Usage
XML: https://api.bart.gov/api/route.aspx?cmd=routeinfo&route=6&key=INSERT-KEY
JSON: https://api.bart.gov/api/route.aspx?cmd=routeinfo&route=6&key=INSERT-KEY&json=y