search.ch
  1. Queries
  2. Completion
  3. Route Queries
  4. Stationboard queries
  5. Terms of Use

API Specification

Queries

Requests are sent to the API as HTTPS-URIs, according to the concept of REST. The server responds with JSON.

Rate Limit

The number of daily requests is limited to 1000. If you reach the maximum number of requests please contact us, we are eager to hear your use case and discuss a solution.

Attention

This API might change at some point in the future! You can register yourself here to get informed about changes:

E-mail*
Use case
 
Fields with a * are mandatory.

Completion

GET https://timetable.search.ch/api/completion.en.json?term=lu

Parameter Required Description Example Default
term required what the user entered lu
nofavorites optional don't use smart favorites from timetable.search.ch 1 0
show_ids optional Return station ids 1 0
show_coordinates optional Return coordinates of stations 1 0
Example response
[
   {
      "label" : "Luzern",
      "html" : "<span class=\"sl-keyword\">Lu</span>zern",
      "iconclass" : "sl-icon-type-zug"
   },
   [..]
]

Coordinate Reverse Lookup

GET https://timetable.search.ch/api/completion.en.json?latlon=46.948004,7.448134&accuracy=10

Parameter Required Description Example Default
latlon required Coordinates 46.948004,7.448134
accuracy optional Accuracy in meter 10 0
show_ids optional Return station ids 1 0
show_coordinates optional Return coordinates of stations 1 0
Example response
[
	{
		"label": "Zytgloggelaube, Bern",
		"dist": 15,
		"iconclass": "sl-icon-type-adr"
	},
	{
		"label": "Bern, Zytglogge",
		"dist": 51,
		"iconclass": "sl-icon-type-tram"
	},
	{
		"label": "Bern, Bundesplatz",
		"dist": 337,
		"iconclass": "sl-icon-type-bus"
	},
	[..]
]

Route Queries

GET https://timetable.search.ch/api/route.en.json?from=Einsiedeln&to=Z%C3%BCrich,+F%C3%B6rrlibuckstr.+60

Parameter Required Description Example Default
from required Departure station, id or address Einsiedeln
to required Arrival station, id or address Zürich, Förrlibuckstr. 60
via optional Via stations, for more than one via use array notation like via[]=via1&via[]=via2 Wädenswil
date optional Date 10/24/2017 today
time optional Time 11:20 now
time_type optional Specifies whether date/time is meant for departure or arrival arrival depart
num optional How many connections should be returned 8 4
pre optional How many additional connections should be returned before the given time 4 0
show_delays optional Return delays 1 0
Example response
{
   "connections" : [
      {
         "from" : "Einsiedeln",
         "arrival" : "2016-10-27 20:12:00",
         "disruptions" : [],
         "legs" : [
            {
               "type" : "str",
               "track" : "4",
               "terminal" : "Wädenswil",
               "fgcolor" : "fff",
               "number" : "S13 19371",
               "bgcolor" : "039",
               "tripid" : "T2016_19371_000082_101_df5a79b_0",
               "exit" : {
                  "arrival" : "2016-10-27 19:25:00",
                  "sbb_name" : "Wädenswil",
                  "name" : "Wädenswil",
                  "stopid" : "8503206",
                  "waittime" : 240
               },
               "runningtime" : 1620,
               "stopid" : "8503283",
               "line" : "S13",
               "stops" : [
                  {
                     "stopid" : "8503284",
                     "name" : "Biberbrugg",
                     "departure" : "27.10.2016 19:07"
                  },
                  {
                     "name" : "Schindellegi-Feusisberg",
                     "departure" : "27.10.2016 19:11",
                     "stopid" : "8503285"
                  },
                  {
                     "name" : "Samstagern",
                     "departure" : "27.10.2016 19:17",
                     "stopid" : "8503286"
                  },
                  {
                     "stopid" : "8503293",
                     "departure" : "27.10.2016 19:18",
                     "name" : "Grüenfeld"
                  },
                  {
                     "stopid" : "8503287",
                     "name" : "Burghalden",
                     "departure" : "27.10.2016 19:21"
                  }
               ],
               "sbb_name" : "Einsiedeln",
               "name" : "Einsiedeln",
               "departure" : "2016-10-27 18:58:00"
            },
            {
               "arrival" : "2016-10-27 19:25:00",
               "departure" : "2016-10-27 19:29:00",
               "name" : "Wädenswil",
               "stops" : [
                  {
                     "departure" : "27.10.2016 19:39",
                     "name" : "Thalwil",
                     "stopid" : "8503202"
                  },
                  {
                     "stopid" : "0000176",
                     "departure" : null,
                     "name" : "Zimmerberg-Basistunnel"
                  }
               ],
               "type" : "etrn",
               "normal_time" : 180,
               "sbb_name" : "Wädenswil",
               "runningtime" : 1140,
               "exit" : {
                  "arrival" : "2016-10-27 19:48:00",
                  "name" : "Zürich HB",
                  "sbb_name" : "Zürich HB",
                  "waittime" : 0,
                  "stopid" : "8503000"
               },
               "line" : "RE",
               "stopid" : "8503206",
               "waittime" : 240,
               "tripid" : "T2016_05082_000011_101_c92bac7_0",
               "bgcolor" : "f00",
               "number" : "RE 5082",
               "terminal" : "Zürich HB",
               "track" : "2",
               "fgcolor" : "fff"
            },
            {
               "arrival" : "2016-10-27 19:48:00",
               "normal_time" : 420,
               "sbb_name" : "Zürich HB",
               "name" : "Zürich HB",
               "departure" : "2016-10-27 19:48:00",
               "exit" : {
                  "sbb_name" : "Zürich, Sihlquai/HB",
                  "name" : "Zürich, Sihlquai/HB",
                  "arrival" : "2016-10-27 19:55:00",
                  "waittime" : 360,
                  "stopid" : "8591368"
               },
               "runningtime" : 420,
               "stopid" : "8503000",
               "waittime" : 0,
               "stops" : null
            },
            {
               "name" : "Zürich, Sihlquai/HB",
               "departure" : "2016-10-27 20:01:00",
               "arrival" : "2016-10-27 19:55:00",
               "stops" : [
                  {
                     "stopid" : "8591282",
                     "departure" : "27.10.2016 20:02",
                     "name" : "Zürich, Museum für Gestaltung"
                  },
                  {
                     "stopid" : "8591257",
                     "departure" : "27.10.2016 20:03",
                     "name" : "Zürich, Limmatplatz"
                  },
                  {
                     "stopid" : "8591306",
                     "name" : "Zürich, Quellenstr.",
                     "departure" : "27.10.2016 20:04"
                  },
                  {
                     "departure" : "27.10.2016 20:05",
                     "name" : "Zürich, Dammweg",
                     "stopid" : "8591110"
                  },
                  {
                     "stopid" : "8580522",
                     "name" : "Zürich, Escher-Wyss-Platz",
                     "departure" : "27.10.2016 20:06"
                  }
               ],
               "type" : "tra",
               "sbb_name" : "Zürich, Sihlquai/HB",
               "stopid" : "8591368",
               "waittime" : 360,
               "line" : "17",
               "exit" : {
                  "stopid" : "8591135",
                  "arrival" : "2016-10-27 20:08:00",
                  "name" : "Zürich, Förrlibuckstr.",
                  "sbb_name" : "Zürich, Förrlibuckstrasse"
               },
               "runningtime" : 420,
               "number" : "T 34826",
               "bgcolor" : "9d1b6e",
               "tripid" : "T2016_34826_003849_001_494a519_0",
               "fgcolor" : "fff",
               "terminal" : "Zürich, Werdhölzli"
            },
            {
               "arrival" : "2016-10-27 20:08:00",
               "name" : "Zürich, Förrlibuckstr.",
               "normal_time" : 0,
               "sbb_name" : "Zürich, Förrlibuckstrasse",
               "departure" : "2016-10-27 20:08:00",
               "exit" : {
                  "stopid" : "681270,249530",
                  "isaddress" : true,
                  "sbb_name" : null,
                  "name" : "Zürich, Förrlibuckstr. 60",
                  "arrival" : "2016-10-27 20:12:00"
               },
               "runningtime" : 240,
               "stopid" : "8591135",
               "stops" : null,
               "type" : "walk"
            },
            {
               "isaddress" : true,
               "stopid" : "681270,249530",
               "arrival" : "2016-10-27 20:12:00",
               "sbb_name" : null,
               "name" : "Zürich, Förrlibuckstr. 60"
            }
         ],
         "duration" : 4440,
         "to" : "Zürich, Förrlibuckstr. 60",
         "departure" : "2016-10-27 18:58:00"
      }
   ]
}

Stationboard queries

GET https://timetable.search.ch/api/stationboard.en.json?stop=Einsiedeln

Parameter Required Description Example Default
stop required Departure/arrival station or id Einsiedeln
date optional Date 10/24/2017 today
time optional Time 11:20 now
mode optional Specifies whether departure table or arrival table is meant arrival depart
limit optional Number of connections to return. API returns more if there are still connections in the last minute. 0 for unlimited (24 hours coverage) 15 0
show_tracks optional Return tracks 1 0
show_subsequent_stops optional Return subsequent stops 1 0
show_delays optional Return delays 1 0
Example response
{
	"stop": {
		"id": "8503283",
		"name": "Einsiedeln",
		"x": "699075",
		"y": "220557"
	},
	"connections": [
		{
			"time": 1491216300,
			"*G": "S",
			"*L": "40",
			"type": "str",
			"line": "S40",
			"operator": "SOB-sob",
			"color": "039~fff~",
			"number": "S40 16947",
			"terminal": {
				"id": "8503110",
				"name": "Rapperswil",
				"x": 704369,
				"y": 231356
			}
		},
		{
			"time": 1491217080,
			"*G": "S",
			"*L": "13",
			"type": "str",
			"line": "S13",
			"operator": "SOB-sob",
			"color": "039~fff~",
			"number": "S13 19347",
			"terminal": {
				"id": "8503206",
				"name": "Wädenswil",
				"x": 693643,
				"y": 231668
			}
		},
		[..]
	],
	"request": "stationboard",
	"eof": 1
}