SL Stop lookup

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.

API key quota levels

LevelMax requests/minuteMax requests/month
Bronze3010 000
Silver60100 000
GoldAs needed

Request

URL

https://journeyplanner.integration.sl.se/v1/typeahead.<FORMAT>?key=<YOUR_KEY>&searchstring=<QUERY>

The old URL https://api.sl.se/api2/typeahead.<FORMAT>?key=<YOUR_KEY>&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
KeyStringYesYour API key.
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

https://journeyplanner.integration.sl.se/v1/typeahead.json?searchstring=Oden&stationsonly=true&maxresults=5&key=<YOUR KEY>
https://journeyplanner.integration.sl.se/v1/typeahead.xml?searchstring=Oden&stationsonly=true&maxresults=5&key=<YOUR KEY>

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.

Example response

{
  "StatusCode": 0,
  "Message": null,
  "ExecutionTime": 0,
  "ResponseData": [
    {
      "Name": "Odenplan (Stockholm)",
      "SiteId": "9117",
      "Type": "Station",
      "X": "18049099",
      "Y": "59342901",
      "Products": null
    },
    {
      "Name": "Odengatan/Valhallavägen (Stockholm)",
      "SiteId": "1082",
      "Type": "Station",
      "X": "18065891",
      "Y": "59346622",
      "Products": null
    },
    {
      "Name": "Stockholm Odenplan (Stockholm)",
      "SiteId": "1079",
      "Type": "Station",
      "X": "18045683",
      "Y": "59343116",
      "Products": null
    },
    {
      "Name": "Odengatan/Sveavägen (Stockholm)",
      "SiteId": "1030",
      "Type": "Station",
      "X": "18055311",
      "Y": "59344294",
      "Products": null
    },
    {
      "Name": "Odenvägen (Lidingö)",
      "SiteId": "2059",
      "Type": "Station",
      "X": "18133795",
      "Y": "59367396",
      "Products": null
    }
  ]
}
<?xml version="1.0" encoding="utf-8"?>
<ResponseOfListOfSite xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <StatusCode>0</StatusCode>
    <ExecutionTime>0</ExecutionTime>
    <ResponseData>
        <Site>
            <Name>Odenplan (Stockholm)</Name>
            <SiteId>9117</SiteId>
            <Type>Station</Type>
            <X>18049099</X>
            <Y>59342901</Y>
        </Site>
        <Site>
            <Name>Odengatan/Valhallavägen (Stockholm)</Name>
            <SiteId>1082</SiteId>
            <Type>Station</Type>
            <X>18065891</X>
            <Y>59346622</Y>
        </Site>
        <Site>
            <Name>Stockholm Odenplan (Stockholm)</Name>
            <SiteId>1079</SiteId>
            <Type>Station</Type>
            <X>18045683</X>
            <Y>59343116</Y>
        </Site>
        <Site>
            <Name>Odengatan/Sveavägen (Stockholm)</Name>
            <SiteId>1030</SiteId>
            <Type>Station</Type>
            <X>18055311</X>
            <Y>59344294</Y>
        </Site>
        <Site>
            <Name>Odenvägen (Lidingö)</Name>
            <SiteId>2059</SiteId>
            <Type>Station</Type>
            <X>18133795</X>
            <Y>59367396</Y>
        </Site>
    </ResponseData>
</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.