BYTETOOLS

Statistics Sweden (SCB) API

Free Statistics Sweden API with no key: browse the SSD statistical database as a tree, then query any table for population, prices, housing and labour data. Tested example.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the Statistics Sweden (SCB) API?

Statistics Sweden (SCB) publishes its Statistical Database through a free PxWeb API needing no key. Navigation is hierarchical: a GET on any node returns its children as a list of typed entries, and a GET on a leaf returns that table's variables ready to query.

The API is a directory you walk rather than a catalogue you search. A GET on `/ssd/BE` returns the population subject area's children as objects with `id`, `type` and `text` — `type: "l"` for a level you can descend into and `type: "t"` for a table that holds data. Keep descending until you reach a table, then GET it once more to see its variables, their permitted values and value texts. That last response is effectively the query schema.

Retrieving figures uses POST with a JSON body naming each variable and the codes you want, and returns JSON-stat or the compact `px` format. That POST is the only write-shaped call in the whole API and it changes nothing — it is a query, not a mutation. Language is chosen in the path: `/en/` for English metadata, `/sv/` for Swedish, with identical structure either way. Table identifiers such as `BE0101` are stable and cited throughout Swedish statistical literature.

Quick facts

Base URL
https://api.scb.se/OV0104/v1/doris
Authentication
No API key. SCB asks for reasonable use and publishes a call quota per time window rather than a hard key requirement.
Rate limit
SCB documents a limit on calls per ten-second window and a cap on cells per response. Walk the tree once and cache it.
Pricing
Free. SCB data is published under Creative Commons Zero, so no attribution is legally required.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Statistics Sweden (SCB) API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Browse the Swedish population statistics tree

GET https://api.scb.se/OV0104/v1/doris/en/ssd/BE

curl
curl 'https://api.scb.se/OV0104/v1/doris/en/ssd/BE'
JavaScript (fetch)
const res = await fetch("https://api.scb.se/OV0104/v1/doris/en/ssd/BE");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://api.scb.se/OV0104/v1/doris/en/ssd/BE", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
[
  {
    "id": "BE0001",
    "type": "l",
    "text": "Name statistics"
  },
  {
    "id": "BE0401",
    "type": "l",
    "text": "Population projections"
  },
  {
    "id": "BE0701",
    "type": "l",
    "text": "Demographic Analysis (Demography)"
  },
  {
    "id": "BE0101",
    "type": "l",
    "text": "Population statistics"
  }
]

Parameters

ParameterTypeRequiredDescription
{lang}pathRequired`en` for English or `sv` for Swedish metadata. en
{path}pathRequiredNode path within the statistical database, for example `ssd/BE` for population. ssd/BE
(POST body)bodyOptionalOn a table node, a JSON query naming variables, selection codes and response format. {"query":[],"response":{"format":"json-stat2"}}

Response fields

idstring
Node identifier such as `BE0101`. Append it to the current path to descend.
typestring
`l` for a level with children, `t` for a table that holds data. This is how you know when to stop walking.
textstring
Human label for the node, in the language chosen in the path.
variablesarray
Returned when you GET a table: each variable with its code, label, permitted values and value texts.
variables[].eliminationboolean
Whether the variable may be omitted from a query. If false, you must supply a selection for it.
variables[].timeboolean
Marks the time variable, which is the one you usually filter to a recent range.

What you can build with the Statistics Sweden (SCB) API

  • Pull Swedish population, housing or price statistics into a report
  • Build a Swedish or English statistics browser over the SSD tree
  • Automate a recurring extract of an official Swedish series
  • Discover a table's query schema before writing the request

Common errors and how to fix them

403 or a throttling message

SCB caps calls per ten-second window.

Fix: Space out requests and cache the tree structure, which changes rarely.

Query rejected as too large

The response would exceed the cell limit.

Fix: Narrow the selection — filter the time variable to recent periods and pick specific region codes.

400 on a table query

A non-eliminable variable was omitted.

Fix: GET the table first and supply a selection for every variable whose `elimination` is false.

Descending returns nothing

You tried to walk into a table node.

Fix: `type: "t"` is a leaf. GET it to see its variables, then POST a query rather than appending another path segment.

Statistics Sweden (SCB) API — frequently asked questions

Is the Statistics Sweden API free?

Yes, with no key or registration. SCB publishes under Creative Commons Zero, so you are not even legally required to attribute, though it is good practice.

Why do I need to POST to get data?

The query is too structured for a query string — it names each variable and the codes selected for it. The POST is read-only and changes nothing on SCB's side; it is a query envelope, not a mutation.

How do I find a table?

Walk the tree from `/ssd`, following entries with `type: "l"` until you reach one with `type: "t"`. Table IDs such as BE0101 are stable, so once you know the one you need you can go straight to it.

Can I get English labels?

Yes. Put `en` in the path instead of `sv` and every label, variable name and value text comes back in English, with the same structure and identifiers.

Tools that pair with this API

Statistics Sweden (SCB) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.