Trafiklab (Sweden)
Trafiklab provides access to Swedish public transport data through various APIs.
Coverage Area
- All of Sweden
- All regional transit operators
- SJ (national rail)
API Details
| Property | Value |
|---|---|
| Base URL | https://realtime-api.trafiklab.se/v1/ |
| API Key | Required (free) |
| Timezone | Europe/Stockholm |
API Key
Getting an API Key
- Register at trafiklab.se
- Create a new project
- Select the "Realtime API"
- Copy the API key
- Enter it during integration setup
Note
The API key is free but required. Registration takes just a few minutes.
API Key in Configuration
The API key is stored securely in your Home Assistant configuration and is used for:
- Stop/station search
- Fetching real-time departures
Transport Types
| Mode | Type | Description |
|---|---|---|
| TRAIN | train | Commuter and regional trains |
| METRO | subway | Stockholm Metro (Tunnelbana) |
| TRAM | tram | Trams (Göteborg, Norrköping, etc.) |
| BUS | bus | All bus services |
| FERRY | ferry | Ferry services |
| TAXI | taxi | Taxi/On-demand |
Configuration
Setup Steps
- Select Trafiklab as provider
- Enter your API key
- Search for your stop (e.g., "Stockholm Centralstation")
- Select the stop from the list
- Configure departure count and filters
Example Stops
- Stockholm Centralstation
- Göteborg Centralstation
- Malmö Centralstation
- Uppsala Centralstation
Special Features
Nationwide Coverage
Trafiklab aggregates data from all Swedish transit operators, providing a unified view of:
- SJ (national rail)
- SL (Stockholm)
- Västtrafik (Gothenburg region)
- Skånetrafiken (Malmö region)
- And many more
Real-time Data
Real-time data is available when the is_realtime flag is true in the API response. This indicates live tracking data rather than scheduled times.
API URLs
Stop Search
Departures
Troubleshooting
API Key Issues
If you get a 401 error:
- Verify your API key is correct
- Check that the key is active in your Trafiklab project
- Ensure you're using the Realtime API key (not another API)
No Results
If searches return no results:
- Try different spellings
- Use the Swedish name for the location
- Check that the stop exists in Trafiklab's database