Schedule Information API
Command: arrive
Inputs
Parameter | Description |
---|---|
cmd=arrive | Requests a trip based on arriving 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 arrival 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. 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". The default is the current date. 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=arrive&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>9:49 AM</time> <before>2</before> <after>2</after> <request> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="9:12 AM" origTimeDate="01/02/2018 " destTimeMin="9: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="9:12 AM" origTimeDate="01/02/2018" destTimeMin="9:37 AM" destTimeDate="01/02/2018" line="ROUTE 7" bikeflag="1" trainHeadStation="Millbrae" load="2" trainId="4590857" trainIdx="20"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="9:20 AM" origTimeDate="01/02/2018 " destTimeMin="9: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="9:20 AM" origTimeDate="01/02/2018" destTimeMin="9:23 AM" destTimeDate="01/02/2018" line="ROUTE 4" bikeflag="1" trainHeadStation="Warm Springs/South Fremont" load="2" trainId="2390905" trainIdx="20"/> <leg order="2" transfercode="" origin="MCAR" destination="CIVC" origTimeMin="9:23 AM" origTimeDate="01/02/2018" destTimeMin="9:44 AM" destTimeDate="01/02/2018" line="ROUTE 1" bikeflag="1" trainHeadStation="San Francisco International Airport" load="2" trainId="3730847" trainIdx="34"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="9:27 AM" origTimeDate="01/02/2018 " destTimeMin="9:52 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:27 AM" origTimeDate="01/02/2018" destTimeMin="9:52 AM" destTimeDate="01/02/2018" line="ROUTE 7" bikeflag="1" trainHeadStation="Millbrae" load="1" trainId="4610912" trainIdx="21"/> </trip> <trip origin="ASHB" destination="CIVC" fare="4.45" origTimeMin="9:35 AM" origTimeDate="01/02/2018 " destTimeMin="9:59 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="9:35 AM" origTimeDate="01/02/2018" destTimeMin="9:38 AM" destTimeDate="01/02/2018" line="ROUTE 4" bikeflag="1" trainHeadStation="Warm Springs/South Fremont" load="1" trainId="2210920" trainIdx="21"/> <leg order="2" transfercode="" origin="MCAR" destination="CIVC" origTimeMin="9:38 AM" origTimeDate="01/02/2018" destTimeMin="9:59 AM" destTimeDate="01/02/2018" line="ROUTE 1" bikeflag="1" trainHeadStation="San Francisco International Airport" load="2" trainId="3750902" trainIdx="35"/> </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=arrive&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":"9:51 AM", "before":"2", "after":"2", "request":{ "trip":[ { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"9:12 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"9: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":"9:12 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:37 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 7", "@bikeflag":"1", "@trainHeadStation":"Millbrae", "@load":"2", "@trainId":"4590857", "@trainIdx":"20" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"9:20 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"9: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":"9:20 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:23 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 4", "@bikeflag":"1", "@trainHeadStation":"Warm Springs/South Fremont", "@load":"2", "@trainId":"2390905", "@trainIdx":"20" }, { "@order":"2", "@transfercode":"", "@origin":"MCAR", "@destination":"CIVC", "@origTimeMin":"9:23 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:44 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 1", "@bikeflag":"1", "@trainHeadStation":"San Francisco International Airport", "@load":"2", "@trainId":"3730847", "@trainIdx":"34" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"9:27 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"9:52 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:27 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:52 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 7", "@bikeflag":"1", "@trainHeadStation":"Millbrae", "@load":"1", "@trainId":"4610912", "@trainIdx":"21" } ] }, { "@origin":"ASHB", "@destination":"CIVC", "@fare":"4.45", "@origTimeMin":"9:35 AM", "@origTimeDate":"01/02/2018 ", "@destTimeMin":"9:59 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":"9:35 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:38 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 4", "@bikeflag":"1", "@trainHeadStation":"Warm Springs/South Fremont", "@load":"1", "@trainId":"2210920", "@trainIdx":"21" }, { "@order":"2", "@transfercode":"", "@origin":"MCAR", "@destination":"CIVC", "@origTimeMin":"9:38 AM", "@origTimeDate":"01/02/2018", "@destTimeMin":"9:59 AM", "@destTimeDate":"01/02/2018", "@line":"ROUTE 1", "@bikeflag":"1", "@trainHeadStation":"San Francisco International Airport", "@load":"2", "@trainId":"3750902", "@trainIdx":"35" } ] } ] } }, "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 4 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=arrive&orig=ASHB&dest=CIVC&date=now&key=INSERT-KEY&b=2&a=2&l=1
JSON: https://api.bart.gov/api/sched.aspx?cmd=arrive&orig=ASHB&dest=CIVC&date=now&key=INSERT-KEY&b=2&a=2&l=1&json=y