Skip to content
SVERIGEFAKTA.com

Last updated: View changelog

Documentation

API access

All data on sverigefakta.com is free to use under CC BY 4.0. Most endpoints are fully open. Three heavier endpoints require a free API key — so that a single bot cannot take the site down for everyone else.

Requires a key

  • /api/all.zip

    The full data package as a zip archive.

  • /api/manifest.json

    Machine-readable manifest with size, columns and URL for every dataset.

  • /api/dataset-index.json

    Search index across all datasets (for crawlers and third-party clients).

Request a key

To request a free API key, email us from the alias shown on the Support the site page. Briefly describe what you plan to use the data for (research, journalism, student project, personal build — all are accepted, but we want to know). The key is returned within a day.

Use the key

Send the key either as HTTP header x-api-key or as a query parameter ?key=.

# Header (recommended)
curl -H "x-api-key: YOUR_KEY" \
  https://sverigefakta.com/api/all.zip -o sverigefakta.zip

# Query (convenient in a browser)
https://sverigefakta.com/api/manifest.json?key=YOUR_KEY

Open endpoints (no key)

  • /api/trends/json
  • /api/trends/csv
  • /api/kommuner/json
  • /api/kommuner/csv
  • /api/observationer/json
  • /api/utsatta/json
  • /api/kohorter/json
  • /api/lander/json
  • /api/demokrati/json
  • /api/claims/json
  • /api/citat/json
  • /api/sources/json
  • /api/sources/csv
  • /sitemap.xml

These files are small, heavily cached, and cover most needs. Prefer them first.

Observation IDs (stable data points)

Every data point in the municipal engine has a deterministic, URL-safe and reversible ID of the form SF.<METRIC>.<GEO>.<PERIOD> — METRIC is the indicator id in upper case, GEO is the municipality code and PERIOD is the year. The ID is computed from the data and is never stored as a separate source of truth.

# A single data point
https://sverigefakta.com/api/observationer/json?id=SF.FOLKMANGD.1280.2024

# Time series for one municipality
https://sverigefakta.com/api/observationer/json?kommun=malmo&metric=folkmangd&from=2015

Revision log (what changed)

Every published observation is recorded append-only in Sverigefakta's revision log. The log is readable both as a public update log and as JSON.

# All recorded revisions (newest first)
https://sverigefakta.com/api/revisioner/json

# History for one data point
https://sverigefakta.com/api/revisioner/json?id=SF.FOLKMANGD.1280.2024

# Filter by municipality, metric or type
https://sverigefakta.com/api/revisioner/json?kommun=1280&metric=FOLKMANGD&type=new&limit=50

← Back to the dataset catalogue