What does this API provide?

Trafiklab Timetables provides a list of departures or arrivals at a given stop.

Data format

The data is formatted as JSON.

Updates

The static data used for this API is updated when changes are made, at most once per day. Real-time data is updated continuously, but lists with departures and arrivals for a given time are cached for 60 seconds. This means that making new requests for the same location and time within 60 seconds won’t return any updates.

Breaking changes

This API has the beta status. We are actively developing this API based on user feedback. Minor breaking changes may occur on short notice. New fields may be added without warning.

Operators covered by this dataset

The following table shows which operators are covered by this dataset.

OperatorStatic dataReal-time data
SL✔️✔️
UL✔️✔️
Sörmlandstrafiken✔️
Östgötatrafiken✔️✔️
JLT✔️✔️
Kronoberg✔️✔️
KLT✔️✔️
Gotland✔️
Blekingetrafiken✔️
Skånetrafiken✔️✔️
Hallandstrafiken✔️
Västtrafik✔️
Värmlandstrafik✔️✔️
Örebro✔️✔️
Västmanland✔️✔️
Dalatrafik✔️✔️
X-trafik✔️✔️
Din Tur - Västernorrland✔️✔️
Jämtland✔️
Västerbotten✔️
Norrbotten✔️
Bergkvara✔️
BT buss✔️
Destination Gotland✔️
Falcks Omnibus AB✔️
Flixbus✔️
Härjedalingen✔️
Lennakatten✔️
Luleå Lokaltrafik✔️
Masexpressen✔️
Mälartåg✔️
Norrtåg✔️
Ressel Rederi✔️
Roslagens sjötrafik✔️
SJ✔️
SJ Norge✔️
Sjöstadstrafiken (Stockholm Stad)✔️
Skellefteåbuss✔️
Snälltåget✔️
Stavsnäs båttaxi✔️
Strömma Turism & Sjöfart AB✔️
TJF Smalspåret✔️
Trosabussen✔️
Tågab✔️
VR✔️
Vy Tåg AB✔️
Vy Värmlandstrafik✔️
Vygruppen Norge✔️
Y-Buss✔️
Last updated: 2025-05-09

Using Trafiklab Timetables

Trafiklab Timetables consists of two different endpoints, one for departures and one for arrivals. Both endpoints take a stop id and timestamp as parameters, and have the same response structure. They return a list of departures or arrivals from the given stop, including a bit of information about each vehicle, such as where it is heading or where it comes from.

Stops

When listing departures or arrivals, the API takes an area id. This id matches stop_id from GTFS Sverige 2 stops.txt, area_id in GTFS Sweden 3’s areas.txt, and the ids used in the Resrobot APIs. Each area contains one or more stops, for example when both metro and buses stop at the same area. How areas are divided in stops depends on how the local agencies structure their data.

Rikshållplatser

Rikshållplatser, Swedish for “national stops”, is the historical name for a grouping of multiple local stops under one name and id. This is done to avoid duplicate stops when they are considered to be one stop by travelers. An example are certain multimodal stops, where a bus stop and tram stop may be at the same location. Rikshållplatser typically only group stops which are “identical” for travelers, meaning train stops always have their own rikshållplats as you always need to walk to another (nearby) stop in case of a bus transfer, as buses do not share platforms with trains.

Meta-stops

Meta-stops are groups of multiple nearby stops. This is done to simplify route-planning for travelers. An example meta stop is “Stockholm” which combines train, metro, tram and bus stops in central stockholm. This way, travelers can easily search a route “from Göteborg to Stockholm” without having to know about all the local stops. Meta-stops are also used for combining multi-modal stops which are more spread out, such as Sundbyberg Station along with its two bus stops (on different sides of the station) as well as its metro stop.

An example is Slussen, which contains one area for buses and one area for metro traffic. Both are included when looking up slussen by its area id, and each departure can be linked to one of these stops. The trafiklab realtime APIs take the id of a rikshållplats or meta-stop, not the id of underlying stops!

2025-04-03-trafiklab-api-stop-hierarchy.png

Making a request

This call will show all departures from Göteborg Central Station (740000002). The id can be obtained from Trafiklab Stop Lookup, GTFS Sweden 3 (areas.txt) or GTFS Sverige 2 (stops.txt, no meta stops).

Call

1https://realtime-api.trafiklab.se/v1/departures/740000002?key=API_KEY
2https://realtime-api.trafiklab.se/v1/departures/740000002/2025-04-01T16:00?key=API_KEY
1https://realtime-api.trafiklab.se/v1/arrivals/740000003?key=API_KEY
2https://realtime-api.trafiklab.se/v1/arrivals/740000003/2025-04-01T16:00?key=API_KEY

Request parameters

This API makes use of path parameters. They are part of the URL path and must be in the correct order.

1https://realtime-api.trafiklab.se/v1/departures/{area id}?key={key}
2https://realtime-api.trafiklab.se/v1/departures/{area id}/{time}?key={key}
3https://realtime-api.trafiklab.se/v1/arrivals/{area id}?key={key}
4https://realtime-api.trafiklab.se/v1/arrivals/{area id}/{time}?key={key}
NameTypeData typeRequiredDescription
area idPathStringYesThe area/rikshallplats id for the stop you want to look up.
timePathStringOptionalThe time to look up, in YYYY-MM-DD\THH:mm format. For example, 2025-04-01T10:00. Seconds cannot be specified.
keyQueryStringYesYour API key

The interval for which to show departures cannot be specified, and is always 60 minutes. Any filtering should be done on the client side.

Response

The responses consist of 4 parts:

  • The timestamp at which the response was created
  • Information about the query (which stop was looked up, which time was requested)
  • Information about the stops included in the response
  • The actual departures/arrivals in the next 60 minutes

Precise technical documentation is available in the form of an OpenAPI specification on the bottom of this page.

Note that the actual responses contain more entries and stops - we removed some from this example response since it’s only meant to show the structure of the response.
  1{
  2  "timestamp": "2025-04-01T14:22:43",
  3  "query": {
  4    "queryTime": "2025-04-01T14:22:00",
  5    "query": "740000002"
  6  },
  7  "stops": [
  8    {
  9      "id": "71314",
 10      "name": "Göteborg C",
 11      "lat": 57.708918,
 12      "lon": 11.973946,
 13      "transport_modes": [
 14        "TRAIN"
 15      ],
 16      "alerts": []
 17    },
 18    {
 19      "id": "71472",
 20      "name": "Göteborg C",
 21      "lat": 57.708918,
 22      "lon": 11.973946,
 23      "transport_modes": [
 24        "TRAIN"
 25      ],
 26      "alerts": []
 27    },
 28    {
 29      "id": "2",
 30      "name": "Göteborg Centralstation",
 31      "lat": 57.709299,
 32      "lon": 11.973659,
 33      "transport_modes": [
 34        "TRAIN",
 35        "BUS"
 36      ],
 37      "alerts": []
 38    }
 39  ],
 40  "departures": [
 41    {
 42      "scheduled": "2025-04-01T14:30:00",
 43      "realtime": "2025-04-01T14:30:00",
 44      "delay": 0,
 45      "canceled": false,
 46      "route": {
 47        "name": "Västtågen",
 48        "designation": "3258",
 49        "transport_mode_code": 100,
 50        "transport_mode": "TRAIN",
 51        "direction": "Vänersborg",
 52        "origin": {
 53          "id": "2",
 54          "name": "Göteborg Centralstation"
 55        },
 56        "destination": {
 57          "id": "241",
 58          "name": "Vänersborg central"
 59        }
 60      },
 61      "trip": {
 62        "trip_id": "141010001327690347",
 63        "start_date": "2025-04-01",
 64        "technical_number": 130
 65      },
 66      "agency": {
 67        "id": "505000000000000014",
 68        "name": "Västtrafik",
 69        "operator": "SJ Götalandståg"
 70      },
 71      "stop": {
 72        "id": "2",
 73        "name": "Göteborg Centralstation",
 74        "lat": 57.709299,
 75        "lon": 11.973659
 76      },
 77      "scheduled_platform": {
 78        "id": "9022050000002017",
 79        "designation": "9"
 80      },
 81      "realtime_platform": {
 82        "id": "9022050000002017",
 83        "designation": "9"
 84      },
 85      "alerts": [],
 86      "is_realtime": false
 87    },
 88    {
 89      "scheduled": "2025-04-01T14:40:00",
 90      "realtime": "2025-04-01T14:40:00",
 91      "delay": 0,
 92      "canceled": false,
 93      "route": {
 94        "name": "Öresundståg",
 95        "designation": "1111",
 96        "transport_mode_code": 100,
 97        "transport_mode": "TRAIN",
 98        "direction": "Malmö",
 99        "origin": {
100          "id": "2",
101          "name": "Göteborg Centralstation"
102        },
103        "destination": {
104          "id": "110",
105          "name": "Varberg bussterminal"
106        }
107      },
108      "trip": {
109        "trip_id": "141010001328007643",
110        "start_date": "2025-04-01",
111        "technical_number": 21
112      },
113      "agency": {
114        "id": "505000000000000636",
115        "name": "Öresundståg",
116        "operator": "Transdev Sverige AB"
117      },
118      "stop": {
119        "id": "2",
120        "name": "Göteborg Centralstation",
121        "lat": 57.709299,
122        "lon": 11.973659
123      },
124      "scheduled_platform": {
125        "id": "9022050000002017",
126        "designation": "9"
127      },
128      "realtime_platform": {
129        "id": "9022050000002017",
130        "designation": "9"
131      },
132      "alerts": [],
133      "is_realtime": false
134    },
135    {
136      "scheduled": "2025-04-01T14:59:00",
137      "realtime": "2025-04-01T14:59:00",
138      "delay": 0,
139      "canceled": false,
140      "route": {
141        "name": "MTRX",
142        "designation": null,
143        "transport_mode_code": 100,
144        "transport_mode": "TRAIN",
145        "direction": "Stockholm C",
146        "origin": {
147          "id": "71314",
148          "name": "Göteborg C"
149        },
150        "destination": {
151          "id": "1",
152          "name": "Stockholm Centralstation"
153        }
154      },
155      "trip": {
156        "trip_id": "680000000000000109",
157        "start_date": "2025-04-01",
158        "technical_number": 27580
159      },
160      "agency": {
161        "id": "505000000000000159",
162        "name": "MTR Express AB",
163        "operator": "MTR Express AB"
164      },
165      "stop": {
166        "id": "71314",
167        "name": "Göteborg C",
168        "lat": 57.708918,
169        "lon": 11.973946
170      },
171      "scheduled_platform": null,
172      "realtime_platform": null,
173      "alerts": [],
174      "is_realtime": false
175    }
176  ]
177}
  1{
  2  "timestamp": "2025-04-01T14:42:24",
  3  "query": {
  4    "queryTime": "2025-04-01T14:42:00",
  5    "query": "740000003"
  6  },
  7  "stops": [
  8    {
  9      "id": "3",
 10      "name": "Malmö Centralstation",
 11      "lat": 55.608777,
 12      "lon": 13.000216,
 13      "transport_modes": [
 14        "TRAIN",
 15        "BUS"
 16      ],
 17      "alerts": []
 18    }
 19  ],
 20  "arrivals": [
 21    {
 22      "scheduled": "2025-04-01T14:39:00",
 23      "realtime": "2025-04-01T14:42:23",
 24      "delay": 203,
 25      "canceled": false,
 26      "route": {
 27        "name": "Ringlinjen",
 28        "designation": "3",
 29        "transport_mode_code": 700,
 30        "transport_mode": "BUS",
 31        "direction": "Ringlinjen via Fridhemstorget",
 32        "origin": {
 33          "id": "26806",
 34          "name": "Malmö Värnhem"
 35        },
 36        "destination": {
 37          "id": "26806",
 38          "name": "Malmö Värnhem"
 39        }
 40      },
 41      "trip": {
 42        "trip_id": "121120000367831560",
 43        "start_date": "2025-04-01",
 44        "technical_number": 137
 45      },
 46      "agency": {
 47        "id": "505000000000000012",
 48        "name": "Skånetrafiken",
 49        "operator": "Nobina Sverige AB"
 50      },
 51      "stop": {
 52        "id": "3",
 53        "name": "Malmö Centralstation",
 54        "lat": 55.608777,
 55        "lon": 13.000216
 56      },
 57      "scheduled_platform": {
 58        "id": "9022050000003004",
 59        "designation": "D"
 60      },
 61      "realtime_platform": {
 62        "id": "9022050000003004",
 63        "designation": "D"
 64      },
 65      "alerts": [],
 66      "is_realtime": true
 67    },
 68    {
 69      "scheduled": "2025-04-01T15:12:00",
 70      "realtime": "2025-04-01T15:08:22",
 71      "delay": -218,
 72      "canceled": false,
 73      "route": {
 74        "name": "Ø Göteborg - Halmstad - Helsingborg - Malmö - Købe",
 75        "designation": "804",
 76        "transport_mode_code": 100,
 77        "transport_mode": "TRAIN",
 78        "direction": "Göteborg C",
 79        "origin": {
 80          "id": "25317",
 81          "name": "København Østerport"
 82        },
 83        "destination": {
 84          "id": "2",
 85          "name": "Göteborg Centralstation"
 86        }
 87      },
 88      "trip": {
 89        "trip_id": "121120000357559623",
 90        "start_date": "2025-04-01",
 91        "technical_number": 1082
 92      },
 93      "agency": {
 94        "id": "505000000000000636",
 95        "name": "Öresundståg",
 96        "operator": "Transdev Sverige AB"
 97      },
 98      "stop": {
 99        "id": "3",
100        "name": "Malmö Centralstation",
101        "lat": 55.608777,
102        "lon": 13.000216
103      },
104      "scheduled_platform": {
105        "id": "9022050000003019",
106        "designation": "4a"
107      },
108      "realtime_platform": {
109        "id": "9022050000003019",
110        "designation": "4a"
111      },
112      "alerts": [
113        {
114          "type": "OTHER_CAUSE",
115          "title": "Kort tåg - 2 mot 3",
116          "text": "Tåget kör med två tågsätt istället för tre på sträckan København Østerport - Helsingborg C. Orsaken är vagnbrist. "
117        }
118      ],
119      "is_realtime": true
120    }
121  ]
122}

Response data fields

The structure for departure and arrival boards is nearly identical. We list the most commonly used fields for both endpoints in this table. When we write departure/arrival, apply the one that matches the endpoint you’re using.

DeparturesResponse / ArrivalsResponse

NameData typeDescription
timestampStringList of departures or arrivals.
query.queryTimeStringThe time for which departures/arrivals are requested.
query.queryStringThe queried area/rikshallplats id.
stopsStop[]The stops which are included in the query, one or more.
stop.idStringThe stop id.
stop.nameDatumThe stop name.
stop.latStringThe stop latitude.
stop.lonStringThe top longitude.
stop.transport_modesStringTransport modes stopping at this stop. This is based on actual traffic in the current timetable period. If a stop does not have traffic in the current timetable period, this array will be empty.
departures / arrivalsCallAtLocation[]Departures or arrivals from the given stop

CallAtLocation

NameData typeDescription
scheduledStringDeparture/Arrival time at this stop, formatted as YYYY-MM-DDTHH:mm:ss in the local timezone.
realtimeStringRealtime departure/arrival time at this stop, formatted as YYYY-MM-DDTHH:mm:ss in the local timezone. When no realtime data is available, the scheduled value is used. See also is_realtime.
delayIntegerThe delay, in seconds, for this departure/arrival. Can be negative in case the vehicle is early. Set to 0 when no realtime data is available, see also is_realtime.
canceledStringStop latitude (WGS84, decimal degree), ex 59.293611
agency.idStringA unique id identifying this agency. Matches GTFS Sweden 3.
agency.nameStringThe name of the agency responsible for this trip.
agency.operatorStringThe name of the company running the trip, such as Nobina, Keolis, … . May be null when unknown.
route.nameStringStop longitude (WGS84, decimal degree), ex 18.083056
route.designationStringInternal id, do not use
route.transport_modeStringThe transport mode for this route, one of
  • BUS
  • METRO
  • TRAIN
  • TRAM
  • TAXI
  • BOAT
route.transport_mode_codeIntegerThe specific GTFS transport mode code for this route. See GTFS extended route types.
route.directionStringThe direction for this route, which is for example shown on the front of buses. This text may be different for the same route at different stops, for example “A via B” will often change to just “A” after stop B has been passed.
route.origin.idStringThe id of the first stop on this route.
route.origin.nameStringThe name of the first stop on this route.
route.destination.idStringThe id of the last stop on this route.
route.destination.nameStringThe name of the last stop on this route.
trip.trip_idStringThe trip id, which can be used in combination with start_date to uniquely identify a trip. Matches GTFS Sweden 3 and GTFS Sweden 3 realtime data.
trip.start_dateStringThe date on which this trip was started.
trip.technical_numberIntegerThe technical trip number of this trip. Uniquely identifies a trip in combination with start_date and agency.id.
stopStopInformation about the stop where the departure/arrival takes place. Since a queried area can contain multiple stops, this field can be used to identify at which of the stops this departure/arrival takes place.
stop.idStringThe stop id.
stop.nameStringThe stop name.
stop.latStringThe stop latitude.
stop.lonStringThe top longitude.
scheduled_platformPlatformInformation about the scheduled platform. Null if no platform information is available.
scheduled_platform.idStringThe scheduled platform id.
scheduled_platform.nameStringThe scheduled platform name.
realtime_platformPlatformInformation about the realtime platform. If no realtime data is available, the scheduled platform data is used, see also is_realtime. Null if no platform information is available.
realtime_platform.idStringThe realtime platform id.
realtime_platform.nameStringThe realtime platform name.
alertsAlert[]Any messages for this stop, for example regarding roadworks, delays, changed routes etc.
is_realtimeBooleanIndicates weather realtime data is available for this departure/arrival. When false, realtime fields have been filled with scheduled data for easier client-side implementations.

License

The Trafiklab Timetables API is available under the CC-BY 4.0 license. You should mention the data is provided by Trafiklab.se.

You are free to:

  • Share — copy and redistribute the material in any medium or format for any purpose, even commercially.
  • Adapt — remix, transform, and build upon the material for any purpose, even commercially.
  • The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

  • Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Notices:

You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation .

No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.

https://creativecommons.org/licenses/by/4.0/legalcode.txt