Schedule Information API
Command: fare
Inputs
| Parameter | Description |
|---|---|
| cmd=fare | Requests the fare information for a trip between two stations. (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) |
| date=<mm/dd/yyyy> | Specifies a specific date to use for calculating the fare. If not specified, the current date will be used. Also the terms "now" or "today" may be used instead of "mm/dd/yyyy". (Optional) |
| sched=<number> | Specifies a specific schedule to use. (Optional) |
| json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
- The optional "date" and "sched" parameters should not be used together. If they are, the date will be ignored, and the sched parameter will be used.
Results
XML Sample
<?xml version="1.0" encoding="utf-8"?>
<root>
<uri>
<![CDATA[https://api.bart.gov/api/sched.aspx?cmd=fare&orig=12th&dest=embr&date=today]]>
</uri>
<origin>12TH</origin>
<destination>EMBR</destination>
<sched_num>45</sched_num>
<trip>
<fare>4.00</fare>
<discount>
<clipper>1.30</clipper>
</discount>
</trip>
<fares level="normal">
<fare amount="3.50" class="clipper" name="Clipper"/>
<fare amount="4.00" class="cash" name="BART Blue Ticket"/>
<fare amount="1.30" class="rtcclipper" name="Senior/Disabled Clipper"/>
<fare amount="1.75" class="student" name="Youth Clipper"/>
<fare amount="3.25" class="start" name="Clipper START"/>
</fares>
</root>
JSON Sample
{
"?xml":{
"@version":"1.0",
"@encoding":"utf-8"
},
"root":{
"uri":{
"#cdata-section":"https://api.bart.gov/api/sched.aspx?cmd=fare&orig=12th&dest=embr&date=today&json=y"
},
"origin":"12TH",
"destination":"EMBR",
"sched_num":"45",
"trip":{
"fare":"4.00",
"discount":{
"clipper":"1.30"
}
},
"fares":{
"@level":"normal",
"fare":[
{
"@amount":"3.50",
"@class":"clipper",
"@name":"Clipper"
},
{
"@amount":"4.00",
"@class":"cash",
"@name":"BART Blue Ticket"
},
{
"@amount":"1.30",
"@class":"rtcclipper",
"@name":"Senior/Disabled Clipper"
},
{
"@amount":"1.75",
"@class":"student",
"@name":"Youth Clipper"
},
{
"@amount":"3.25",
"@class":"start",
"@name":"Clipper START"
}
}
}
Notes
- The <trip> element has been deprecated, and the <fares> element should be used instead.
- 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".
- Any error messages will be included in an <error> item under the <message> element.
Usage
XML: https://api.bart.gov/api/sched.aspx?cmd=fare&orig=12th&dest=embr&date=today&key=INSERT-KEY
JSON: https://api.bart.gov/api/sched.aspx?cmd=fare&orig=12th&dest=embr&date=today&key=INSERT-KEY&json=y
