# World Bank Indicators API: Countries, GDP, Population, More (`shadow-tools/world-bank-indicators-api`) Actor

Search World Bank indicators, get country time series (GDP, population, life expectancy...) and rank countries by latest value. CC BY 4.0 indicators only, with source, licence and update date in every record. Unofficial.

- **URL**: https://apify.com/shadow-tools/world-bank-indicators-api.md
- **Developed by:** [Shadow Tools](https://apify.com/shadow-tools) (community)
- **Categories:** Other, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 78.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 indicator values

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 Indicators API: Countries, GDP, Population, More

Call this Actor to **get World Bank indicator values by country and year** (GDP per capita, population, life expectancy, unemployment, CO2, internet use and about 1,500 other World Development Indicators), to **find the right indicator id from a keyword**, or to **rank countries on an indicator's latest value**. Output is flat JSON rows: country (ISO3 code, name, region, income level, aggregate flag), indicator (id, name, unit), year, value, source, **licence, last-update date and a ready-made attribution line in every record**. Only indicators that the World Bank itself declares **CC BY 4.0** are returned.

> **Unofficial tool. Not affiliated with, endorsed by or sponsored by The World Bank.** It reads the public World Bank Indicators API and reformats it. The World Bank name and logos are not used to suggest any association.

#### Minimal input per mode

| Mode | Minimal input | What comes back |
|---|---|---|
| `getIndicator` | `{"indicators": ["NY.GDP.PCAP.CD"], "countries": ["FRA", "DEU"], "startYear": 2018, "endYear": 2023}` | one row per country and year |
| `searchIndicators` | `{"mode": "searchIndicators", "query": "life expectancy", "maxResults": 5}` | indicator id, name, unit, source, topics, licence |
| `compareCountries` | `{"mode": "compareCountries", "indicators": ["SP.DYN.LE00.IN"], "countries": ["region:ECS"], "maxResults": 10}` | countries ranked on their latest value, with the year |

An **empty input** `{}` works: GDP per capita (current US$) of France, Germany and the USA, last 5 available values per country (15 rows).

Short real output (default input, 8 Nov 2026, shortened; the full record also has `region`, `incomeLevel`, `sourceOrganization`, `licenseUrl`, `period`, `obsStatus`):
`{"type": "observation", "countryIso3": "DEU", "countryName": "Germany", "isAggregate": false, "indicatorId": "NY.GDP.PCAP.CD", "indicatorName": "GDP per capita (current US$)", "year": 2025, "value": 60496.4350820414, "unit": null, "sourceName": "World Development Indicators", "lastUpdated": "2026-10-08", "license": "CC BY 4.0", "attribution": "The World Bank: World Development Indicators: Country official statistics, ... License: CC BY 4.0 (https://datacatalog.worldbank.org/public-licenses#cc-by); ... Source last updated: 2026-10-08. ..."}`

#### For AI agents (MCP)

- **One call = one answer.** Default `maxResults` is 20 (max 50,000). Typical run: 1-5 s; all countries over 66 years of one indicator (14,292 rows) took 25 s.
- **Pick the mode by what you have**: you know the id (`NY.GDP.PCAP.CD`, `SP.POP.TOTL`) -> `getIndicator`; you only know a topic -> `searchIndicators` first (it returns the id), then `getIndicator`; "which countries are highest/lowest" -> `compareCountries`.
- **Countries** accept ISO3 (`FRA`), ISO2 (`DE`), exact English names (`United States`), and groups: `all` (countries only), `aggregates` (World, regions, income groups), `region:ECS`, `income:HIC`. Aggregates are flagged `isAggregate: true` so they are never mistaken for countries.
- **Empty values are `null`**, never filled in. By default empty rows are skipped (and counted in the `SUMMARY` record); `includeMissing: true` returns them as `null`.
- **Errors fail fast** as `Field X invalid: expected Y, got Z, example W` (for example `Field countries invalid: expected ISO3 or ISO2 codes, exact country names, "all", ..., got ["Atlantis"], example ["FRA", "DE", "region:ECS"].`). Nothing is charged.
- **0 results is not an error.** The run succeeds with an empty dataset and the key-value record `SUMMARY` has a `note` saying why (no value in the period, indicator refused because of its licence, ...) and what to change.
- **Licence refusals are explicit**: asking for an indicator that is not CC BY 4.0 (for example the SIPRI series `MS.MIL.XPND.CD`) returns no rows and a note naming the declared licence.

### Who uses it

- **Analysts, journalists, students**: country time series without handling the API, pagination or country codes.
- **Dashboards and data pipelines**: a stable flat JSON/CSV feed with source, licence and update date on each row.
- **AI assistants**: answer "GDP per capita of Poland since 2015" or "which countries have the highest life expectancy" with a dated, attributed source.

### Modes

- **getIndicator**: values of one or several indicators (up to 10) for the chosen countries. Period: `startYear` / `endYear`, or `latestValues` (the most recent N non-empty values per country; default 5 when no year is given).
- **searchIndicators**: keyword and/or topic search in the indicator catalogue (`sourceId` `2` = World Development Indicators by default, `all` = every database, about 29,000 indicators). All words must match the id, the name or the indicator description (the description itself is not returned). By default only reusable (CC BY 4.0) indicators are listed (`onlyReusable`); set it to `false` to also see others, flagged `reusable: false`. The licence of each hit is read from the World Bank metadata (at most 400 candidates are checked per run).
- **compareCountries**: the latest non-empty value of one indicator for each country, ranked (`order` desc or asc; ties share the rank: 1, 2, 2, 4). Countries rank on **their own latest year**, shown in `year`; `SUMMARY.yearsDiffer` tells when years differ (use `endYear` to cap the period).

### What you get

**Observation record** (`getIndicator`): `type` ("observation"), `countryIso3`, `countryIso2`, `countryName`, `isAggregate`, `region`, `regionId`, `incomeLevel`, `incomeLevelId` (null for aggregates), `indicatorId`, `indicatorName`, `year`, `period` (for example "2023"), `value` (number or null), `unit` (when the source gives one, else null), `obsStatus`, `sourceId`, `sourceName`, `sourceOrganization` (credit line, see Privacy), `lastUpdated` (source database last-update date), `license`, `licenseUrl`, `attribution`, `extractedAt`.
**Comparison record** (`compareCountries`): the same fields with `type` "comparison", plus `rank` and `rankedAmong`.
**Indicator record** (`searchIndicators`): `type` ("indicator"), `indicatorId`, `indicatorName`, `unit`, `topics[]`, `sourceId`, `sourceName`, `sourceOrganization`, `sourceLastUpdated`, `license` (as declared), `licenseUrl`, `reusable`, `attribution`, `extractedAt`.

### Quick start

GDP per capita and population, 2015-2023, four countries:

```json
{ "indicators": ["NY.GDP.PCAP.CD", "SP.POP.TOTL"], "countries": ["FRA", "DEU", "ITA", "ESP"], "startYear": 2015, "endYear": 2023, "maxResults": 100 }
```

Which European and Central Asian countries live longest?

```json
{ "mode": "compareCountries", "indicators": ["SP.DYN.LE00.IN"], "countries": ["region:ECS"], "maxResults": 10 }
```

Find unemployment indicators:

```json
{ "mode": "searchIndicators", "query": "unemployment", "maxResults": 10 }
```

World and EU population since 2000:

```json
{ "indicators": ["SP.POP.TOTL"], "countries": ["WLD", "EUU"], "startYear": 2000 }
```

Call it from the API: `POST https://api.apify.com/v2/acts/<ACTOR>/run-sync-get-dataset-items?token=<TOKEN>` with the JSON input as body.

### Pricing

Pay per event, no subscription:

| Event | Price | Per 1,000 |
|---|---|---|
| `indicator-value`: one record delivered (an observation row, a ranked country or an indicator) | **0.002 USD** | **2 USD per 1,000 records** |
| Actor start (once per run) | 0.00005 USD | n/a |

A run returning nothing costs only the start event. Example: the default run (15 rows) costs 0.03 USD; 5 years of GDP for all 217 countries (up to 1,085 rows) at most about 2.2 USD. Use the platform's **Maximum cost per run** to cap spending: the Actor reads it, stops cleanly at the cap and returns what it already delivered (the cap must allow at least one record). Empty rows requested with `includeMissing` are records like any other.

### Privacy / GDPR by design

This Actor returns **macro-economic data about countries**, not data about people:

- **Countries, not people.** Every row is a country (or an aggregate such as World or a region), an indicator and a year. No microdata or survey responses are fetched, and the Actor never asks for anything about individuals.
- **Allow-list, fail-closed.** Records are built from a fixed list of named fields; any other field the API might add in the future is dropped, not passed through (a unit test pins the list). A row whose country is not in the official country list, whose indicator is not the one requested, or whose value or period cannot be read with certainty is dropped, not guessed.
- **Free text is limited.** The only text copied from the source metadata is the indicator name, its unit and the **source credit line** (`sourceOrganization`). E-mail addresses and phone-number patterns in them are masked. Credit lines that look like an author citation (for example "Surname, A.B., Surname, C.D. ...", "et al.", or a personal name with initials) are **not** returned: the attribution then carries the dataset name only. A credit line is also dropped unless it contains an organisation word (bank, statistics, office, union, survey ...). This is a pattern filter, not a proof: on 8 Nov 2026 it dropped 25 of the 1,498 World Development Indicators credit lines and about 26% of the other databases' credit lines. Long indicator descriptions are never returned.
- **Your input stays yours.** Nothing about the requester is stored by the Actor: no state between runs, no logs of your query beyond the standard run log, no tracking. (The Apify platform stores the run input as for any Actor.)

### Licence and attribution

Data: World Bank open data, read from the World Bank Indicators API (`https://api.worldbank.org/v2`, no key). The World Bank's *Terms of Use for Datasets* (https://www.worldbank.org/en/about/legal/terms-of-use-for-datasets, read 8 Nov 2026) state: *"Unless specifically labeled otherwise, these Datasets are provided to you under a Creative Commons Attribution 4.0 International License (CC BY 4.0), with the additional terms below."* and *"You may use our application programming interfaces ("APIs") to facilitate access to the Datasets, whether through a separate Web site or through another type of software application."* They also state: *"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 terms and conditions that are different from those described above. Where applicable, these conditions are included in the dataset or indicator metadata."* The licence page (https://datacatalog.worldbank.org/public-licenses#cc-by) says CC BY 4.0 *"allows users to copy, modify and distribute data in any format for any purpose, including commercial use"*, with attribution.

**How the Actor applies this.** The API publishes the licence **per indicator** in its series metadata (`License_Type`, `License_URL`). The Actor reads it before returning any value and serves an indicator **only when it says CC BY 4.0**. Indicators under another licence, with no licence field, or whose metadata cannot be read are **refused and never returned** (the run `SUMMARY` names them and their declared licence). Measured on 8 Nov 2026: of the 1,498 World Development Indicators, 1,489 are declared CC BY 4.0, 6 are SIPRI military series ("SIPRI terms and conditions") and 3 are "CC BY 3.0 IGO" (Women, Business and the Law): those 9 are refused. In a sample of 120 indicators spread over the whole catalogue (all databases), 62 were declared CC BY 4.0, 56 declared no licence and 2 declared "Open": the 58 others are refused. If you need those, ask the World Bank for their terms.

**Attribution.** Every record carries the credit in the format the World Bank asks for, *"The World Bank: Dataset name: Data source (if known)"*, together with the licence name and URL, the terms-of-use URL, the **last-update date of the source database**, a statement that the data was reformatted by an unofficial service (values unchanged) and the extraction date. If you redistribute the data, keep that line, or at least the terms-of-use URL, as the Terms require for sub-licensing. The Terms also add a dispute-resolution procedure (non-binding mediation, then arbitration) to CC BY 4.0: read them before redistributing.

No warranty: the World Bank disclaims warranties and liability for the data and the APIs, and so does this unofficial service. Check the original source before relying on a figure.

### Limits and good to know

- Values are the World Bank's latest published values: they are revised, and countries report with different delays. `lastUpdated` tells the database's last-update date, not the year of the value.
- `unit` is empty for most indicators because the API gives no unit; the unit is usually in `indicatorName` ("current US$", "% of population").
- Some indicator ids of other databases cannot be queried through this API (it answers "indicator not found"); the Actor reports the API message.
- The API is polite-use: the Actor identifies itself, pauses between requests and retries on temporary errors.

### En français (court)

Outil **non officiel** qui reprend l'API publique des indicateurs de la Banque mondiale : valeurs par pays et par année (PIB par habitant, population, espérance de vie...), recherche d'indicateurs par mot-clé, classement des pays sur la dernière valeur disponible. Seuls les indicateurs déclarés **CC BY 4.0** par la Banque mondiale sont servis, avec la licence, la source et la date de mise à jour dans chaque enregistrement. Données macroéconomiques par pays : aucune donnée personnelle.

# Actor input Schema

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

Pick one. "getIndicator" = use when you know the indicator id (e.g. NY.GDP.PCAP.CD) and want its values for some countries and years, one flat row per country and year. "searchIndicators" = use when you only know a topic or keyword (e.g. "unemployment") and need the indicator id, name, unit, source and licence. "compareCountries" = use to rank countries on one indicator using each country's latest available value. Allowed values: getIndicator, searchIndicators, compareCountries. Default: getIndicator.

## `query` (type: `string`):

Words to look for in indicator ids and names, all words must match, accents and case ignored, e.g. "gdp per capita" or "life expectancy". Required in searchIndicators mode (or use topic), ignored in the other modes.

## `topic` (type: `string`):

Optional World Bank topic name or number to restrict the search, e.g. "Health", "Economy & Growth" or "3". Partial names work ("econ"). Empty = all topics. Ignored in the other modes.

## `sourceId` (type: `string`):

World Bank database id to search in, e.g. "2" (World Development Indicators, the main one) or "all" for every database (slower, about 29,000 indicators). Many other databases are listed in the sourceId field of results. Default: "2".

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

World Bank indicator ids as a list, e.g. \["NY.GDP.PCAP.CD"] (GDP per capita, current US$) or \["SP.POP.TOTL", "SP.DYN.LE00.IN"] (population, life expectancy). At most 10; compareCountries takes exactly one. Find ids with searchIndicators. Empty = \["NY.GDP.PCAP.CD"]. Only indicators declared CC BY 4.0 by the World Bank are returned.

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

Countries as a list of ISO3 codes ("FRA"), ISO2 codes ("DE") or exact English names ("United States"), e.g. \["FRA", "DEU", "USA"]. Groups: "all" (every country, no aggregates), "aggregates" (World, regions, income groups), "region:ECS" (Europe & Central Asia), "income:HIC" (high income). Aggregate codes like "WLD" or "EUU" are accepted and flagged isAggregate. Empty = \["FRA", "DEU", "USA"].

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

First year of the period, an integer between 1960 and 2100, e.g. 2015. Use together with endYear, or alone to get everything since that year. Leave empty (and latestValues empty) to get the last 5 available values per country.

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

Last year of the period, an integer between 1960 and 2100, e.g. 2023. In compareCountries mode it caps which year can be used as the latest value. Empty = up to the latest year published.

## `latestValues` (type: `integer`):

Return the most recent N non-empty values of each country, an integer between 1 and 100, e.g. 5. Cannot be combined with startYear or endYear. Empty = 5 when no years are given. Ignored in compareCountries (always the latest one).

## `includeMissing` (type: `boolean`):

true to also return rows where the World Bank has no value (value is null, never filled in; empty rows are billed like any record), e.g. true. Default: false (empty rows are skipped and counted in the run SUMMARY).

## `onlyReusable` (type: `boolean`):

searchIndicators only: true to list only indicators declared CC BY 4.0, which are the only ones getIndicator can return, e.g. true. false also lists indicators under other licences, flagged reusable false. Default: true.

## `order` (type: `string`):

compareCountries only: "desc" = highest value ranks 1 (default), "asc" = lowest value ranks 1, e.g. "desc". Allowed values: desc, asc.

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

Maximum number of records returned (rows, ranked countries or indicators), an integer between 1 and 50000, e.g. 20. All countries over 60 years of one indicator is about 16,000 rows. Default: 20.

## Actor input object example

```json
{
  "mode": "getIndicator",
  "query": "gdp per capita",
  "topic": "Health",
  "sourceId": "2",
  "indicators": [
    "NY.GDP.PCAP.CD"
  ],
  "countries": [
    "FRA",
    "DEU",
    "USA"
  ],
  "startYear": 2015,
  "endYear": 2023,
  "latestValues": 5,
  "includeMissing": false,
  "onlyReusable": true,
  "order": "desc",
  "maxResults": 20
}
```

# Actor output Schema

## `observations` (type: `string`):

One row per country, indicator and year: value, unit, source, licence, last update.

## `ranking` (type: `string`):

compareCountries mode: countries ranked on their latest available value.

## `indicators` (type: `string`):

searchIndicators mode: indicator id, name, unit, source, topics and licence.

## `allFields` (type: `string`):

Every field of every 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": [
        "NY.GDP.PCAP.CD"
    ],
    "countries": [
        "FRA",
        "DEU",
        "USA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("shadow-tools/world-bank-indicators-api").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": ["NY.GDP.PCAP.CD"],
    "countries": [
        "FRA",
        "DEU",
        "USA",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("shadow-tools/world-bank-indicators-api").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": [
    "NY.GDP.PCAP.CD"
  ],
  "countries": [
    "FRA",
    "DEU",
    "USA"
  ]
}' |
apify call shadow-tools/world-bank-indicators-api --silent --output-dataset

```

## MCP server setup

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

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/Flx3G5Fu6SaCIBXhN/builds/ZMx3C5R5a3WvdSCnx/openapi.json
