Transport for Sweden API
Overview
Transport for Sweden (Trafiklab) is a developer platform providing access to public transport data across all of Sweden. It offers real-time departures, trip planning, and historical data from operators like SL (Stockholm) and Skanetrafiken. OAuth authentication is required, so you will need to register for a free developer account at trafiklab.se.
Beginner Tip
Register at trafiklab.se to get your API keys — most datasets offer a generous free tier for development. Start with the ResRobot API for nationwide trip planning as it covers all Swedish public transport.
Measurement Record
What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.
- Request
- GET https://developer.trafiklab.se/api/trafiklab-se/incidents
- Result
- HTTP 200 · application/json · 714 bytes · compressed
- Response time
- 36 ms (median of 3) · fastest 33 ms
- Transport
- TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Let's Encrypt
- Browser CORS
- Allowed — Access-Control-Allow-Origin: *
- Rate limit
- 60 per window (58 remaining at test time)
- Served by
- cloudflare
- Recorded
- 2026-08-10
Fields Returned
Top-level fields present in the response we captured, with the type and value we actually received.
| Field | Type | Value received |
|---|---|---|
| title | string | Siri-ET SL and Siri-VM Skånetrafiken are down |
| report_type | string | automatic |
| starts_at | string (date) | 2026-08-10T12:11:47.589Z |
| starts_at_formatted | string | Mon Aug 10 12:11 |
| ends_at | null | null |
| href | string (url) | https://status.trafiklab.se/incident/1007346 |
| affected_resources | array | [1 item] |
| status_updates | array | [1 item] |
Captured Response
Captured from a real request to https://developer.trafiklab.se/api/trafiklab-se/incidents on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.
[
{
"title": "Siri-ET SL and Siri-VM Skånetrafiken are down",
"report_type": "automatic",
"starts_at": "2026-08-10T12:11:47.589Z",
"starts_at_formatted": "Mon Aug 10 12:11",
"ends_at": null,
"href": "https://status.trafiklab.se/incident/1007346",
"affected_resources": [
{
"…": "(4 more fields)"
}
],
"status_updates": [
{
"…": "(2 more fields)"
}
]
}
] Implementation Example
Calls a real endpoint of this API. Replace any placeholder credentials with your own key.
const url = "https://api.resrobot.se/v2.1/departureBoard?id=740000001&format=json&accessId=YOUR_API_KEY";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
How This API Fails
We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.
{
"message": "The route api/trafiklab-se/incidents/apisscore-nonexistent-path could not be found."
} Common Errors & Troubleshooting
Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.
Measured Score Breakdown
Live HTTP request to the API endpoint
Fully tested on Aug 10, 2026
Technical Specifications
Related Tags
Similar APIs
View All →Amadeus for Developers
Amadeus for Developers is an OAuth2-protected travel API offering flight search, hotel availability, airport information, and more from one of the largest global distribution systems.
apilayer aviationstack
Aviationstack by apilayer provides real-time flight status, schedules, and global aviation data including airports and airlines.
BIC-Boxtech
BIC-Boxtech provides technical specifications for shipping containers in the global fleet, including dimensions, tare weight, and capacity details.
Grab
The Grab API allows developers to integrate Grab services — including ride-hailing, food delivery, and payments — into their own applications across Southeast Asia.
Transport for Sao Paulo, Brazil
The SPTrans Olho Vivo API provides real-time bus tracking data for São Paulo's massive municipal bus system in Brazil, one of the largest in the world.