Description

Using this API, you can retrieve information regarding SLs stops by providing a part of the name of a stop. You can opt to only search for stops, or to search for both stops, addresses and places.

Format

Json or xml, as specified in the API request.

Request

URL

https://journeyplanner.integration.sl.se/v1/typeahead.<FORMAT>?key=TRAFIKLAB-SLAPI-INTEGRATION-2024&searchstring=<QUERY>

The old URL https://api.sl.se/api2/typeahead.<FORMAT>?key=TRAFIKLAB-SLAPI-INTEGRATION-2024&searchstring=<QUERY> has changed on November 16th, and will stop working on March 15th. Query parameters, response bodies and API keys remain unchanged.

Parameters

The following parameters can be provided in the query string:

NameTypeRequiredDescription
KeyStringYesThe API key, TRAFIKLAB-SLAPI-INTEGRATION-2024 for new users or projects since oktober 1st 2024.
SearchStringStringYesThe search query, limited to 20 characters.
StationsOnlyBooleanNoWhether to search for stations only, or to even include addresses and places. true in order to only search stops. true by default.
MaxResultsIntegerNoThe maximum number of result to return. Between 1 and 50, default 10.
typeStringNoType filter for stops:
  • S: Stations only
  • P: Points of interests (POI) only
  • A: Addresses only
  • SP: Stations and POIs
  • SA: Stations and addresses
  • AP: Addresses and POI
  • ALL: Stations, Addresses and POI

Example call

1https://journeyplanner.integration.sl.se/v1/typeahead.json?searchstring=Oden&stationsonly=true&maxresults=5&key=TRAFIKLAB-SLAPI-INTEGRATION-2024
1https://journeyplanner.integration.sl.se/v1/typeahead.xml?searchstring=Oden&stationsonly=true&maxresults=5&key=TRAFIKLAB-SLAPI-INTEGRATION-2024

Results

Response structure

NameTypeDescription
StatusCodeIntegerContains a status code corresponding to the possible message
MessageStringContain error messages in case something went wrong. See “Error messages” below.
ExecutionTimeLongHow long time the server needed to generate the response, in milliseconds.
ResponseDataSitesThe actual response

Sites

NameTypeDescription
SitesListA list of all found sites.

Site

NameTypeDescription
NameStringThe name of the stop
SiteIdIntegerThe id of the stop area.
TypeStringThe place type: ”Station”, ”Address” or ”Poi” (Point of interest).
XStringX-coordinate in SWEREF format.
YStringY-coordinate in SWEREF format.

SL Stop Lookup in combination with other APIs

The SiteId value returned by the SL Stop lookup API matches the SiteId value expected by the SL Routeplanner 3.1 API. These values changed in february but do still match each other (given that both APIs are accessed through the integration.sl.se domain).

In order to use values returned by the SL Stop Lookup API in combination with the SL Transport API, you should convert the values returned by the SL Stop Lookup API, in the form of 3BA1CDEFG, into a number ABCDEFG. It is however recommended to use the site ids returned by the Transport Api /sites endpoint if possible instead of combining APIs.

Example response

 1{
 2  "StatusCode": 0,
 3  "Message": null,
 4  "ExecutionTime": 0,
 5  "ResponseData": [
 6    {
 7      "Name": "Odenplan (Stockholm)",
 8      "SiteId": "300109117",
 9      "Type": "Station",
10      "X": "18049099",
11      "Y": "59342901",
12      "Products": null
13    },
14    {
15      "Name": "Odengatan/Valhallavägen (Stockholm)",
16      "SiteId": "300101082",
17      "Type": "Station",
18      "X": "18065891",
19      "Y": "59346622",
20      "Products": null
21    },
22    {
23      "Name": "Stockholm Odenplan (Stockholm)",
24      "SiteId": "300101079",
25      "Type": "Station",
26      "X": "18045683",
27      "Y": "59343116",
28      "Products": null
29    },
30    {
31      "Name": "Odengatan/Sveavägen (Stockholm)",
32      "SiteId": "300101030",
33      "Type": "Station",
34      "X": "18055311",
35      "Y": "59344294",
36      "Products": null
37    },
38    {
39      "Name": "Odenvägen (Lidingö)",
40      "SiteId": "300102059",
41      "Type": "Station",
42      "X": "18133795",
43      "Y": "59367396",
44      "Products": null
45    }
46  ]
47}
 1<?xml version="1.0" encoding="utf-8"?>
 2<ResponseOfListOfSite xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 3    <StatusCode>0</StatusCode>
 4    <ExecutionTime>0</ExecutionTime>
 5    <ResponseData>
 6        <Site>
 7            <Name>Odenplan (Stockholm)</Name>
 8            <SiteId>300109117</SiteId>
 9            <Type>Station</Type>
10            <X>18049099</X>
11            <Y>59342901</Y>
12        </Site>
13        <Site>
14            <Name>Odengatan/Valhallavägen (Stockholm)</Name>
15            <SiteId>300101082</SiteId>
16            <Type>Station</Type>
17            <X>18065891</X>
18            <Y>59346622</Y>
19        </Site>
20        <Site>
21            <Name>Stockholm Odenplan (Stockholm)</Name>
22            <SiteId>300101079</SiteId>
23            <Type>Station</Type>
24            <X>18045683</X>
25            <Y>59343116</Y>
26        </Site>
27        <Site>
28            <Name>Odengatan/Sveavägen (Stockholm)</Name>
29            <SiteId>300101030</SiteId>
30            <Type>Station</Type>
31            <X>18055311</X>
32            <Y>59344294</Y>
33        </Site>
34        <Site>
35            <Name>Odenvägen (Lidingö)</Name>
36            <SiteId>300102059</SiteId>
37            <Type>Station</Type>
38            <X>18133795</X>
39            <Y>59367396</Y>
40        </Site>
41    </ResponseData>
42</ResponseOfListOfSite>

Support

If you need more help you can search through existing questions on our support forum. If you don’t find the answer to your question their, you can create your own post and we’ll try to help you as soon as possible.