# World Bank Data Scraper (`anyxsolutions/world-bank-data-scraper`) Actor

Scrape World Bank Open Data: GDP, population, inflation, unemployment, CO2 and 1,500+ development indicators for every country, region and year since 1960, by indicator code, keyword or data.worldbank.org link, with region and income level. No API key, no login.

- **URL**: https://apify.com/anyxsolutions/world-bank-data-scraper.md
- **Developed by:** [Anyx Solutions](https://apify.com/anyxsolutions) (community)
- **Categories:** Developer tools, Business
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 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/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

![banner](https://anyx.solutions/banners/world-bank-data-scraper.png)

## World Bank Data Scraper

**GDP, population, inflation, unemployment, CO2 and 1,500+ World Bank development indicators for every country and year, as clean JSON.**

World Bank Open Data is the reference source for comparing countries: national accounts, prices,
jobs, population, health, education, energy, climate and poverty, for 217 economies and dozens of
regions and income groups, many series going back to 1960. This Actor scrapes World Bank Open Data
by indicator code, by keyword search, or from a data.worldbank.org link, for the countries and
years you choose. Every row is one value: an indicator for a country in a year, with the country's
ISO3 and ISO2 codes, region and income level, the unit, the date the series was last updated, the
source database, and a link to the chart on data.worldbank.org. Paste a country page to get its 24
headline indicators in one go. There is no login, no API key and no proxy to configure. Built for
economists and analysts, market-entry and country-risk research, ESG and climate reporting,
dashboards and BI, journalism, and feeding clean macro data into models and AI pipelines.

### ⚡ Quick start

```json
{
  "startUrls": [
    {
      "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020"
    }
  ],
  "maxItems": 5
}
```

Or pick indicators and countries, latest value only:

```json
{
  "indicators": ["NY.GDP.MKTP.CD", "SP.POP.TOTL", "FP.CPI.TOTL.ZG"],
  "countries": ["US", "CN", "DE", "IN", "BR"],
  "mostRecentValues": 1,
  "skipEmptyValues": true
}
```

Or search indicators by name, for every country since 2010:

```json
{
  "indicatorSearch": ["unemployment total"],
  "maxIndicatorsPerSearch": 2,
  "yearFrom": 2010,
  "maxItems": 5000
}
```

### 🧩 Input

| Field                    | Type    | Required | Default                      | Description                                                                                                                                                                                                                          |
| ------------------------ | ------- | -------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `startUrls`              | array   | no       | —                            | data.worldbank.org pages: an indicator page with its countries and years (`/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020`), or a country or region page (`/country/united-states`, `/region/east-asia-and-pacific`). |
| `indicators`             | array   | no       | —                            | World Bank indicator codes, one per line, such as `NY.GDP.MKTP.CD` or `SP.POP.TOTL`. See the popular codes below.                                                                                                                    |
| `indicatorSearch`        | array   | no       | —                            | Find indicators by name, one search per line, such as `unemployment total` or `renewable energy`. Every word must appear in the name; a code prefix such as `SL.UEM` also works.                                                     |
| `maxIndicatorsPerSearch` | integer | no       | `5`                          | How many matching indicators each search returns, best matches first.                                                                                                                                                                |
| `countries`              | array   | no       | —                            | Countries, regions or groups by ISO2 or ISO3 code or by name: `US`, `CHN`, `Germany`, `WLD` (world), `EUU` (European Union), `EAS` (East Asia & Pacific), `HIC` (high income). Empty or `all` means every country.                   |
| `includeAggregates`      | boolean | no       | `false`                      | When every country is asked for, also return regional and income-group aggregates such as World or Sub-Saharan Africa.                                                                                                               |
| `yearFrom`               | integer | no       | —                            | Only values for this year or later. Leave empty to start in 1960.                                                                                                                                                                    |
| `yearTo`                 | integer | no       | —                            | Only values for this year or earlier. Leave empty to end at the latest year.                                                                                                                                                         |
| `mostRecentValues`       | integer | no       | —                            | Only the latest N years per country, such as `1` for a snapshot. Overrides `yearFrom` and `yearTo`.                                                                                                                                  |
| `skipEmptyValues`        | boolean | no       | `false`                      | Leave out years without a value. With `mostRecentValues`, returns the latest N years that have one.                                                                                                                                  |
| `maxItems`               | integer | no       | —                            | Maximum rows per indicator code, search match or start URL. The input form starts at 5; leave it empty to get every row.                                                                                                             |
| `proxyConfiguration`     | object  | no       | `{ "useApifyProxy": false }` | Proxy settings. World Bank data needs no proxy.                                                                                                                                                                                      |

Add at least one start URL, indicator code, indicator search or country. `countries`, `yearFrom`,
`yearTo`, `mostRecentValues` and `skipEmptyValues` apply to indicator codes, searches and country
pages. An indicator page keeps the countries and years set in its address and uses the input's only
when it has none. With countries but no indicators, you get the 24 headline indicators of a
country page.

**Popular indicator codes.** `NY.GDP.MKTP.CD` GDP (current US$) · `NY.GDP.PCAP.CD` GDP per capita
(current US$) · `NY.GDP.MKTP.KD.ZG` GDP growth (annual %) · `SP.POP.TOTL` population ·
`SP.POP.GROW` population growth · `FP.CPI.TOTL.ZG` inflation, consumer prices (annual %) ·
`SL.UEM.TOTL.ZS` unemployment (% of labor force) · `SP.DYN.LE00.IN` life expectancy ·
`EN.GHG.CO2.PC.CE.AR5` CO2 emissions per capita · `SI.POV.DDAY` extreme poverty (% at $3.00 a
day) · `GC.DOD.TOTL.GD.ZS` central government debt (% of GDP) · `BX.KLT.DINV.WD.GD.ZS` foreign
direct investment (% of GDP) · `IT.NET.USER.ZS` internet users (% of population) ·
`EG.ELC.ACCS.ZS` access to electricity · `EG.ELC.RNWX.ZS` renewable electricity. Any indicator's
code is in its data.worldbank.org address.

### 📤 Output

Each row is one value: one indicator for one country or aggregate in one year. Years the World Bank
has no value for come back with `value` set to `null` unless `skipEmptyValues` is on. Rows come
country by country, latest year first.

#### Fields

| Field           | Type    | Description                                                                                          |
| --------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `indicatorId`   | string  | Indicator code, such as `NY.GDP.MKTP.CD`.                                                            |
| `indicatorName` | string  | Indicator name, such as `GDP (current US$)`.                                                         |
| `countryCode`   | string  | ISO3 code of the country, or the World Bank code of an aggregate (`WLD`, `EUU`, `HIC`).              |
| `countryIso2`   | string  | ISO2 code of the country, or the World Bank's two-character code of an aggregate (`1W`, `EU`, `XD`). |
| `countryName`   | string  | Country or aggregate name.                                                                           |
| `region`        | string  | World Bank region, such as `East Asia & Pacific`. `null` for aggregates.                             |
| `incomeLevel`   | string  | World Bank income group, such as `Upper middle income`. `null` for aggregates.                       |
| `isAggregate`   | boolean | `true` for regions, income groups and other aggregates such as World.                                |
| `year`          | integer | Year of the value.                                                                                   |
| `date`          | string  | Period as the World Bank labels it: a year, or a quarter or month in some databases.                 |
| `value`         | number  | The value, or `null` when the World Bank has none for that year.                                     |
| `unit`          | string  | Unit of measure, such as `current US$` or `% of total labor force`. `null` for plain counts.         |
| `obsStatus`     | string  | Observation status flag, such as an estimate marker, when the World Bank sets one.                   |
| `decimal`       | integer | Decimal places the World Bank displays the value with.                                               |
| `lastUpdated`   | string  | Date the series was last updated, `YYYY-MM-DD`.                                                      |
| `sourceName`    | string  | Database the series comes from, such as `World Development Indicators`.                              |
| `url`           | string  | The indicator's chart for this country on data.worldbank.org.                                        |

<details><summary>Example output</summary>

```json
[
  {
    "indicatorId": "NY.GDP.MKTP.CD",
    "indicatorName": "GDP (current US$)",
    "countryCode": "CHN",
    "countryIso2": "CN",
    "countryName": "China",
    "region": "East Asia & Pacific",
    "incomeLevel": "Upper middle income",
    "isAggregate": false,
    "year": 2023,
    "date": "2023",
    "value": 18270356654533.2,
    "unit": "current US$",
    "obsStatus": null,
    "decimal": 0,
    "lastUpdated": "2026-10-08",
    "sourceName": "World Development Indicators",
    "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=CN"
  },
  {
    "indicatorId": "NY.GDP.MKTP.CD",
    "indicatorName": "GDP (current US$)",
    "countryCode": "USA",
    "countryIso2": "US",
    "countryName": "United States",
    "region": "North America",
    "incomeLevel": "High income",
    "isAggregate": false,
    "year": 2023,
    "date": "2023",
    "value": 27811517000000,
    "unit": "current US$",
    "obsStatus": null,
    "decimal": 0,
    "lastUpdated": "2026-10-08",
    "sourceName": "World Development Indicators",
    "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US"
  }
]
```

</details>

### 💡 Use cases

- **Economic research and modelling** — GDP, growth, inflation, debt and trade series for every country, ready for panel models and forecasts.
- **Market entry and country risk** — compare target markets on income, population, inflation, internet use and electricity access.
- **ESG and climate reporting** — CO2 emissions, renewable electricity, forest area and water stress by country and year.
- **Dashboards and BI** — schedule the Actor to keep a spreadsheet, database or dashboard in step with the latest World Bank release.
- **Journalism and policy analysis** — pull a country's 24 headline indicators, or rank every country on one measure.
- **AI and data pipelines** — feed clean, documented macro data into models, RAG and analytics workflows.

### ❓ FAQ

- **Do I need an account or an API key?** No. World Bank Open Data is free and public.
- **Do I need a proxy?** No. It runs without one by default.
- **How do I find an indicator's code?** Open the indicator on [data.worldbank.org](https://data.worldbank.org/indicator): the code is in the address, such as `NY.GDP.MKTP.CD` in `data.worldbank.org/indicator/NY.GDP.MKTP.CD`. Or use `indicatorSearch` with a few words of its name, or paste the page into `startUrls`.
- **Why is `value` empty for some years?** The World Bank has no figure for that country and year yet, or never collected one. Turn on `skipEmptyValues` to leave those rows out.
- **How do I get the latest value for every country?** Set `indicators`, leave `countries` empty, and set `mostRecentValues` to 1 with `skipEmptyValues` on.
- **Are regions and income groups included?** Only when you ask: name them in `countries` (`WLD`, `EUU`, `SSF`, `HIC` …) or turn on `includeAggregates` with every country.
- **Why does an indicator return nothing?** Some older codes were retired to the World Bank's archives and are no longer served; the log says so. Search for the current series with `indicatorSearch`, for example `co2 per capita`.
- **How current is the data?** It is read live from the World Bank on every run. `lastUpdated` shows when each series was last revised.
- **Can I use the data commercially?** Yes. World Bank Open Data is licensed under [Creative Commons Attribution 4.0 (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/): credit The World Bank as the source, for example "Source: The World Bank, World Development Indicators", wherever you publish or share the data. A few series come from third-party providers under their own terms, noted in the indicator's metadata. See the World Bank's [summary terms of use](https://data.worldbank.org/summary-terms-of-use).

### 🔗 More scrapers by Anyx

- [USAspending Scraper](https://apify.com/anyxsolutions/usaspending-scraper)
- [SEC EDGAR Scraper](https://apify.com/anyxsolutions/sec-edgar-scraper)
- [CoinGecko Scraper](https://apify.com/anyxsolutions/coingecko-scraper)
- [Federal Register Scraper](https://apify.com/anyxsolutions/federal-register-scraper)

### 🤝 Anyx Solutions

We build custom scrapers and data-extraction pipelines.

- Email: tantosthor@gmail.com

### 🖼 Image credit

Image credit: [data.worldbank.org](https://data.worldbank.org/)

# Actor input Schema

## `startUrls` (type: `array`):

Public data.worldbank.org pages: an indicator page with its countries and years (https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN\&start=2000\&end=2020), or a country or region page (https://data.worldbank.org/country/united-states), which returns that country's headline indicators.

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

World Bank indicator codes, one per line, for example NY.GDP.MKTP.CD. Popular codes: NY.GDP.MKTP.CD (GDP, current US$), NY.GDP.PCAP.CD (GDP per capita), NY.GDP.MKTP.KD.ZG (GDP growth, %), SP.POP.TOTL (population), FP.CPI.TOTL.ZG (inflation, %), SL.UEM.TOTL.ZS (unemployment, %), SP.DYN.LE00.IN (life expectancy), EN.GHG.CO2.PC.CE.AR5 (CO2 per capita), SI.POV.DDAY (extreme poverty, %), IT.NET.USER.ZS (internet users, %). The code of any indicator is in its data.worldbank.org address.

## `indicatorSearch` (type: `array`):

Find indicators by name, one search per line, for example unemployment total, gdp per capita or renewable energy. Every word must appear in the indicator name; a code prefix such as SL.UEM also works. Searches cover the World Development Indicators.

## `maxIndicatorsPerSearch` (type: `integer`):

How many matching indicators each search returns, best matches first: names that start with the search, then the most general.

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

Countries, regions or groups, one per line, by ISO2 or ISO3 code or by name, for example US, CHN, Germany, WLD (world), EUU (European Union), EAS (East Asia & Pacific) or HIC (high income). Leave empty or enter all for every country.

## `includeAggregates` (type: `boolean`):

When every country is asked for, also return the regional and income-group aggregates such as World, European Union, Sub-Saharan Africa and High income. Aggregates named in Countries are always returned.

## `yearFrom` (type: `integer`):

Only return values for this year or later, for example 2000. Leave empty to start at the first year on record (1960).

## `yearTo` (type: `integer`):

Only return values for this year or earlier, for example 2020. Leave empty to end at the latest year.

## `mostRecentValues` (type: `integer`):

Return only the latest N years per country, for example 1 for a snapshot of the latest value. Overrides From year and To year.

## `skipEmptyValues` (type: `boolean`):

Leave out rows for years the World Bank has no value for. With Most recent values, returns the latest N years that do have a value.

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

Maximum number of rows (one country, indicator and year each) to return per indicator code, search match or URL. Leave empty for every row.

## `proxyConfiguration` (type: `object`):

Proxy settings. World Bank data is public and needs no proxy.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020"
    }
  ],
  "indicators": [
    "SP.POP.TOTL",
    "NY.GDP.PCAP.CD"
  ],
  "maxIndicatorsPerSearch": 5,
  "countries": [
    "US",
    "CN",
    "IN",
    "DE",
    "BR"
  ],
  "includeAggregates": false,
  "skipEmptyValues": false,
  "maxItems": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "startUrls": [
        {
            "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020"
        }
    ],
    "indicators": [
        "SP.POP.TOTL",
        "NY.GDP.PCAP.CD"
    ],
    "countries": [
        "US",
        "CN",
        "IN",
        "DE",
        "BR"
    ],
    "maxItems": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("anyxsolutions/world-bank-data-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 = {
    "startUrls": [{ "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020" }],
    "indicators": [
        "SP.POP.TOTL",
        "NY.GDP.PCAP.CD",
    ],
    "countries": [
        "US",
        "CN",
        "IN",
        "DE",
        "BR",
    ],
    "maxItems": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("anyxsolutions/world-bank-data-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 '{
  "startUrls": [
    {
      "url": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD?locations=US-CN&start=2000&end=2020"
    }
  ],
  "indicators": [
    "SP.POP.TOTL",
    "NY.GDP.PCAP.CD"
  ],
  "countries": [
    "US",
    "CN",
    "IN",
    "DE",
    "BR"
  ],
  "maxItems": 5
}' |
apify call anyxsolutions/world-bank-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,anyxsolutions/world-bank-data-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/wYTcRdbWGzS2gjR1K/builds/OyKan3dWA1MEt2yto/openapi.json
