
Instructions.
Use the instructions to link the timetable to your website in just a few steps.
- Deep Linking means calling up the webshop on sbb.ch using a URL. The path and the parameters of the URL can be used to transfer data to the application. Deeplinking is provided for the Timetable and the Webshop.
- All parameters of type String must be encoded in UTF-8 with "Percent Encoding" (RFC-3986), unless specified differently (e.g. Base64).
- All parameters are case sensitive. For combined words the lower camel case is used (for example lowerCamelCase).
- Empty or not specified parameters are ignored
- The following deep links are supported
https schema German https://www.sbb.ch/de/kaufen/
https schema French https://www.sbb.ch/fr/acheter/
https schema Italian https://www.sbb.ch/it/acquistare/
https schema English https://www.sbb.ch/en/buying/
- The schema must be adjusted in order to work with our test instance
https test schema German https://test-www.sbb.ch/de/kaufen/Link opens in new window.
https test schema French https://test-www.sbb.ch/fr/acheter/Link opens in new window.
https test schema Italian https://test-www.sbb.ch/it/acquistare/Link opens in new window.
https test schema English https://test-www.sbb.ch/en/buying/Link opens in new window. - The interface to be called is called exclusively via https and no http redirects are followed.
- Depending on the Browser used by the customer different levels of URL encoding are needed. We found that most browsers need braces and quotation marks URL encoded.
- Parameters and strings in arrays need to be put in quotation marks. For example: name=Basel SBB needs to be in quotation marks – “name”=„Basel SBB“. See therefore JSON-notation.
All partners linking to the timetable must use the following wording on their website in the language of their site. Sites in a language not shown underneath should use the English wording:
- German: SBB Fahrplan, bitte hier klicken
- French: Horaire CFF, cliquez ici svp
- Italian: Orario FFS, per favore cliccare qui
- English: SBB Timetable, please click here
URL structure and parameters.
https://www.sbb.ch/de/kaufen/pages/fahrplan/fahrplan.xhtml
https://www.sbb.ch/fr/acheter/pages/fahrplan/fahrplan.xhtml
https://www.sbb.ch/it/acquistare/pages/fahrplan/fahrplan.xhtml
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml
Name |
Type |
Values / Format |
Example |
Description |
Default value for optional parameters |
Example URL |
---|---|---|---|---|---|---|
von |
String |
n/a |
von=Zürich+HB |
Departure stop, address or POI |
empty |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?von=Z%C3%BCrich+HB |
nach |
String |
n/a |
nach=3014+Bern%2C+Wylerstrasse+123 |
Arrival stop, address or POI |
empty |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?nach=3014+Bern%2C+Wylerstrasse+123 |
vias |
Array |
n/a |
vias=[“Bern”] |
Via stop for use of complex parameter or multiple vias see 2.2.1 |
empty |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?vias=%5B%22Bern%22%5D |
name
|
String |
String |
Name=”Biel/Bienne” |
sub parameter in vias Via stop, address or POI. Needs to be in quotation marks. |
empty |
See chapter vias |
dauer |
Time |
HH:mm |
dauer=”12:00” |
sub parameter in vias Duration of the via stop. Needs to be in quotation marks. |
empty |
See chapter vias |
datum |
Date |
dd.MM.yyyy |
datum=01.12.2017 |
Date of desired departure or arrival. |
current date |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?datum=01.12.2017 |
zeit |
Time
|
HH:mm |
zeit=12:00 |
Time of desired departure or arrival. |
current time |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?zeit=12:00 |
an |
Boolean |
true=departure false=arrival |
an=true |
Information on whether the time given refers to departure or arrival. |
departure |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?an=true |
verbindungSuche |
Boolean |
true=search false=don’t execute search |
suche=true |
Execution of the search for connection |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?verbindungSuche=true |
erweiterteSuche |
Boolean |
true =extended search is shown false=extended search is not shown |
erweiterteSuche=true |
Decides whether extended search is shown or not |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?erweiterteSuche=true |
verkehrsmittel |
Array |
n/a
|
verkehrsmittel=[“ic_ec“] |
Preselects the specified means of transportation. |
Array containing all possible means of transportation |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?verkehrsmittel=[“ic_ec“] |
optionen |
Enumeration |
all | direct | sleepingcart | couchette |
optionen=direct |
Limits resulting connections as follows. direct: Only direct connections from origin to destination, without any intermediary stops sleepingcart: Only connections where one can use sleeping carts couchete: Only connections where one can use couchettes all: All connections are acceptable. |
all |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?optionen=direct |
barrierefrei |
Enumeration |
norestriction | withrestriction | self | helped | announcement |
barrierefrei=self |
Only returns connections allowing for barrier-free travel: withrestriction: Connections supporting barrier-free travel. self: Independent boarding/alighting possible. helped: Driving staff will assist with boarding/alighting. announcement: Boarding/alighting possible upon prior announcement. norestriction: |
norestriction |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?barrierfree=self |
belegung |
Enumeration |
firstlow | firstmedium | firsthigh | secondlow | secondmedium | secondhigh |
belegung=secondmedium |
Only returns connections with an expected maximum occupancy. firstlow: Returns connections with low occupancy in the first class. firstmedium: Returns connections with low or medium occupancy in the first class. firsthigh: Returns connections with low, medium or high occupancy in the first class. secondlow: Returns connections with low occupancy in the second class. secondmedium: Returns connections with low or medium occupancy in the second class. secondhigh: Returns connections with low, medium or high occupancy in the second class. |
secondhigh |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?belegung=secondlow |
velo |
Boolean |
true = show only connections allowing bike carriage |
velo=true |
Only show connections that allow for bike carriage. |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?velo=true |
gruppenreisen |
Boolean |
true = show only connections allowing group travel |
gruppenreisen=true |
Only show connections that support group travel. |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?gruppenreisen=true |
ohneneigezuege |
Boolean |
true = exclude connections with tilting trains |
ohneneigezuege=true |
Only show connections which do not use tilting trains. |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?ohneneigezuege=true |
alternativverbindungen |
Boolean |
true = search for additional connections |
alternativverbindungen=true |
Also include alternative connections in the result set. |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?alternativeverbindungen=true |
alternativestops |
Boolean |
true = search for additional connections from/to stops nearby origin or destination |
alternativestops=true |
Search for additional connections from/to stops nearby origin or destination. |
false |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?alternativestops=true |
umsteigezeit |
Enumeration |
normal | zehn | zwanzig | dreissig |
umsteigezeit=zehn |
Specifies the amount of time available for transfers at each stop. zehn: At least 10 minutes. zwanzig: At least 20 minutes. dreissig: At least 30 minutes. normal: No increased amount of time for transfers. |
normal |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?umsteigezeit=zehn |
vias.
Via stop, address or POI (max. 5 vias). If more than one via is added, please include erweiterteSuche parameter as well (see example underneath). Each via stops subparameter need to be put in a brace {} and the parameters and their values needs to be put in quotation marks as seen in the example. Blanks in arrays are not necessary and can be left out.
Type |
Sub parameters |
Example | Example URL |
---|---|---|---|
array |
dauer; name (for details see table above) |
?vias=[{“name“: “Basel“, “dauer“: “00:15“},{ “name“: “Bern“, “dauer“: “01:00“}] |
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?vias=%5B%7B%22name%22:%22Basel%22,%22dauer%22:%2200:15%22%7D,%7B%22name%22:%22Bern%22,%22dauer%22:%2201:00%22%7D%5D&erweiterteSuche=true |
verkehrsmittel.
Limits connections by their means of transportation.
Examples.
The following chapter should give some examples of possible URLs and the expected results.
Single parameter URL
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?nach=Bern

Complete parameter URL.
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?von=Z%C3%BCrich+HB&nach=Bern&datum=03.07.2018&zeit=16:00&suche=true

Complex parameter URL
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?
von=Z%C3%BCrich+HB&nach=Bern&datum=03.07.2018&zeit=
16:00&vias=%5B%7B%22name%22:%22Biel/Bienne%22,%22dauer
%22:%2200:30%22%7D,%7B%22name%22:%22Grenchen%22,%
22dauer%22:%2201:00%22%7D%5D&erweiterteSuche=true&suche=true

Parameter URL incl. advanced search.
https://www.sbb.ch/en/buying/pages/fahrplan/fahrplan.xhtml?von=Solothurn&nach=Olten&erweiterteSuche=true&ohneneigezuege=true&
velo=true&verkehrsmittel=%5B%22s_sn_r%22%5D&suche=true

Legal notice.
The integration of the timetable on this site does not establish any legal connection or legal claim to the described services of SBB.