Schedule Information API
Command: depart
Inputs
Parameter | Description |
---|---|
cmd=depart | Requests a trip based on departing at the time specified. (Required) |
key=<key> | API registration key. (Required) |
orig=<station> | Specifies the origination station. Stations should be specified using the four character abbreviations. (Required) |
dest=<station> | Specifies the destination station. Stations should be specified using the four character abbreviations. (Required) |
time=h:mm+am/pm | Specifies the departure time for the trip. Using "time=now" is also valid and will return the specified trips based on the current time. If not specified, defaults to the current time. (Optional) |
date=<mm/dd/yyyy> | Specifies a specific date to use for calculating the trip. If not specified, the current date will be used. Also the terms "now" or "today" may be used instead of "mm/dd/yyyy". The date range period is 10 days in the past and 8 weeks in future. (Optional) |
b=<number> | This allows specifying how many trips before the specified time should be returned. This parameter defaults to 2, and can be set between 0 and 3. (Optional) |
a=<number> | This allows specifying how many trips after the specified time should be returned. This parameter defaults to 2, and can be set between 1 and 3. (Optional) |
Sum of a & b | Sum of a and b has to be less or equal to 6. These parameters defaults to 3 each if sum of a and b is more than 6 |
l=<number> | Specifies whether the legend information should be included. By default it is 0 (not shown), but can be turned on by setting it to 1. (Optional) |
json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
None.
Results
XML Sample
<?xml version="1.0" encoding="utf-8"?> <root> <uri> <![CDATA[https://api.bart.gov/api/sched.aspx?cmd=depart&orig=ASHB&dest=CIVC&date=now&b=2&a=2&l=1]]> </uri> <origin>ASHB</origin> <destination>CIVC</destination> <sched_num>45</sched_num> <schedule> <date>Jan 2, 2018</date> <time>10:09 AM</time> <before>2</before> <after>2</after> <request> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="9:57 AM" origTimeDate="01/02/2018 " destTimeMin="10:22 AM" destTimeDate="01/02/2018" clipper="1.45" tripTime="25"> <fares level="normal"> <fare amount="3.95" class="clipper" name="Clipper"/> <fare amount="4.45" class="cash" name="BART Blue Ticket"/> <fare amount="1.45" class="rtcclipper" name="Senior/Disabled Clipper"/> <fare amount="1.95" class="student" name="Youth Clipper"/> <fare amount="3.25" class="start" name="Clipper START"/> </fares> <leg order="1" transfercode="" origin="ASHB" destination="CIVC" origTimeMin="9:57 AM" origTimeDate="01/02/2018" destTimeMin="10:22 AM" destTimeDate="01/02/2018" line="ROUTE 7" bikeflag="1" trainHeadStation="Millbrae" load="1" trainId="4430942" trainIdx="23"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="10:05 AM" origTimeDate="01/02/2018 " destTimeMin="10:29 AM" destTimeDate="01/02/2018" clipper="1.45" tripTime="24"> <fares level="normal"> <fare amount="3.95" class="clipper" name="Clipper"/> <fare amount="4.45" class="cash" name="BART Blue Ticket"/> <fare amount="1.45" class="rtcclipper" name="Senior/Disabled Clipper"/> <fare amount="1.95" class="student" name="Youth Clipper"/> <fare amount="3.25" class="start" name="Clipper START"/> </fares> <leg order="1" transfercode="S" origin="ASHB" destination="MCAR" origTimeMin="10:05 AM" origTimeDate="01/02/2018" destTimeMin="10:08 AM" destTimeDate="01/02/2018" line="ROUTE 4" bikeflag="1" trainHeadStation="Warm Springs/South Fremont" load="2" trainId="2250950" trainIdx="23"/> <leg order="2" transfercode="" origin="MCAR" destination="CIVC" origTimeMin="10:08 AM" origTimeDate="01/02/2018" destTimeMin="10:29 AM" destTimeDate="01/02/2018" line="ROUTE 1" bikeflag="1" trainHeadStation="San Francisco International Airport" load="2" trainId="3790932" trainIdx="37"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="10:12 AM" origTimeDate="01/02/2018 " destTimeMin="10:37 AM" destTimeDate="01/02/2018" clipper="1.45" tripTime="25"> <fares level="normal"> <fare amount="3.95" class="clipper" name="Clipper"/> <fare amount="4.45" class="cash" name="BART Blue Ticket"/> <fare amount="1.45" class="rtcclipper" name="Senior/Disabled Clipper"/> <fare amount="1.95" class="student" name="Youth Clipper"/> <fare amount="3.25" class="start" name="Clipper START"/> </fares> <leg order="1" transfercode="" origin="ASHB" destination="CIVC" origTimeMin="10:12 AM" origTimeDate="01/02/2018" destTimeMin="10:37 AM" destTimeDate="01/02/2018" line="ROUTE 7" bikeflag="1" trainHeadStation="Millbrae" load="1" trainId="4450957" trainIdx="24"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="10:20 AM" origTimeDate="01/02/2018 " destTimeMin="10:44 AM" destTimeDate="01/02/2018" clipper="1.45" tripTime="24"> <fares level="normal"> <fare amount="3.95" class="clipper" name="Clipper"/> <fare amount="4.45" class="cash" name="BART Blue Ticket"/> <fare amount="1.45" class="rtcclipper" name="Senior/Disabled Clipper"/> <fare amount="1.95" class="student" name="Youth Clipper"/> <fare amount="3.25" class="start" name="Clipper START"/> </fares> <leg order="1" transfercode="S" origin="ASHB" destination="MCAR" origTimeMin="10:20 AM" origTimeDate="01/02/2018" destTimeMin="10:23 AM" destTimeDate="01/02/2018" line="ROUTE 4" bikeflag="1" trainHeadStation="Warm Springs/South Fremont" load="2" trainId="2271005" trainIdx="24"/> <leg order="2" transfercode="" origin="MCAR" destination="CIVC" origTimeMin="10:23 AM" origTimeDate="01/02/2018" destTimeMin="10:44 AM" destTimeDate="01/02/2018" line="ROUTE 1" bikeflag="1" trainHeadStation="San Francisco International Airport" load="2" trainId="3810947" trainIdx="38"/> </trip> </request> </schedule> <message> <legend>bikeflag: 1 = bikes allowed. 0 = no bikes allowed. transfercode: blank = no transfer, N = normal transfer, T = timed transfer, connecting trains will wait up to five minutes for transferring passengers. S = scheduled transfer, connecting trains will not wait for transferring passengers if there is a delay.</legend> </message> </root>
JSON Sample
{ "?xml":{ "@version":"1.0", "@encoding":"utf-8" }, "root":{ "@id":"1", "uri":{ "#cdata-section":"https://api.bart.gov/api/sched.aspx?cmd=depart&orig=ASHB&dest=CIVC&date=now&b=2&a=2&l=1&json=y" }, "origin":"ASHB", "destination":"CIVC", "sched_num":"45", "schedule":{ "date":"Jan 2, 2018", "time":"10:10 AM", "before":"2", "after":"2", "request":{ "trip":[ { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"9:57 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"10:22 AM", "@destTimeDate":"01/02/2018", "@clipper":"1.45", "@tripTime":"25", "fares":{ "@level":"normal", "fare":[ { "@amount":"3.95", "@class":"clipper", "@name":"Clipper" }, { "@amount":"4.45", "@class":"cash", "@name":"BART Blue Ticket" }, { "@amount":"1.45", "@class":"rtcclipper", "@name":"Senior/Disabled Clipper" }, { "@amount":"1.95", "@class":"student", "@name":"Youth Clipper" }, { "@amount":"3.25", "@class":"start", "@name":"Clipper START" } ] }, "leg":[ { "@order":"1", "@transfercode":"", "@origin":"ASHB", "@destination":"CIVC", "@origTimeMin":"9:57 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:22 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 7", "@bikeflag":"1", "@trainHeadStation":"Millbrae", "@load":"1", "@trainId":"4430942", "@trainIdx":"23" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"10:05 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"10:29 AM", "@destTimeDate":"01/02/2018", "@clipper":"1.45", "@tripTime":"24", "fares":{ "@level":"normal", "fare":[ { "@amount":"3.95", "@class":"clipper", "@name":"Clipper" }, { "@amount":"4.45", "@class":"cash", "@name":"BART Blue Ticket" }, { "@amount":"1.45", "@class":"rtcclipper", "@name":"Senior/Disabled Clipper" }, { "@amount":"1.95", "@class":"student", "@name":"Youth Clipper" }, { "@amount":"3.25", "@class":"start", "@name":"Clipper START" } ] }, "leg":[ { "@order":"1", "@transfercode":"S", "@origin":"ASHB", "@destination":"MCAR", "@origTimeMin":"10:05 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:08 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 4", "@bikeflag":"1", "@trainHeadStation":"Warm Springs/South Fremont", "@load":"2", "@trainId":"2250950", "@trainIdx":"23" }, { "@order":"2", "@transfercode":"", "@origin":"MCAR", "@destination":"CIVC", "@origTimeMin":"10:08 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:29 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 1", "@bikeflag":"1", "@trainHeadStation":"San Francisco International Airport", "@load":"2", "@trainId":"3790932", "@trainIdx":"37" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"10:12 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"10:37 AM", "@destTimeDate":"01/02/2018", "@clipper":"1.45", "@tripTime":"25", "fares":{ "@level":"normal", "fare":[ { "@amount":"3.95", "@class":"clipper", "@name":"Clipper" }, { "@amount":"4.45", "@class":"cash", "@name":"BART Blue Ticket" }, { "@amount":"1.45", "@class":"rtcclipper", "@name":"Senior/Disabled Clipper" }, { "@amount":"1.95", "@class":"student", "@name":"Youth Clipper" }, { "@amount":"3.25", "@class":"start", "@name":"Clipper START" } ] }, "leg":[ { "@order":"1", "@transfercode":"", "@origin":"ASHB", "@destination":"CIVC", "@origTimeMin":"10:12 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:37 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 7", "@bikeflag":"1", "@trainHeadStation":"Millbrae", "@load":"1", "@trainId":"4450957", "@trainIdx":"24" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"10:20 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"10:44 AM", "@destTimeDate":"01/02/2018", "@clipper":"1.45", "@tripTime":"24", "fares":{ "@level":"normal", "fare":[ { "@amount":"3.95", "@class":"clipper", "@name":"Clipper" }, { "@amount":"4.45", "@class":"cash", "@name":"BART Blue Ticket" }, { "@amount":"1.45", "@class":"rtcclipper", "@name":"Senior/Disabled Clipper" }, { "@amount":"1.95", "@class":"student", "@name":"Youth Clipper" }, { "@amount":"3.25", "@class":"start", "@name":"Clipper START" } ] }, "leg":[ { "@order":"1", "@transfercode":"S", "@origin":"ASHB", "@destination":"MCAR", "@origTimeMin":"10:20 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:23 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 4", "@bikeflag":"1", "@trainHeadStation":"Warm Springs/South Fremont", "@load":"2", "@trainId":"2271005", "@trainIdx":"24" }, { "@order":"2", "@transfercode":"", "@origin":"MCAR", "@destination":"CIVC", "@origTimeMin":"10:23 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"10:44 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 1", "@bikeflag":"1", "@trainHeadStation":"San Francisco International Airport", "@load":"2", "@trainId":"3810947", "@trainIdx":"38" } ] } ] } }, "message":{ "legend":"bikeflag: 1 = bikes allowed. 0 = no bikes allowed. transfercode: blank = no transfer, N = normal transfer, T = timed transfer, connecting trains will wait up to five minutes for transferring passengers. S = scheduled transfer, connecting trains will not wait for transferring passengers if there is a delay." } } }
Notes
- The "fare" and "clipper" attributes of the <trip> element are deprecated, and the <fares> element should be used instead.
- Trips can contain from 1 to 3 legs, depending on the number of transfers that are required.
- Fare clases may change, but should always include a "cash" fare along with any other discount classes.
- The Fare "name" attribute is the official BART name for the fare and should be used when displaying the fare.
- The "level" attribute of the <fares> element is for future use and will currently always have a value of "normal".
- Special schedule messages will only be displayed if the trip date, time, and orig or dest stations match a special schedule notice.
- Any error messages will be included in an <error> item under the <message> element.
Usage
XML: https://api.bart.gov/api/sched.aspx?cmd=depart&orig=ASHB&dest=CIVC&date=now&key=INSERT-KEY&b=2&a=2&l=1
JSON: https://api.bart.gov/api/sched.aspx?cmd=depart&orig=ASHB&dest=CIVC&date=now&key=INSERT-KEY&b=2&a=2&l=1&json=y