# World Bank Data Scraper - GDP, Population & Indicators (`ninhothedev/worldbank-scraper`) Actor

$0.5/1K 🔥 Fast World Bank data scraper! GDP, population, inflation & 1000s of indicators by country & year. No key. JSON, CSV, Excel or API in seconds. Pull time series for economic research & dashboards ⚡

- **URL**: https://apify.com/ninhothedev/worldbank-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** Developer tools, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.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.

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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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

## World Bank Data Scraper 🌍📊

Scrape **World Bank economic indicators** — GDP, population, inflation, unemployment and **1000s more** — by **country** and **year**, straight into a clean, structured dataset. No API key, no login, no scraping headaches. One row per country / indicator / year, ready for research, dashboards and machine-learning pipelines.

Powered by the official World Bank Indicators API (open data), this actor turns messy paginated JSON into tidy time-series rows.

### ✨ Why use this actor?

- **No API key required** — start pulling data immediately.
- **1000s of indicators** — GDP, GDP per capita, population, inflation (CPI), unemployment, GDP growth, and thousands of other World Bank series.
- **Any country, any year range** — single countries, a custom list, or `all`.
- **Clean tabular output** — flat rows (`country`, `indicator`, `year`, `value`, …), perfect for CSV/Excel/Pandas.
- **Cheap & fast** — datacenter-friendly, ~**$0.50 per 1,000 results**.
- **Pagination handled** — full historical time series pulled automatically.

### 💡 Use cases

- **Economic research** — build country panels for GDP, inflation and unemployment.
- **Data journalism** — chart long-run trends across nations in minutes.
- **Machine-learning features** — enrich models with macro indicators by country/year.
- **Dashboards & BI** — feed live macroeconomic data into Power BI, Tableau, Looker or Grafana.

### 🛠 Input

| Field | Type | Description |
|-------|------|-------------|
| `mode` | select | Scrape mode. `indicators` fetches the time series for each country × indicator. |
| `countries` | array | ISO 2/3-letter country codes, e.g. `["US","DE","CN","IN"]`. Use `["all"]` for every country. |
| `indicators` | array | World Bank indicator codes, e.g. `["NY.GDP.MKTP.CD","SP.POP.TOTL"]`. |
| `dateFrom` | string | Optional start year (YYYY), e.g. `2000`. |
| `dateTo` | string | Optional end year (YYYY), e.g. `2023`. |
| `maxItems` | integer | Max data points to collect (default 500, max 5000). |

#### Example input

```json
{
  "mode": "indicators",
  "countries": ["US", "DE", "CN", "IN"],
  "indicators": ["NY.GDP.MKTP.CD", "SP.POP.TOTL"],
  "dateFrom": "2015",
  "dateTo": "2023",
  "maxItems": 500
}
````

### 📤 Output

Each item is a single observation:

```json
{
  "country": "United States",
  "country_code": "USA",
  "indicator": "GDP (current US$)",
  "indicator_code": "NY.GDP.MKTP.CD",
  "year": "2022",
  "value": 26054614000000,
  "unit": null,
  "source": "worldbank",
  "scraped_at": "2026-07-21T00:00:00+00:00"
}
```

### 📚 Common indicator codes

| Code | Indicator |
|------|-----------|
| `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, total |
| `SP.POP.GROW` | Population growth (annual %) |
| `FP.CPI.TOTL.ZG` | Inflation, consumer prices (annual %) |
| `SL.UEM.TOTL.ZS` | Unemployment, total (% of labor force) |
| `NE.EXP.GNFS.ZS` | Exports of goods & services (% of GDP) |
| `NE.IMP.GNFS.ZS` | Imports of goods & services (% of GDP) |
| `SP.DYN.LE00.IN` | Life expectancy at birth (years) |

Browse all indicators at [data.worldbank.org/indicator](https://data.worldbank.org/indicator).

### 🔗 Related actors

- [Currency Exchange Scraper](https://apify.com/ninhothedev/currency-exchange-scraper)
- [SEC EDGAR Scraper](https://apify.com/ninhothedev/sec-edgar-scraper)
- [FDIC Banks Scraper](https://apify.com/ninhothedev/fdic-banks-scraper)
- [ECB Exchange Rates Scraper](https://apify.com/ninhothedev/ecb-exchange-rates-scraper)

### 💰 Pricing

Pay-per-result at roughly **$0.50 per 1,000 data points**. Most economic-research runs cost just a few cents.

### ⚖️ Legal

This actor uses the World Bank's open data API. World Bank data is generally provided under the [CC BY 4.0](https://datacatalog.worldbank.org/public-licenses) license — please attribute the source. Use responsibly and in line with the World Bank's terms.

***

**Keywords:** world bank scraper, GDP data, population data, inflation data, economic indicators API, macroeconomic data, country statistics, world development indicators, GDP per capita, unemployment rate, economic research data, data journalism, time series, no api key.

# Actor input Schema

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

Scrape mode. 'indicators' fetches the time series for each country x indicator combination.

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

List of ISO 2- or 3-letter country codes (e.g. US, DE, CN). Use 'all' for every country. Codes are joined with ';' per request.

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

World Bank indicator codes to fetch. Examples: NY.GDP.MKTP.CD (GDP US$), NY.GDP.PCAP.CD (GDP per capita), SP.POP.TOTL (population), FP.CPI.TOTL.ZG (inflation %), SL.UEM.TOTL.ZS (unemployment %), NY.GDP.MKTP.KD.ZG (GDP growth %).

## `dateFrom` (type: `string`):

Optional start year (YYYY), e.g. 2000. Leave empty for all available years.

## `dateTo` (type: `string`):

Optional end year (YYYY), e.g. 2023. Leave empty for the latest available year.

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

Maximum number of data points (one row per country/indicator/year) to collect.

## Actor input object example

```json
{
  "mode": "indicators",
  "countries": [
    "US",
    "DE",
    "CN",
    "IN"
  ],
  "indicators": [
    "NY.GDP.MKTP.CD",
    "SP.POP.TOTL"
  ],
  "dateFrom": "2000",
  "dateTo": "2023",
  "maxItems": 500
}
```

# 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 = {
    "countries": [
        "US",
        "DE",
        "CN",
        "IN"
    ],
    "indicators": [
        "NY.GDP.MKTP.CD",
        "SP.POP.TOTL"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/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 = {
    "countries": [
        "US",
        "DE",
        "CN",
        "IN",
    ],
    "indicators": [
        "NY.GDP.MKTP.CD",
        "SP.POP.TOTL",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/worldbank-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 '{
  "countries": [
    "US",
    "DE",
    "CN",
    "IN"
  ],
  "indicators": [
    "NY.GDP.MKTP.CD",
    "SP.POP.TOTL"
  ]
}' |
apify call ninhothedev/worldbank-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "World Bank Data Scraper - GDP, Population & Indicators",
        "description": "$0.5/1K 🔥 Fast World Bank data scraper! GDP, population, inflation & 1000s of indicators by country & year. No key. JSON, CSV, Excel or API in seconds. Pull time series for economic research & dashboards ⚡",
        "version": "0.1",
        "x-build-id": "UaLQ0VWe9cv4gm3QL"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ninhothedev~worldbank-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ninhothedev-worldbank-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/ninhothedev~worldbank-scraper/runs": {
            "post": {
                "operationId": "runs-sync-ninhothedev-worldbank-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/ninhothedev~worldbank-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-ninhothedev-worldbank-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",
                "required": [
                    "indicators"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "indicators"
                        ],
                        "type": "string",
                        "description": "Scrape mode. 'indicators' fetches the time series for each country x indicator combination.",
                        "default": "indicators"
                    },
                    "countries": {
                        "title": "Countries",
                        "type": "array",
                        "description": "List of ISO 2- or 3-letter country codes (e.g. US, DE, CN). Use 'all' for every country. Codes are joined with ';' per request.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "indicators": {
                        "title": "Indicator codes",
                        "type": "array",
                        "description": "World Bank indicator codes to fetch. Examples: NY.GDP.MKTP.CD (GDP US$), NY.GDP.PCAP.CD (GDP per capita), SP.POP.TOTL (population), FP.CPI.TOTL.ZG (inflation %), SL.UEM.TOTL.ZS (unemployment %), NY.GDP.MKTP.KD.ZG (GDP growth %).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "dateFrom": {
                        "title": "Date from (year)",
                        "type": "string",
                        "description": "Optional start year (YYYY), e.g. 2000. Leave empty for all available years."
                    },
                    "dateTo": {
                        "title": "Date to (year)",
                        "type": "string",
                        "description": "Optional end year (YYYY), e.g. 2023. Leave empty for the latest available year."
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of data points (one row per country/indicator/year) to collect.",
                        "default": 500
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
