Real-Time Information API
Command: etd
Inputs
Parameter | Description |
---|---|
cmd=etd | Requests current departure information. (Required) |
orig=<station> | Specifies the station. Stations are referenced by their abbreviations. You can also use 'ALL' to get all of the current ETD's. (Required) |
key=<key> | API registration key. (Required) |
plat=<platform> | This will limit results to a specific platform. Valid platforms depend on the station, but can range from 1-4. (Optional) |
dir=<dir> | This will limit results to a specific direction. Valid directions are 'n' for Northbound and 's' for Southbound. (Optional) |
gbColor=1 | Value of "1" will sort the response by line / line color. Value of "0" is default sort is by destination.(Optional) |
json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
The optional parameters 'plat' and 'dir' should not be used together. If they are, then the 'dir' parameter will be ignored and just the platform parameter will be used.
If 'ALL' is used for the orig station, then 'plat' and 'dir' cannot be used.
Results
XML Sample
<?xml version="1.0" encoding="utf-8"?> <root> <uri> <![CDATA[https://api.bart.gov/api/etd.aspx?cmd=etd&orig=RICH]]> </uri> <date>01/20/2021</date> <time>08:13:44 AM PDT</time> <station> <name>Richmond</name> <abbr>RICH</abbr> <etd> <destination>Fremont</destination> <abbreviation>FRMT</abbreviation> <limited>0</limited> <estimate> <minutes>Leaving</minutes> <platform>2</platform> <direction>South</direction> <length>4</length> <color>ORANGE</color> <hexcolor>#ff9933</hexcolor> <bikeflag>1</bikeflag> <delay>238</delay> <cancelflag>1</cancelflag> <dynamicflag>0</dynamicflag> </estimate> <estimate> <minutes>12</minutes> <platform>2</platform> <direction>South</direction> <length>4</length> <color>ORANGE</color> <hexcolor>#ff9933</hexcolor> <bikeflag>1</bikeflag> <delay>0</delay> <cancelflag>0</cancelflag> <dynamicflag>1</dynamicflag> </estimate> <estimate> <minutes>27</minutes> <platform>2</platform> <direction>South</direction> <length>4</length> <color>ORANGE</color> <hexcolor>#ff9933</hexcolor> <bikeflag>1</bikeflag> <delay>0</delay> <cancelflag>0</cancelflag> <dynamicflag>0</dynamicflag> </estimate> </etd> <etd> <destination>Millbrae</destination> <abbreviation>MLBR</abbreviation> <limited>0</limited> <estimate> <minutes>4</minutes> <platform>2</platform> <direction>South</direction> <length>4</length> <color>RED</color> <hexcolor>#ff0000</hexcolor> <bikeflag>1</bikeflag> <delay>0</delay> <cancelflag>0</cancelflag> <dynamicflag>0</dynamicflag> </estimate> <estimate> <minutes>19</minutes> <platform>2</platform> <direction>South</direction> <length>5</length> <color>RED</color> <hexcolor>#ff0000</hexcolor> <bikeflag>1</bikeflag> <delay>0</delay> <cancelflag>0</cancelflag> <dynamicflag>0</dynamicflag> </estimate> <estimate> <minutes>34</minutes> <platform>2</platform> <direction>South</direction> <length>5</length> <color>RED</color> <hexcolor>#ff0000</hexcolor> <bikeflag>1</bikeflag> <delay>0</delay> <cancelflag>0</cancelflag> <dynamicflag>0</dynamicflag> </estimate> </etd> </station> <message></message> </root>
JSON Sample
{ "?xml":{ "@version":"1.0", "@encoding":"utf-8" }, "root":{ "@id":"1", "uri":{ "#cdata-section":"https://api.bart.gov/api/etd.aspx?cmd=etd&orig=RICH&json=y" }, "date":"01/20/2021", "time":"08:13:44 AM PDT", "station":[ { "name":"Richmond", "abbr":"RICH", "etd":[ { "destination":"Fremont", "abbreviation":"FRMT", "limited":"0", "estimate":[ { "minutes":"1", "platform":"2", "direction":"South", "length":"4", "color":"ORANGE", "hexcolor":"#ff9933", "bikeflag":"1", "delay":"238" "cancelflag":"1" "dynamicflag":"0" }, { "minutes":"13", "platform":"2", "direction":"South", "length":"4", "color":"ORANGE", "hexcolor":"#ff9933", "bikeflag":"1", "delay":"0" "cancelflag":"0" "dynamicflag":"1" }, { "minutes":"28", "platform":"2", "direction":"South", "length":"4", "color":"ORANGE", "hexcolor":"#ff9933", "bikeflag":"1", "delay":"0" "cancelflag":"0" "dynamicflag":"0" } ] }, { "destination":"Millbrae", "abbreviation":"MLBR", "limited":"0", "estimate":[ { "minutes":"6", "platform":"2", "direction":"South", "length":"4", "color":"RED", "hexcolor":"#ff0000", "bikeflag":"1", "delay":"0" "cancelflag":"0" "dynamicflag":"0" }, { "minutes":"21", "platform":"2", "direction":"South", "length":"5", "color":"RED", "hexcolor":"#ff0000", "bikeflag":"1", "delay":"0" "cancelflag":"0" "dynamicflag":"0" }, { "minutes":"36", "platform":"2", "direction":"South", "length":"5", "color":"RED", "hexcolor":"#ff0000", "bikeflag":"1", "delay":"0" "cancelflag":"0" "dynamicflag":"0" } ] } ] } ], "message":"" } }
Notes
- <delay> is provided in seconds off the original scheduled departure time.
- <cancelflag> indicates a scheduled ETD that has been cancelled and is not in service.
- <dynamicflag> indicates an unscheduled ETD that has been added to service.
- If the combination of 'platform' or 'dir' results in no ETD data, a warning message will be displayed.
Usage
XML: https://api.bart.gov/api/etd.aspx?cmd=etd&orig=RICH&key=INSERT-KEY
JSON: https://api.bart.gov/api/etd.aspx?cmd=etd&orig=RICH&key=INSERT-KEY&json=y