Obs: Detta innehåll finns inte tillgängligt på svenska. Därför ser du engelska versionen. Om du tycker att denna sida borde översättas till svenska, kan du skriva till oss på support.trafiklab.se.

Om du vill se webbsidan på engelska, klicka här.

Description

This API provides information about the lines, stops, and next departures on the SL network. It replaces the existing SL Departures v4 and SL Stops and lines v2 APIs. No API key is required to use this API.

Concepts

ConceptDescription
SiteA Site is a grouping of StopAreas used to simplify searching in the journey planner.
StopAreaA StopArea is a grouping of StopPoints with the same traffic type and name within a defined geographic area, such as a terminal.
StopPointA StopPoint is a stopping point, also known as quay, and is part of a StopArea. A stop area for busses may for example contain one stop point on each side of the road.

URL

This API consists of 5 endpoints, each with their own URL. No API key is required to use this API.

1https://transport.integration.sl.se/v1/lines
1https://transport.integration.sl.se/v1/sites?expand=true
1https://transport.integration.sl.se/v1/sites/{siteId}/departures
1https://transport.integration.sl.se/v1/stop-points
1https://transport.integration.sl.se/v1/transport-authorities

Format

This API returns data in the JSON format

Request

API Key Levels

This API does not require the use of an API key. You should however not make excessive requests, to ensure the availability and performance of the API for everyone. If you need large amounts of data, for example all departures from all stops, GTFS Regional might be better suited for your application.

Parameters

When searching for a specific site, or departures from a specific site, the site ID is required. Other API calls do not have any mandatory parameters. For complete list of all parameters, including optional parameters, please see the openAPI specification below.

ParametersData TypeMandatoryDescription
siteIdIntegerYesUnique identification number for the location for which current departures should be fetched, e.g., 9192 for Slussen. Can be obtained from a search through the list of all sites, or the SL stop lookup api.
expandBooleanNoUsed in sites endpoint in order to include stop area ids.

SiteId and SL Stop Lookup

The SiteId parameter used in the Departure from site endpoint match the site ids present in the /sites endpoint. They do not match the ids in the SL Stop Lookup API!

In order to use values returned by the SL Stop Lookup API, you should convert the returned SiteId values, that come in the form of 3BA1CDEFG, into a number ABCDEFG. For example 300109001 becomes 9001. It is however recommended to keep to the site ids returned by the /sites endpoint where possible, as this removes the need for conversion altogether.

Response

For details regarding the response structure, please see the OpenApi specification below. A few example responses can be seen below.

  1[
  2  {
  3    "metro": [
  4      {
  5        "id": 13,
  6        "gid": 9025001000041484,
  7        "name": "19",
  8        "designation": "13X",
  9        "transport_mode": "BUS",
 10        "group_of_lines": "tunnelbanans gröna linje",
 11        "transport_authority": {
 12          "id": 1,
 13          "name": "Storstockholms Lokaltrafik"
 14        },
 15        "contractor": {
 16          "id": 1,
 17          "name": "Arriva"
 18        },
 19        "valid": {
 20          "from": "2024-01-01T01:00:00",
 21          "to": "2024-01-01T01:00:00"
 22        }
 23      }
 24    ],
 25    "tram": [
 26      {
 27        "id": 13,
 28        "gid": 9025001000041484,
 29        "name": "19",
 30        "designation": "13X",
 31        "transport_mode": "BUS",
 32        "group_of_lines": "tunnelbanans gröna linje",
 33        "transport_authority": {
 34          "id": 1,
 35          "name": "Storstockholms Lokaltrafik"
 36        },
 37        "contractor": {
 38          "id": 1,
 39          "name": "Arriva"
 40        },
 41        "valid": {
 42          "from": "2024-01-01T01:00:00",
 43          "to": "2024-01-01T01:00:00"
 44        }
 45      }
 46    ],
 47    "train": [
 48      {
 49        "id": 13,
 50        "gid": 9025001000041484,
 51        "name": "19",
 52        "designation": "13X",
 53        "transport_mode": "BUS",
 54        "group_of_lines": "tunnelbanans gröna linje",
 55        "transport_authority": {
 56          "id": 1,
 57          "name": "Storstockholms Lokaltrafik"
 58        },
 59        "contractor": {
 60          "id": 1,
 61          "name": "Arriva"
 62        },
 63        "valid": {
 64          "from": "2024-01-01T01:00:00",
 65          "to": "2024-01-01T01:00:00"
 66        }
 67      }
 68    ],
 69    "bus": [
 70      {
 71        "id": 13,
 72        "gid": 9025001000041484,
 73        "name": "19",
 74        "designation": "13X",
 75        "transport_mode": "BUS",
 76        "group_of_lines": "tunnelbanans gröna linje",
 77        "transport_authority": {
 78          "id": 1,
 79          "name": "Storstockholms Lokaltrafik"
 80        },
 81        "contractor": {
 82          "id": 1,
 83          "name": "Arriva"
 84        },
 85        "valid": {
 86          "from": "2024-01-01T01:00:00",
 87          "to": "2024-01-01T01:00:00"
 88        }
 89      }
 90    ],
 91    "ship": [
 92      {
 93        "id": 13,
 94        "gid": 9025001000041484,
 95        "name": "19",
 96        "designation": "13X",
 97        "transport_mode": "BUS",
 98        "group_of_lines": "tunnelbanans gröna linje",
 99        "transport_authority": {
100          "id": 1,
101          "name": "Storstockholms Lokaltrafik"
102        },
103        "contractor": {
104          "id": 1,
105          "name": "Arriva"
106        },
107        "valid": {
108          "from": "2024-01-01T01:00:00",
109          "to": "2024-01-01T01:00:00"
110        }
111      }
112    ],
113    "ferry": [
114      {
115        "id": 13,
116        "gid": 9025001000041484,
117        "name": "19",
118        "designation": "13X",
119        "transport_mode": "BUS",
120        "group_of_lines": "tunnelbanans gröna linje",
121        "transport_authority": {
122          "id": 1,
123          "name": "Storstockholms Lokaltrafik"
124        },
125        "contractor": {
126          "id": 1,
127          "name": "Arriva"
128        },
129        "valid": {
130          "from": "2024-01-01T01:00:00",
131          "to": "2024-01-01T01:00:00"
132        }
133      }
134    ],
135    "taxi": [
136      {
137        "id": 13,
138        "gid": 9025001000041484,
139        "name": "19",
140        "designation": "13X",
141        "transport_mode": "BUS",
142        "group_of_lines": "tunnelbanans gröna linje",
143        "transport_authority": {
144          "id": 1,
145          "name": "Storstockholms Lokaltrafik"
146        },
147        "contractor": {
148          "id": 1,
149          "name": "Arriva"
150        },
151        "valid": {
152          "from": "2024-01-01T01:00:00",
153          "to": "2024-01-01T01:00:00"
154        }
155      }
156    ]
157  }
158]
 1[
 2  {
 3    "id": 1079,
 4    "gid": 9091001000001080,
 5    "name": "Stockholm Odenplan",
 6    "abbreviation": "SOD",
 7    "lat": 59.3431180362708,
 8    "lon": 18.0456865578456,
 9    "stop_areas": [
10      1131,
11      10151,
12      5320
13    ],
14    "valid": {
15      "from": "2018-08-10T00:00:00"
16    }
17  }
18]
 1{
 2  "departures": [
 3    {
 4      "direction": "string",
 5      "direction_code": 2,
 6      "via": "string",
 7      "destination": "string",
 8      "state": "NOTEXPECTED",
 9      "scheduled": "2024-01-01T01:00:00",
10      "expected": "2024-01-01T01:00:00",
11      "display": "string",
12      "journey": {
13        "id": 2020062310015,
14        "state": "NOTEXPECTED",
15        "prediction_state": "NORMAL",
16        "passenger_level": "EMPTY"
17      },
18      "stop_area": {
19        "id": 41483,
20        "name": "Abborrkroksvägen",
21        "sname": "string",
22        "type": "BUSTERM"
23      },
24      "stop_point": {
25        "id": 41483,
26        "name": "Universitetet",
27        "designation": "D"
28      },
29      "line": {
30        "id": 13,
31        "designation": "13X",
32        "transport_mode": "BUS",
33        "group_of_lines": "tunnelbanans gröna linje"
34      },
35      "deviations": "string"
36    }
37  ],
38  "stop_deviations": [
39    {
40      "importance": 5,
41      "consequence": "INFORMATION",
42      "message": "Resa förbi Arlanda C kräver både UL- och SL- biljett."
43    }
44  ]
45}
 1[
 2  {
 3    "id": 41483,
 4    "gid": 9022001041483002,
 5    "pattern_point_gid": 9025001000041484,
 6    "name": "Universitetet",
 7    "sname": "string",
 8    "designation": "D",
 9    "local_num": 0,
10    "type": "PLATFORM",
11    "has_entrance": true,
12    "lat": 59.4474618783708,
13    "lon": 17.8376900105886,
14    "door_orientation": 342.3,
15    "transport_authority": {
16      "id": 1,
17      "name": "Storstockholms Lokaltrafik"
18    },
19    "stop_area": {
20      "id": 41483,
21      "name": "Abborrkroksvägen",
22      "sname": "string",
23      "type": "BUSTERM"
24    },
25    "valid": {
26      "from": "2024-01-01T01:00:00",
27      "to": "2024-01-01T01:00:00"
28    }
29  }
30]
 1[
 2  {
 3    "id": 1,
 4    "gid": 9010001000000000,
 5    "name": "Storstockholms Lokaltrafik",
 6    "formal_name": "AB Storstockholms Lokaltrafik",
 7    "code": "string",
 8    "street": "Lindhagensgatan 100",
 9    "postal_code": 10573,
10    "city": "Stockholm",
11    "country": "Sweden",
12    "valid": {
13      "from": "2024-01-01T01:00:00",
14      "to": "2024-01-01T01:00:00"
15    }
16  }
17]

OpenAPI specification