# Statistics Sweden (SCB) Scraper (`parseforge/statistik-sweden-scraper`) Actor

Scrape any dataset from Statistics Sweden via the SCB open data API. Population, employment, GDP, prices, exports, education, regional data. No API key required.

- **URL**: https://apify.com/parseforge/statistik-sweden-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $26.33 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🇸🇪 Statistics Sweden (SCB) Scraper

> 🚀 **Export any official Swedish statistic in seconds.** Browse the SCB tree, inspect a table's variables, or query the actual data points (population, GDP, employment, prices, trade, education, regional). No API key, no registration, no manual CSV wrangling.

> 🕒 **Last updated:** 2026-05-13 · **📊 3 modes**, JSON-stat decoded · **🇸🇪 Full SCB catalog** · **🌐 EN + SV labels**

The **Statistics Sweden (SCB) Scraper** wraps the official SCB open data API (`api.scb.se/OV0104/v1/doris`) and turns the JSON-stat response into flat rows. The underlying dataset is published by **Statistics Sweden (Statistiska centralbyrån)**, the Swedish government agency that has compiled national statistics since 1858.

The catalog covers every subject area SCB tracks. Population, labour market, national accounts, prices and consumption, trade, education, agriculture, environment, transport, public finance, living conditions, and regional breakdowns down to municipality level. This Actor returns table metadata, variable lists, or fully expanded data points with one dimension combination per row, ready to download as CSV, Excel, JSON, or XML.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Economists, journalists, GIS analysts, demographers, fintech and proptech teams, academic researchers, public-sector planners, data engineers | Population pyramids, regional dashboards, inflation tracking, labour-market reports, ESG benchmarks, OSM enrichment, longitudinal studies |

---

### 📋 What the Statistics Sweden Scraper does

Three operating modes in a single Actor:

- 🌳 **Browse mode.** Walks the SCB tree starting from any node. Empty path returns the 20+ top-level subject areas (BE for population, AM for labour, NR for national accounts, PR for prices). Drill down a level at a time to discover tables.
- 📑 **Table mode.** Returns one row per dimension of a single table. Each row lists the variable code, label, value count, and a sample of valid codes plus their localized labels. Use this to figure out which filter codes to send before pulling the data.
- 📊 **Data mode.** POSTs a JSON-stat query against a table endpoint and decodes the multi-dimensional response into flat rows. One row per dimension combination, with the numeric value, every dimension code, every localized label, the unit (persons, SEK, percent, etc.), and the source URL.

Output language switches between English and Swedish on a single input field. The Actor automatically caps unfiltered dimension queries so SCB does not reject them as too large.

> 💡 **Why it matters:** Sweden publishes one of the deepest open national-statistics catalogs in Europe, but the raw JSON-stat format is hostile to spreadsheets. This Actor decodes the cube into flat rows you can drop into BI tools, dashboards, or training datasets without writing a parser.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to browse the SCB tree, pick a table, and export real data points._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>mode</code></td><td>enum</td><td><code>"browse"</code></td><td><code>browse</code> lists tree nodes, <code>table</code> returns variable metadata, <code>data</code> returns actual values.</td></tr>
<tr><td><code>path</code></td><td>string</td><td><code>""</code></td><td>Tree path for browse mode. Empty = root. Examples: <code>BE</code>, <code>BE/BE0101</code>, <code>AM</code>, <code>NR</code>.</td></tr>
<tr><td><code>tableId</code></td><td>string</td><td><code>"BE/BE0101/BE0101A/BefolkningNy"</code></td><td>Full table path. Required in <code>table</code> and <code>data</code> modes.</td></tr>
<tr><td><code>dataFilters</code></td><td>object</td><td><code>{}</code></td><td>Dimension code -&gt; list of values to include. Example: <code>{"Region":["00"], "Alder":["tot"], "Kon":["1","2"]}</code>.</td></tr>
<tr><td><code>language</code></td><td>enum</td><td><code>"en"</code></td><td>Response language for table titles and value labels. <code>en</code> or <code>sv</code>.</td></tr>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
</tbody>
</table>

**Example: browse the Population subject area.**

```json
{
    "mode": "browse",
    "path": "BE",
    "language": "en",
    "maxItems": 50
}
````

**Example: pull Swedish population by sex and age for 2024.**

```json
{
    "mode": "data",
    "tableId": "BE/BE0101/BE0101A/BefolkningNy",
    "dataFilters": {
        "Region": ["00"],
        "Civilstand": ["OG"],
        "Kon": ["1", "2"],
        "Tid": ["2024"]
    },
    "language": "en",
    "maxItems": 100
}
```

> ⚠️ **Good to Know:** SCB rejects queries that produce too many cells (HTTP 403/400). The Actor caps unfiltered non-time dimensions to a small sample and the time dimension to the latest period unless you set explicit values in `dataFilters`. Always preview a table with `mode: "table"` first to discover the dimension codes.

***

### 📊 Output

Each mode returns a different row shape. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema for `data` mode

| Field | Type | Example |
|---|---|---|
| 🆔 `tableId` | string | `"BE/BE0101/BE0101A/BefolkningNy"` |
| 📛 `title` | string | `"Population by region, marital status, age, sex, observations and year"` |
| 🔢 `value` | number | null | `50937` |
| 🧭 `dimensions` | object | `{"Region": "00", "Kon": "1", "Tid": "2024"}` |
| 🏷️ `dimensionLabels` | object | `{"Region": "Sweden", "Kon": "men", "Tid": "2024"}` |
| 📐 `unit` | string | null | `"number of persons"` |
| 🔗 `url` | string | `"https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/BefolkningNy"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-12T23:44:23.667Z"` |

#### 🧾 Schema for `browse` mode

| Field | Type | Example |
|---|---|---|
| 🆔 `id` | string | `"BE0101"` |
| 🏷️ `type` | string | `"l"` (level) or `"t"` (table) |
| 📛 `text` | string | `"Population statistics"` |
| 🔗 `url` | string | `"https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-12T23:44:23.667Z"` |

#### 🧾 Schema for `table` mode

| Field | Type | Example |
|---|---|---|
| 🆔 `tableId` | string | `"BE/BE0101/BE0101A/BefolkningNy"` |
| 📛 `title` | string | `"Population by region, marital status, age, sex, observations and year"` |
| 🔡 `variableCode` | string | `"Region"` |
| 🏷️ `variableText` | string | `"region"` |
| 🔢 `valueCount` | integer | `312` |
| 📋 `sampleValues` | string\[] | `["00", "01", "0114", "0115", "0117"]` |
| 📋 `sampleValueTexts` | string\[] | `["Sweden", "Stockholm county", "Upplands Vasby", "..."]` |
| 🔗 `url` | string | `"https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/BefolkningNy"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-12T23:44:23.667Z"` |

#### 📦 Sample record (data mode)

<details>
<summary><strong>👶 Newborn boys, single status, Sweden, 2024</strong></summary>

```json
{
    "tableId": "BE/BE0101/BE0101A/BefolkningNy",
    "title": "Population by region, marital status, age, sex, observations and year",
    "value": 50937,
    "dimensions": {
        "Region": "00",
        "Civilstand": "OG",
        "Alder": "0",
        "Kon": "1",
        "ContentsCode": "BE0101N1",
        "Tid": "2024"
    },
    "dimensionLabels": {
        "Region": "Sweden",
        "Civilstand": "single",
        "Alder": "0 years",
        "Kon": "men",
        "ContentsCode": "Population",
        "Tid": "2024"
    },
    "unit": "number of persons",
    "url": "https://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101A/BefolkningNy",
    "scrapedAt": "2026-05-12T23:44:23.667Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🌳 | **Tree-walking browser.** Discover the entire SCB catalog from the root, one node at a time. |
| 📑 | **Table introspection.** Get every dimension, code, and label of any table before you query data. |
| 📊 | **JSON-stat decoder.** Multi-dimensional cube becomes flat rows automatically. |
| 🌐 | **Bilingual.** Switch between English and Swedish labels on a single input. |
| 🛡️ | **Safe defaults.** Unfiltered queries auto-cap so SCB does not reject them as too large. |
| ⚡ | **Fast.** 10 data points in under 3 seconds, 10,000 records in under a minute. |
| 🚫 | **No authentication.** SCB publishes the data under an open license. No key needed. |

> 📊 Sweden's open statistics catalog underpins half of the Nordic data-journalism industry. The SCB API is the source, this Actor turns it into rows.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ Statistics Sweden Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **Full SCB catalog** | **Live per run** | Tree path, table id, per-dimension filters, language | ⚡ 2 min |
| Manual CSV downloads from scb.se | Free | Single tables at a time | On demand | UI checkboxes | 🐢 Slow, no automation |
| Roll-your-own JSON-stat parser | Free | Full | Live | Custom | 🛠️ Hours of engineering |
| Third-party Nordic data vendors | $$ subscriptions | Curated subset | Vendor cadence | Vendor-specific | ⏳ Days |

Pick this Actor when you want a programmable interface to the official SCB API with the cube already decoded.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the Statistics Sweden (SCB) Scraper page on the Apify Store.
3. 🌳 **Browse first.** Set `mode: "browse"` with an empty `path` to see all subject areas. Drill down until you find a table.
4. 📑 **Inspect the table.** Switch to `mode: "table"` and set `tableId` to the full path. Read the variable codes.
5. 📊 **Query data.** Switch to `mode: "data"`, set `dataFilters` to scope the slice, click **Start**.
6. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 📈 Economic Research & Finance

- Track Swedish CPI, PPI, and HICP for inflation reports
- Pull quarterly GDP for forecasting models
- Wage and household-income trends for compensation studies
- Labour-market series for currency and rates desks

</td>
<td width="50%" valign="top">

#### 🏘️ Proptech & Demographics

- Population by municipality for site-selection models
- Age-sex pyramids for product-market sizing
- Migration flows for rental-market forecasting
- Education attainment for talent-density maps

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 📰 Data Journalism

- Reproducible tables sourced direct from SCB
- Time-series for charts in long-form articles
- Cross-municipality comparisons for investigative pieces
- Live refresh on publication date for newsroom dashboards

</td>
<td width="50%" valign="top">

#### 🏛️ Public Sector & Policy

- Regional planning datasets with one-click refresh
- Public-health denominators by age band
- Trade and energy series for industrial policy briefings
- Reproducible baselines for budget and grant reviews

</td>
</tr>
</table>

***

### 🔌 Automating Statistics Sweden Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Hourly, daily, or weekly refreshes keep downstream databases in sync automatically.

***

### 🌟 Beyond business use cases

The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Longitudinal demographic and labour studies
- Reproducible cited datasets for theses and papers
- Open-data assignments for statistics coursework
- Comparative Nordic policy research

</td>
<td width="50%">

#### 🎨 Personal and creative

- Side projects mapping Swedish municipalities
- Data-viz portfolios with current census numbers
- Travel and migration analyses for personal blogs
- Bilingual content backed by official figures

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- NGO reports on inequality and regional disparities
- Civic transparency dashboards for municipalities
- Public-interest journalism on inflation and wages
- Health-org denominators for vaccination coverage

</td>
<td width="50%">

#### 🧪 Experimentation

- Train forecasting models on official series
- Validate fintech product hypotheses with macro data
- Prototype LLM agents that answer stats questions
- Test BI dashboards with live SCB feeds

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20Statistics%20Sweden%20SCB%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20Statistics%20Sweden%20SCB%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20Statistics%20Sweden%20SCB%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20Statistics%20Sweden%20SCB%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

The Actor hits the official SCB JSON-stat API (`api.scb.se/OV0104/v1/doris`). In `browse` mode it lists tree nodes. In `table` mode it returns variable metadata. In `data` mode it POSTs a JSON-stat query and decodes the multi-dimensional response into flat rows, one per dimension combination.

#### 🌳 How do I find a table?

Start in `browse` mode with an empty `path` to see the top-level subject areas (BE for population, AM for labour, NR for national accounts, PR for prices, etc.). Drill down a level at a time. The tree node `id` becomes the next path segment. Tables are nodes with `type` `"t"`.

#### 📐 What does the value mean?

The `value` is the numeric measurement for the specific combination of dimension codes in that row. The `unit` field tells you what the value represents (persons, SEK, percent, kilograms, etc.).

#### 🇸🇪 Can I get Swedish labels?

Yes. Set `language: "sv"` for Swedish labels on titles, dimension labels, and value labels. The default is English.

#### 🛡️ Why do I get a 403 error?

SCB rejects queries that produce too many cells (typically 50,000+). Use `dataFilters` to scope the slice. The Actor caps unfiltered non-time dimensions automatically, but very wide tables may still trip the limit.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to run this Actor on any cron interval (hourly, daily, weekly) and keep a downstream database in sync.

#### ⚖️ Is this data legal to use?

SCB publishes statistics under an open license (CC BY 4.0 in most cases). Cite Statistics Sweden as the source. Review the specific table license before commercial redistribution.

#### 💼 Can I use this data commercially?

Yes. Official Swedish statistics are public information and can be used in commercial products. You are responsible for proper attribution and complying with the SCB terms of use.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit to 1,000,000 records.

#### 🔁 What happens if a run fails?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input (often a `dataFilters` issue), and re-run.

#### 🌍 Does it cover other Nordic countries?

This Actor covers Statistics Sweden. For wider EU and member-state coverage, see the Eurostat Statistics Scraper in the recommended actors below.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

Statistics Sweden Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications in your channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe statistics into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh SCB data into your product backend, or alert your team in Slack.

***

### 🔗 Recommended Actors

- [**🇪🇺 Eurostat Statistics Scraper**](https://apify.com/parseforge/destatis-genesis-scraper) - 7,500+ Eurostat datasets across EU member states
- [**📊 FRED Macroeconomic Data Scraper**](https://apify.com/parseforge/fred-scraper) - U.S. Federal Reserve economic series
- [**📈 Indexmundi Scraper**](https://apify.com/parseforge/indexmundi-scraper) - Global demographic and economic indicators
- [**🗺️ Nominatim OSM Scraper**](https://apify.com/parseforge/nominatim-osm-scraper) - Geocode Swedish addresses via OpenStreetMap
- [**✈️ OurAirports Global Airport Database Scraper**](https://apify.com/parseforge/ourairports-scraper) - 85,000+ airports worldwide

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Statistics Sweden (Statistiska centralbyrån) or the Swedish government. All trademarks mentioned are the property of their respective owners. Only publicly available open data from the official SCB API is collected.

# Actor input Schema

## `mode` (type: `string`):

browse: list nodes (subject areas, sub-areas, tables). table: fetch a single table's variable list. data: POST a JSON-stat query and return the actual data points (one row per dimension combination).

## `path` (type: `string`):

Browse mode: path inside SCB tree. Empty = root subject areas. Examples: BE (Population), BE/BE0101 (Population statistics), AM (Labour market).

## `tableId` (type: `string`):

Used by table and data modes: full table path under the root, e.g. BE/BE0101/BE0101A/BefolkningNy or NR/NR0103/NR0103A/NR0103ENS2010T01A.

## `dataFilters` (type: `object`):

Map of dimension code → list of values to include. Example: {"Region":\["00"], "Alder":\["tot"], "Kon":\["1","2"]}. Omitted dimensions: all values for non-time dims, latest period only for time dims.

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## `language` (type: `string`):

Response language for table titles and value labels.

## Actor input object example

```json
{
  "mode": "browse",
  "path": "",
  "tableId": "BE/BE0101/BE0101A/BefolkningNy",
  "dataFilters": {},
  "maxItems": 10,
  "language": "en"
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview of scraped data

## `fullData` (type: `string`):

Complete dataset

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "browse",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/statistik-sweden-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "browse",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/statistik-sweden-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "browse",
  "maxItems": 10
}' |
apify call parseforge/statistik-sweden-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/statistik-sweden-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Statistics Sweden (SCB) Scraper",
        "description": "Scrape any dataset from Statistics Sweden via the SCB open data API. Population, employment, GDP, prices, exports, education, regional data. No API key required.",
        "version": "0.0",
        "x-build-id": "tFpS3ENXFjjMzf8Sb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~statistik-sweden-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-statistik-sweden-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~statistik-sweden-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-statistik-sweden-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~statistik-sweden-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-statistik-sweden-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "browse",
                            "table",
                            "data"
                        ],
                        "type": "string",
                        "description": "browse: list nodes (subject areas, sub-areas, tables). table: fetch a single table's variable list. data: POST a JSON-stat query and return the actual data points (one row per dimension combination).",
                        "default": "browse"
                    },
                    "path": {
                        "title": "Tree path",
                        "type": "string",
                        "description": "Browse mode: path inside SCB tree. Empty = root subject areas. Examples: BE (Population), BE/BE0101 (Population statistics), AM (Labour market).",
                        "default": ""
                    },
                    "tableId": {
                        "title": "Table ID",
                        "type": "string",
                        "description": "Used by table and data modes: full table path under the root, e.g. BE/BE0101/BE0101A/BefolkningNy or NR/NR0103/NR0103A/NR0103ENS2010T01A.",
                        "default": "BE/BE0101/BE0101A/BefolkningNy"
                    },
                    "dataFilters": {
                        "title": "Dimension filters (data mode only)",
                        "type": "object",
                        "description": "Map of dimension code → list of values to include. Example: {\"Region\":[\"00\"], \"Alder\":[\"tot\"], \"Kon\":[\"1\",\"2\"]}. Omitted dimensions: all values for non-time dims, latest period only for time dims.",
                        "default": {}
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    },
                    "language": {
                        "title": "Language",
                        "enum": [
                            "en",
                            "sv"
                        ],
                        "type": "string",
                        "description": "Response language for table titles and value labels.",
                        "default": "en"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
