# World Bank Country Indicators - GDP, Population, Inflation (`kdhan/world-bank-indicators-data`) Actor

Country-by-year economic and social indicators (GDP, population, inflation, unemployment and more) from the public World Bank Indicators API. One row per country, indicator and year, missing values marked, with attribution. No API key.

- **URL**: https://apify.com/kdhan/world-bank-indicators-data.md
- **Developed by:** [Doohan Kim](https://apify.com/kdhan) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 data point records

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 Country Indicators - GDP, Population, Inflation

Get country-by-year economic and social indicators (GDP, population, inflation, unemployment, life
expectancy and thousands more) from the public **World Bank Indicators API (v2)**. One row per
**country x indicator x year**. No API key, no scraping.

### Attribution and terms (please read)

Data: **The World Bank: World Development Indicators** (or the other World Bank dataset named in each row's
`sourceName`), and the original data provider listed in `sourceOrganization`. Every row carries an
`attribution` field in the World Bank's requested format
(`The World Bank: <dataset name>: <data source>`) - keep it when you reuse the data.

World Bank data is published under **CC BY 4.0** "unless indicated otherwise in the data or indicator
metadata" (https://data.worldbank.org/summary-terms-of-use). That page also says: you must not claim or
imply that The World Bank endorses your use of the data, and *"Some datasets and indicators are provided by
third parties, and may not be redistributed or reused without the consent of the original data provider, or
may be subject to additional terms and conditions."* This Actor only reshapes the data (one row per country,
indicator and year); it is **not affiliated with or endorsed by The World Bank**.

### Input

```json
{
  "countries": ["KOR", "USA", "JP"],
  "indicators": ["NY.GDP.MKTP.CD", "SP.POP.TOTL", "unemployment total"],
  "yearFrom": 2014,
  "yearTo": 2023
}
```

| Field | Meaning |
|---|---|
| `countries` | ISO 2/3-letter codes, World Bank names, or `all`. Regions and income groups (World, Euro area, ...) are refused with a reason unless `includeAggregates` is true. |
| `indicators` | Indicator codes (any World Bank dataset) or name searches (World Development Indicators). Max 20. |
| `mrv` | Most recent N years (default 5 when no year range is given). Cannot be combined with `yearFrom`/`yearTo`. |
| `yearFrom`, `yearTo` | Year range. Open-ended ranges start at 1960 / end at the current year. |
| `includeAggregates` | Default false. |
| `maxResults` | Row cap (default 1000, max 20000). Missing-value rows count toward it. |

With no input the Actor returns GDP (current US$) for South Korea and the USA, most recent 5 years.

#### Searching by name

If an entry is not a code (a code looks like `NY.GDP.MKTP.CD`), the Actor searches the World Development
Indicators names: every word must appear in the name. The best match is used, and a free
`indicatorResolution` row lists the chosen indicator and the other candidates. If the choice is not the one
you meant, run again with the indicator code.

### Output (one row per country x indicator x year)

`countryIso3`, `countryIso2`, `countryName`, `isAggregate`, `indicatorCode`, `indicatorName`, `year`
(`period` is the raw period string), `value`, `valueStatus` (`ok` / `missing`), `unit`, `obsStatus`,
`decimal`, `sourceName`, `sourceOrganization`, `lastUpdated` (last update of the World Bank dataset),
`dataAsOf` (time of this query), `attribution`, `disclaimer`.

- `unit` is what the API reports and is usually empty - the unit is normally part of `indicatorName`
  (for example "GDP (current US$)").
- **A missing year is never turned into 0.** Rows without a published value have `value: null`,
  `valueStatus: "missing"` and a `reason`, and are not charged.
- A country with no observations for an indicator in the period gets one free row saying so.
- Unknown countries, aggregates requested without `includeAggregates`, unknown indicator codes and name
  searches without a match are returned as free rows with a `reason` (`recordType` `input` or
  `indicatorResolution`).
- If the World Bank API cannot be reached, affected rows have `found: null` and an `error`; the Actor never
  reports "no data" for a failure. If the indicator metadata cannot be loaded, rows still carry the data and
  `sectionErrors.indicatorMetadata`.
- If output is cut by `maxResults` or your spending limit, a free `summary` row says so.

### Pricing

Charged per datapoint with a value (event `datapoint-record`). Missing values, notes and errors are free.
The Actor respects your maximum cost per run.

### Notes

- The API publishes annual data with some indicators in other periods; `period` keeps the raw label and
  `year` is null for non-annual labels.
- Values are published as-is and are revised by the World Bank; compare `lastUpdated` with your own copy.
- Requests are paced and retried politely (at most 4 per second).

# Actor input Schema

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

ISO 2- or 3-letter codes (KR, KOR), World Bank country names, or 'all'.

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

Indicator codes (NY.GDP.MKTP.CD, SP.POP.TOTL, SL.UEM.TOTL.ZS, FP.CPI.TOTL.ZG) or name searches such as 'unemployment total'. Name searches cover World Development Indicators; the chosen match and other candidates are reported. Max 20.

## `mrv` (type: `integer`):

Return the most recent N years (missing years included, marked). Default 5 when no years are set. Do not combine with year range.

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

First year of the range.

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

Last year of the range.

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

Also return aggregates such as World, Euro area or High income. Off by default.

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

Upper limit of rows returned (missing-value rows count). You are charged only for rows that have a value.

## Actor input object example

```json
{
  "countries": [
    "KOR",
    "USA"
  ],
  "indicators": [
    "NY.GDP.MKTP.CD",
    "SP.POP.TOTL"
  ],
  "includeAggregates": false,
  "maxResults": 1000
}
```

# Actor output Schema

## `datapoints` (type: `string`):

Value, unit, observation status, source, last update, attribution and disclaimer.

# 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": [
        "KOR",
        "USA"
    ],
    "indicators": [
        "NY.GDP.MKTP.CD",
        "SP.POP.TOTL"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kdhan/world-bank-indicators-data").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": [
        "KOR",
        "USA",
    ],
    "indicators": [
        "NY.GDP.MKTP.CD",
        "SP.POP.TOTL",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("kdhan/world-bank-indicators-data").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 '{
  "countries": [
    "KOR",
    "USA"
  ],
  "indicators": [
    "NY.GDP.MKTP.CD",
    "SP.POP.TOTL"
  ]
}' |
apify call kdhan/world-bank-indicators-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kdhan/world-bank-indicators-data"
        }
    }
}
```

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/H5Q83dxD9mleeDVYO/builds/itgf9aXfoqmb0qgHw/openapi.json
