# Government Statistics API: World Bank + Eurostat Time Series (`henrycrawl/gov-statistics-hub`) Actor

Official statistics by keyword or indicator id for any country: GDP, inflation, unemployment, population, debt and 1,500+ World Bank indicators plus every Eurostat dataset. One clean time series per country with latest value and change. For AI agents. Pay per series.

- **URL**: https://apify.com/henrycrawl/gov-statistics-hub.md
- **Developed by:** [Henry Crawl](https://apify.com/henrycrawl) (community)
- **Categories:** AI, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 time series

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Government Statistics API: World Bank + Eurostat Time Series

**Ask for an indicator in plain words — "gdp growth", "inflation", "unemployment", "population", "government
debt" — for any list of countries, and get one clean official time series per country**, with the latest value,
change from the previous period, min / max, unit and a link to the source.

Two official sources in one call:

| Source | Coverage | Frequency |
|---|---|---|
| **World Bank** — World Development Indicators | 1,500+ indicators, every country and aggregates (WLD, EUU, EAS…) | annual |
| **Eurostat** — every dataset in the EU statistics catalogue (12,000+) | EU / EEA countries, EU27_2020, euro area | monthly, quarterly, annual |

Built for AI agents that need a real number with its source, analysts comparing countries, and dashboards / RAG.

### Input

```json
{
  "indicators": ["gdp growth", "inflation", "unemployment"],
  "countries": ["US", "DE", "FR", "JP", "VN"],
  "startYear": 2015,
  "maxIndicatorsPerKeyword": 1
}
```

- **Words** are matched against official indicator names (abbreviations like GDP / CPI are understood; male /
  female / age breakdowns are only picked when you ask for them).
- **Exact ids**: `WB:NY.GDP.MKTP.KD.ZG` (any World Bank code) or `ESTAT:une_rt_m?sex=T&age=TOTAL&unit=PC_ACT&s_adj=SA`
  (any Eurostat dataset with dimension filters).
- For Eurostat datasets with several dimensions the actor picks the headline series (total, seasonally adjusted,
  percentage…) and lists the other codes in `otherOptions` so an agent can refine the next call.

### Output (one row per indicator × country)

```json
{
  "type": "series",
  "status": "OK",
  "query": "gdp growth",
  "sourceCode": "WB",
  "indicatorId": "NY.GDP.MKTP.KD.ZG",
  "indicatorName": "GDP growth (annual %)",
  "country": "VN",
  "countryName": "Viet Nam",
  "frequency": "annual",
  "observations": [{"period": "2024", "value": 7.09}, {"period": "2025", "value": 8.02}],
  "latestPeriod": "2025",
  "latestValue": 8.02,
  "changeFromPrevious": 0.93,
  "changePercentFromPrevious": 13.1,
  "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.KD.ZG?locations=VN",
  "scrapedAt": "2026-11-16T06:30:00Z"
}
```

A country with no values in the period returns a free `NO_DATA` row; words that match nothing return a free
`NO_MATCH` row with suggestions.

### Pricing

**$0.002 per series** (a whole time series for one indicator and one country, not per data point).
Error rows are never charged. 10 indicators × 20 countries = $0.40.

### Use with AI agents (MCP)

`https://mcp.apify.com/?tools=henrycrawl/gov-statistics-hub` — e.g. `{"indicators": ["inflation"], "countries": ["US", "GB", "JP"]}`.

### Notes

- The World Bank API can be slow (up to a minute per indicator at busy times); runs wait and retry.
- Eurostat aggregates: `EU27_2020`, `EA20`. Greece is `GR` (sent to Eurostat as `EL`), the UK `GB` (`UK`).

# Actor input Schema

## `indicators` (type: `array`):

What to fetch: plain words ("gdp growth", "unemployment", "inflation", "population", "government debt") matched against official indicator names, or exact ids: WB:<World Bank code> (e.g. WB:NY.GDP.MKTP.KD.ZG) and ESTAT:<dataset>?<filters> (e.g. ESTAT:une_rt_m?sex=T\&age=TOTAL\&unit=PC_ACT\&s_adj=SA).

## `countries` (type: `array`):

ISO country codes (2 or 3 letters, e.g. US, DE, VNM). World Bank also accepts aggregates like WLD, EUU, EAS. Eurostat answers only EU / EEA countries and EU27_2020 / EA20.

## `sources` (type: `array`):

Where keyword searches look. Default: both.

## `startYear` (type: `integer`):

First year of the series (default: 10 years ago).

## `endYear` (type: `integer`):

Last year of the series (default: this year).

## `maxIndicatorsPerKeyword` (type: `integer`):

How many best-matching indicators to fetch for each keyword in each source (1 = the best match only).

## `includeObservations` (type: `boolean`):

Return every period's value. Turn off to get only the latest value and change (smaller output).

## Actor input object example

```json
{
  "indicators": [
    "gdp growth",
    "inflation"
  ],
  "countries": [
    "US",
    "DE",
    "FR",
    "JP"
  ],
  "maxIndicatorsPerKeyword": 1,
  "includeObservations": true
}
```

# Actor output Schema

## `results` (type: `string`):

One row per indicator x country series, plus free error rows (NO_DATA, NO_MATCH...).

## `summary` (type: `string`):

Counts for this run (SUMMARY record).

# 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 = {
    "indicators": [
        "gdp growth",
        "inflation"
    ],
    "countries": [
        "US",
        "DE",
        "FR",
        "JP"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("henrycrawl/gov-statistics-hub").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 = {
    "indicators": [
        "gdp growth",
        "inflation",
    ],
    "countries": [
        "US",
        "DE",
        "FR",
        "JP",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("henrycrawl/gov-statistics-hub").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "indicators": [
    "gdp growth",
    "inflation"
  ],
  "countries": [
    "US",
    "DE",
    "FR",
    "JP"
  ]
}' |
apify call henrycrawl/gov-statistics-hub --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,henrycrawl/gov-statistics-hub"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/GkENYbTAKlJi6ggNC/builds/dcGgcqufoZsNw7mBB/openapi.json
