# World Bank Data Scraper – Indicators by Country & Year (`biddata/worldbank-scraper`) Actor

Export World Bank development indicators by country and year from the official World Bank Open Data API: GDP, population, unemployment, CO2, inflation and 1400+ more. Public API, no key.

- **URL**: https://apify.com/biddata/worldbank-scraper.md
- **Developed by:** [QIQI](https://apify.com/biddata) (community)
- **Categories:** Other, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 result rows

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

## World Bank Data Scraper – Indicators by Country & Year

**Turn any of the World Bank's 1400+ development indicators into a tidy country-year table — from the official open data API, not from scraping data.worldbank.org page by page.**

The World Bank Open Data portal publishes GDP, population, unemployment, inflation, CO2 emissions, life expectancy, literacy, trade and hundreds of other indicators for around 200 economies, with series that reach back to 1960. It is one of the most widely used free economic datasets in the world.

This Actor queries the official `api.worldbank.org/v2` JSON API and returns one flat row per indicator / country / year: the code and name of the indicator, the country with its region and income group, the year, the value and the observation status.

### Why this Actor

| | Typical scrapers | This Actor |
|---|---|---|
| Access | Click the portal, export per country | One query returns every country at once |
| Data source | Website exports and dashboards | Official `api.worldbank.org/v2` JSON API |
| Country context | You join regions and income groups yourself | Region, income group and ISO2 code included |
| Shape | Portal CSV with its own column order | Fixed 11-column schema, newest year first |
| API key | Not needed on the site | Not needed here either — anonymous public access |

### What you get

One dataset item per indicator / country / year observation.

| Field | Type | Description |
|---|---|---|
| `indicator_id` | string | World Bank indicator code, e.g. NY.GDP.MKTP.CD. |
| `indicator_name` | string | Human-readable indicator name, e.g. GDP (current US$). |
| `country_code` | string | ISO 3166-1 alpha-3 country code, e.g. CHN. Aggregates use World Bank codes such as WLD or EAS. |
| `country_name` | string | Country or aggregate name as published by the World Bank. |
| `country_iso2` | string | ISO 3166-1 alpha-2 code from the World Bank country directory. Empty for aggregates and when the directory could not be loaded. |
| `region` | string | World Bank region, e.g. East Asia & Pacific. Aggregates are labelled Aggregates. |
| `income_level` | string | World Bank income group, e.g. High income, Upper middle income, Low income. |
| `date` | string | Reference year of the observation, YYYY. |
| `value` | number | The indicator value in the unit reported below. Empty when the World Bank holds no figure for that country-year. |
| `unit` | string | Unit reported by the API for the indicator, when the World Bank supplies one. |
| `obs_status` | string | Observation status flag used by the World Bank for estimated or provisional values. Empty for ordinary observations. |

- **`value`** -- Kept as a number so it can be charted straight away. The World Bank leaves the field null for country-years it has no figure for; those rows come back with an empty value rather than a zero, so a missing figure is never mistaken for a real 0.
- **`region`** -- Read from the World Bank country directory, not guessed. Rows whose region is Aggregates are regional or income-group totals such as East Asia & Pacific, Sub-Saharan Africa or World — switch on `excludeAggregates` to keep only real countries.
- **`obs_status`** -- The API's own flag for provisional or estimated values. Almost every row is empty here; when it is set, treat the figure as an estimate.

### Input

| Parameter | Type | Default | Description |
|---|---|---|---|
| `indicator` | string | `NY.GDP.MKTP.CD` | **Required.** World Bank indicator code, e.g. NY.GDP.MKTP.CD (GDP, current US$), NY.GDP.PCAP.CD (GDP per capita), SP.POP.TOTL (population), SL.UEM.TOTL.ZS (unemployment %), FP.CPI.TOTL.ZG (inflation %), EN.ATM.CO2E.PC (CO2 per capita). Any of the 1400+ codes from the World Bank indicator list works. |
| `countries` | string | `all` | ISO codes separated by commas, e.g. CHN,USA,IND,DEU — or all for every country and aggregate the World Bank publishes. Aggregates such as East Asia & Pacific are included unless you turn on excludeAggregates. |
| `dateRange` | string | `2020:2024` | A single year (2024) or a range (2015:2024). Leave empty for every year the World Bank holds for that indicator — for GDP that goes back to 1960. |
| `maxResults` | integer | `200` | Stop after this many country-year rows have been collected. 200 rows is about 40 countries over five years. |
| `excludeAggregates` | boolean | `false` | When on, rows whose region is Aggregates (East Asia & Pacific, Sub-Saharan Africa, World, income groups …) are dropped and only real countries remain. Useful when you want to average or map the data. |

#### A note on `indicator`

The code decides everything. `NY.GDP.MKTP.CD` is GDP in current US dollars, `NY.GDP.PCAP.CD` GDP per capita, `SP.POP.TOTL` total population, `SL.UEM.TOTL.ZS` unemployment as a share of the labour force, `FP.CPI.TOTL.ZG` inflation, `EN.ATM.CO2E.PC` CO2 emissions per capita, `SP.DYN.LE00.IN` life expectancy. The full list is browsable at data.worldbank.org/indicator — the code is shown on each indicator page.

#### A note on `dateRange`

Use `2015:2024` for a decade, `2024` for one year, or leave it empty for the whole series. Older series are sparse: GDP runs back to 1960, most social indicators start around 1990, and the most recent year is often missing for smaller economies.

#### A note on `maxResults`

Rows are collected newest year first and then cut at this number. A global query over ten years is roughly 2000 rows, so raise the limit if you want the full set.

### Usage examples

**1. GDP of the largest economies, 2015–2024**

```json
{
  "indicator": "NY.GDP.MKTP.CD",
  "countries": "USA,CHN,JPN,DEU,IND,GBR,FRA,BRA",
  "dateRange": "2015:2024",
  "maxResults": 100,
  "excludeAggregates": true
}
```

**2. World population, every economy, latest years**

```json
{
  "indicator": "SP.POP.TOTL",
  "countries": "all",
  "dateRange": "2020:2024",
  "maxResults": 1000,
  "excludeAggregates": false
}
```

**3. CO2 emissions per capita for a single country, full history**

```json
{
  "indicator": "EN.ATM.CO2E.PC",
  "countries": "CHN",
  "dateRange": "",
  "maxResults": 100,
  "excludeAggregates": true
}
```

Run it on an Apify Schedule — monthly for slow indicators like GDP and literacy, yearly for the December revision cycle. Push the dataset to a Google Sheet, Airtable, BigQuery or a dashboard, and key your rows on `country_code` + `date` + `indicator_id`, which together are unique.

### Data notes

- Rows come out sorted by year descending and then alphabetically by country, so the newest data is always at the top of the dataset.
- The country directory request gives you region, income group and ISO2 code in one extra call. If it fails, the run still succeeds and those three columns are simply empty.
- The World Bank publishes the same series under slightly different codes across vintages, and revises history in place; the value you see today for 2020 can differ from the value published a year ago.

### Pricing

This Actor uses pay-per-event pricing. You only pay for what you actually get.

| Event | Price | When it is charged |
|---|---|---|
| Actor start | $0.002 | Once per run |
| Result row | $0.002 per row | For every row saved to the dataset |

That works out to **$2 per 1,000 rows**. A typical run returning 50 rows costs about **$0.10** in total.

No subscription is required. You can cap your spend with the max cost per run setting in Apify Console, and an empty or invalid input charges only the start event.

### FAQ

**Do I need an API key?**

No. The World Bank Open Data API is public and anonymous, with no registration and no quota to configure.

**Is this data free to use?**

Yes. World Bank Open Data is released under CC BY 4.0 — you may use, redistribute and build on it, including commercially, with attribution to the World Bank.

**How do I find the indicator code I want?**

Open the indicator page on data.worldbank.org and look at the code printed under the indicator name, or search the Data Catalog. Codes look like `NY.GDP.MKTP.CD`.

**Why are values missing for some years?**

Because the World Bank has no reported figure for that country-year. These rows are returned with an empty `value`, not with a zero, and you can filter them out with a single step.

**Can I get several indicators in one run?**

Run the Actor once per indicator and join the datasets on `country_code` + `date`. Each run then stays fast and the schema stays flat.

### Related Actors

More data tools from the same publisher:

- [App Store Reviews Scraper](https://apify.com/biddata/app-reviews-scraper) - App Store and Steam user reviews with ratings, versions and dates.
- [EU Tenders Scraper](https://apify.com/biddata/ted-tenders-scraper) - EU public procurement notices from the official TED API.
- [ClinicalTrials.gov Scraper](https://apify.com/biddata/clinicaltrials-scraper) - Clinical trial records with phase, status and sponsor.
- [Federal Register Scraper](https://apify.com/biddata/federal-register-scraper) - US Federal Register documents, rules and notices.
- [arXiv Scraper](https://apify.com/biddata/arxiv-scraper) - arXiv papers with authors, abstracts and PDF links.
- [Hacker News Scraper](https://apify.com/biddata/hackernews-scraper) - Hacker News stories by keyword, top ranking or newest.
- [Weather Scraper](https://apify.com/biddata/weather-scraper) - Weather forecast and history for any city worldwide.

### Disclaimer

All data is retrieved in real time from the **World Bank Open Data API v2** (`api.worldbank.org`), the World Bank's own public open data service. This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by the World Bank Group.

World Bank indicators are estimates compiled from national statistics offices and may be revised, re-based or withdrawn. Verify anything financially significant against the indicator page on `data.worldbank.org`. This dataset is an analysis aid, not investment or policy advice.

# Actor input Schema

## `indicator` (type: `string`):

World Bank indicator code, e.g. NY.GDP.MKTP.CD (GDP, current US$), NY.GDP.PCAP.CD (GDP per capita), SP.POP.TOTL (population), SL.UEM.TOTL.ZS (unemployment %), FP.CPI.TOTL.ZG (inflation %), EN.ATM.CO2E.PC (CO2 per capita). Any of the 1400+ codes from the World Bank indicator list works.

## `countries` (type: `string`):

ISO codes separated by commas, e.g. CHN,USA,IND,DEU — or all for every country and aggregate the World Bank publishes. Aggregates such as East Asia & Pacific are included unless you turn on excludeAggregates.

## `dateRange` (type: `string`):

A single year (2024) or a range (2015:2024). Leave empty for every year the World Bank holds for that indicator — for GDP that goes back to 1960.

## `maxResults` (type: `integer`):

Stop after this many country-year rows have been collected. 200 rows is about 40 countries over five years.

## `excludeAggregates` (type: `boolean`):

When on, rows whose region is Aggregates (East Asia & Pacific, Sub-Saharan Africa, World, income groups …) are dropped and only real countries remain. Useful when you want to average or map the data.

## Actor input object example

```json
{
  "indicator": "NY.GDP.MKTP.CD",
  "countries": "all",
  "dateRange": "2020:2024",
  "maxResults": 200,
  "excludeAggregates": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

All collected records in the default dataset, one row per 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 = {
    "indicator": "NY.GDP.MKTP.CD",
    "countries": "all",
    "dateRange": "2020:2024",
    "maxResults": 200,
    "excludeAggregates": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("biddata/worldbank-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 = {
    "indicator": "NY.GDP.MKTP.CD",
    "countries": "all",
    "dateRange": "2020:2024",
    "maxResults": 200,
    "excludeAggregates": False,
}

# Run the Actor and wait for it to finish
run = client.actor("biddata/worldbank-scraper").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 '{
  "indicator": "NY.GDP.MKTP.CD",
  "countries": "all",
  "dateRange": "2020:2024",
  "maxResults": 200,
  "excludeAggregates": false
}' |
apify call biddata/worldbank-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,biddata/worldbank-scraper"
        }
    }
}
```

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/DqT0fKLUgCycmfsI9/builds/fl3vclhpL48KTVB17/openapi.json
