Route Information API

Command: routes

Inputs

Parameter Description
cmd=routes Requests information regarding current lines. (Required)
key=<key> API registration key. (Required)
sched=<sched_num> Specifies a specific schedule to use. Defaults to current schedule. (Optional)
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

Results

XML Sample

<?xml version="1.0" encoding="utf-8" ?> 
<root>
  <uri><![CDATA[ http://api.bart.gov/api/route.aspx?cmd=routes ]]></uri>
  <sched_num>26</sched_num> 
  <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> 
    </route>
    ...
  </routes>
  <message /> 
</root>

JSON Sample

{
   "?xml":{
      "@version":"1.0",
      "@encoding":"utf-8"
   },
   "root":{
      "uri":{
         "#cdata-section":"http://api.bart.gov/api/route.aspx?cmd=routes&json=y"
      },
      "sched_num":"43",
      "routes":{
         "route":[
            {
               "name":"Pittsburg/Bay Point - SFIA/Millbrae",
               "abbr":"PITT-SFIA",
               "routeID":"ROUTE 1",
               "number":"1",
               "hexcolor":"#ffff33",
               "color":"#ffff33"
            },
            {
               "name":"Daly City - Dublin/Pleasanton",
               "abbr":"DALY-DUBL",
               "routeID":"ROUTE 12",
               "number":"12",
               "hexcolor":"#0099cc",
               "color":"#0099cc"
            },
            {
               "name":"Daly City - Warm Springs/South Fremont",
               "abbr":"DALY-WARM",
               "routeID":"ROUTE 6",
               "number":"6",
               "hexcolor":"#339933",
               "color":"#339933"
            },
            {
               "name":"Dublin/Pleasanton - Daly City",
               "abbr":"DUBL-DALY",
               "routeID":"ROUTE 11",
               "number":"11",
               "hexcolor":"#0099cc",
               "color":"#0099cc"
            },
            {
               "name":"Warm Springs/South Fremont - Daly City",
               "abbr":"WARM-DALY",
               "routeID":"ROUTE 5",
               "number":"5",
               "hexcolor":"#339933",
               "color":"#339933"
            },
            {
               "name":"Warm Springs/South Fremont - Richmond",
               "abbr":"WARM-RICH",
               "routeID":"ROUTE 3",
               "number":"3",
               "hexcolor":"#ff9933",
               "color":"#ff9933"
            },
            {
               "name":"Millbrae/Daly City - Richmond",
               "abbr":"MLBR-RICH",
               "routeID":"ROUTE 8",
               "number":"8",
               "hexcolor":"#ff0000",
               "color":"#ff0000"
            },
            {
               "name":"Richmond - Warm Springs/South Fremont",
               "abbr":"RICH-WARM",
               "routeID":"ROUTE 4",
               "number":"4",
               "hexcolor":"#ff9933",
               "color":"#ff9933"
            },
            {
               "name":"Richmond - Daly City/Millbrae",
               "abbr":"RICH-MLBR",
               "routeID":"ROUTE 7",
               "number":"7",
               "hexcolor":"",
               "color":"#ff0000"
            },
            {
               "name":"Millbrae/SFIA - Pittsburg/Bay Point",
               "abbr":"SFIA-PITT",
               "routeID":"ROUTE 2",
               "number":"2",
               "hexcolor":"#ffff33",
               "color":"#ffff33"
            },
            {
               "name":"Coliseum - Oakland Int'l Airport",
               "abbr":"COLS-OAKL",
               "routeID":"ROUTE 19",
               "number":"19",
               "hexcolor":"#d5cfa3",
               "color":"#d5cfa3"
            },
            {
               "name":"Oakland Int'l Airport - Coliseum",
               "abbr":"OAKL-COLS",
               "routeID":"ROUTE 20",
               "number":"20",
               "hexcolor":"#d5cfa3",
               "color":"#d5cfa3"
            }
         ]
      },
      "message":""
   }
}

Notes

WARNING: the current "color" value is incorrect, it should be a text value (e.g. "ORANGE"). Please use the "hexcolor" value until the color value has been changed.

Usage

XML: http://api.bart.gov/api/route.aspx?cmd=routes&key=MW9S-E7SL-26DU-VV8V
JSON: http://api.bart.gov/api/route.aspx?cmd=routes&key=MW9S-E7SL-26DU-VV8V&json=y