# Annual Country Indicators: GDP & Population (`atesen-software/world-bank-indicators`) Actor

Compare GDP, GDP per capita, GDP growth, population and life expectancy across countries and years. Export cited observations from World Development Indicators with revision dates and license links.

- **URL**: https://apify.com/atesen-software/world-bank-indicators.md
- **Developed by:** [Atesen Software](https://apify.com/atesen-software) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 58.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 1,000 numeric observations

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

## Annual Country Indicators: GDP & Population

Compare annual GDP, GDP per capita, GDP growth, population and life expectancy using World Development Indicators. Choose countries or regional aggregates, then request an annual range or the latest nonempty observations. The Actor uses the public data API without credentials.

### Use cases

- **Country comparisons and dashboards**: pull GDP, population or life expectancy for a hand-picked set of countries over exact years, with clean numeric values.
- **Academic and policy research**: every observation carries the indicator and country codes and names, unit, footnote, source database ID and source last-update date, so citations stay traceable.
- **Economics education and demos**: small runs capped at 100 observations for teaching examples and quick lookups.
- **Reproducible pipelines**: values are returned as supplied, deduplicated by indicator, ISO3 and year, with the original API URL saved on every row.

### Input

Choose **1–10** country or aggregate codes and any of the five verified indicators. `date` accepts `YYYY` or `YYYY:YYYY`, with up to 101 annual observations from 1960 to 2100. Omit `date` to request `latestValues` (default 1, maximum 10). The latest available year can vary across countries and indicators.

| Field | What it does |
|---|---|
| `countries` | 1–10 ISO2/ISO3 country codes or aggregate codes such as `US`, `CA` or `WLD`. |
| `indicators` | `NY.GDP.MKTP.CD` (GDP), `NY.GDP.PCAP.CD` (GDP per capita), `NY.GDP.MKTP.KD.ZG` (GDP growth), `SP.POP.TOTL` (population), `SP.DYN.LE00.IN` (life expectancy). |
| `date` | Optional annual range, used instead of `latestValues`. |
| `latestValues` | Only when `date` is omitted: how many recent nonempty observations per country and indicator. |
| `maxRecords` | Hard cap on saved numeric observations per run (default 20, maximum 100). |
| `maxRequests` | Hard cap on API pages requested (default 5, maximum 10). Automatic retries after a temporary World Bank error do not use it up. |

```json
{
  "countries": ["US", "CA"],
  "indicators": ["NY.GDP.MKTP.CD", "SP.POP.TOTL"],
  "date": "2020:2023",
  "maxRecords": 20,
  "maxRequests": 5
}
```

Requests are serial with at least one second between them, and indicator requests follow input order — so a small `maxRecords` or `maxRequests` may stop before later indicators are visited. World Bank does not guarantee a user-controlled sort order. Aggregate codes return aggregate values, not individual country values. ISO2 and ISO3 aliases and repeated records are deduplicated.

### Output

Each saved row is an `observation` (paid, numeric `value`) or a free `status` row. Observation fields:

- `recordType`, `indicatorCode`, `indicatorName`, `countryCode`, `countryName`, `countryIso3`
- `year`, `value`, `unit`, `observationStatus`, `decimal`, `footnote`
- `sourceId`, `sourceDataset`, `sourceLastUpdated`, `sourceUrl`, `indicatorUrl`, `attribution`, `licenseUrl`, `termsUrl`, `fetchedAt`

Illustrative observation (not a captured live result):

```json
{
  "recordType": "observation",
  "indicatorCode": "NY.GDP.MKTP.CD",
  "indicatorName": "GDP (current US$)",
  "countryCode": "TUR",
  "countryName": "Turkiye",
  "countryIso3": "TUR",
  "year": 2023,
  "value": 1118084257757.35,
  "unit": "",
  "observationStatus": "",
  "decimal": null,
  "footnote": null,
  "sourceId": "2",
  "sourceLastUpdated": "2024-09-13",
  "sourceDataset": "World Development Indicators",
  "sourceUrl": "https://api.worldbank.org/v2/country/TUR/indicator/NY.GDP.MKTP.CD?source=2&format=json&date=2023",
  "indicatorUrl": "https://data.worldbank.org/indicator/NY.GDP.MKTP.CD",
  "attribution": "World Bank, World Development Indicators; listed data providers: National Statistical Organizations and/or Central Banks; OECD National Accounts; World Bank staff estimates. Selected metadata was normalized; the observation value is unchanged.",
  "licenseUrl": "https://creativecommons.org/licenses/by/4.0/",
  "termsUrl": "https://data.worldbank.org/summary-terms-of-use",
  "fetchedAt": "2026-10-22T10:00:00.000Z"
}
```

Values are returned as supplied: a blank unit is preserved rather than inferred, and null observations are excluded (a numeric zero counts as a genuine observation). Free `status` rows carry `status`, `message`, plus a run summary with `requests`, `resultRows`, `missingValues`, and — when a long Retry-After delay ends the run — `retryAt`. Export JSON, CSV or Excel through the Apify dataset.

### Pricing

Each saved numeric observation triggers one `result` event. Status rows are free. See the Store pricing tab for the current rate. The Actor checks the result budget before requesting data and before saving observations. Apify platform usage may apply separately.

### Use via API

One request runs the Actor, waits for it and returns the dataset items as JSON. Send your token in the `Authorization` header, not in the URL:

```bash
curl -X POST "https://api.apify.com/v2/acts/atesen-software~world-bank-indicators/run-sync-get-dataset-items?timeout=120" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"countries":["US","DE"],"indicators":["NY.GDP.MKTP.CD"],"date":"2023"}'
```

The synchronous endpoint waits up to 300 seconds. For longer jobs start a run with `POST https://api.apify.com/v2/acts/atesen-software~world-bank-indicators/runs` and read the dataset when it finishes.

**JavaScript** (`npm install apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('atesen-software/world-bank-indicators').call({ countries: ["US", "DE"], indicators: ["NY.GDP.MKTP.CD"], date: "2023" });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Use with AI agents (MCP)

Claude Desktop, Cursor, VS Code and other MCP clients can call this Actor as a tool through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Load only this Actor with:

```text
https://mcp.apify.com?tools=atesen-software/world-bank-indicators
```

Client config (sign in with Apify OAuth when the browser opens, or add an `Authorization: Bearer <APIFY_TOKEN>` header instead):

```json
{
  "mcpServers": {
    "apify": { "url": "https://mcp.apify.com?tools=atesen-software/world-bank-indicators" }
  }
}
```

Then ask in plain words, for example: "What was the GDP of the US and Germany in 2023 according to the World Bank?" The agent fills the same input fields you see on the Input tab, and runs are billed to your Apify account at the prices on the Pricing tab.

### FAQ

**Can I request all countries and all indicators?**
Choose up to 10 country or aggregate codes and select from the five listed indicators. The Actor checks that the response came from World Development Indicators before saving data.

**Why do my "latest" values have different years for different countries?**
`latestValues` maps to the API's `mrnev` (most recent nonempty value) parameter. Some countries lag by a year or more, so the newest available value differs per country and indicator. Set an explicit `date` range if you need aligned years.

**How far back does the data go?**
Annual data from 1960 to 2100 (World Bank publishes projections for some indicators), up to 101 years per request.

**How big can a run be?**
Hard caps: 100 saved observations and 10 API page requests (plus at most 3 automatic retries per page on temporary errors), with serial requests at least one second apart. Small runs are the design, not a bug.

**What happens on an upstream error?**
Access failures end the run with a free status row rather than returning partial data silently; partial observations saved before a later request fails remain available in the dataset. Unexpected parser or storage errors fail the run. HTTP 401/403/429 handling includes stopping with a `retryAt` timestamp on long Retry-After delays.

Temporary World Bank errors (HTTP 500, 502, 503, 504, a short HTTP 429, connection resets or timeouts) are retried up to 3 times for the affected page with exponential backoff (2, 4 and 8 seconds). Retries do not count toward `maxRequests`. If the API is still down after the 4th attempt, the run ends **SUCCEEDED** with one free `status` row (`status: "upstream_unavailable"`, the HTTP code, the number of attempts and a plain message); you pay only for observations saved before the outage. Run it again a few minutes later.

**How fresh is the data?**
As fresh as the World Bank API at run time; every row stores `sourceLastUpdated` so you know which revision you got.

### Support and legal

- Questions or problems: use the **Issues** tab of this actor. This actor is not affiliated with or endorsed by the World Bank.
- Primary sources: [World Bank API access and authentication](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392), [parameters, pagination, dates and MRNEV](https://datahelpdesk.worldbank.org/knowledgebase/articles/898581), [country queries](https://datahelpdesk.worldbank.org/knowledgebase/articles/898590-country-api-queries), [indicator metadata](https://datahelpdesk.worldbank.org/knowledgebase/articles/898599-indicator-api-queries).
- Each observation includes the publisher, dataset, listed source organizations, indicator page, [CC BY 4.0 license](https://creativecommons.org/licenses/by/4.0/) and [World Bank dataset terms](https://data.worldbank.org/summary-terms-of-use). Keep those fields with redistributed data.
- No personal data is collected. This Actor does not provide financial advice or forecast future observations.

#### Run and verify locally

```sh
npm ci
npm test
LOCAL_MODE=1 INPUT_PATH=input.example.json OUTPUT_DIR=evidence/local npm start
```

### Related actors

- [USGS Earthquake Catalog Search](https://apify.com/atesen-software/usgs-earthquake-search)
- [EU Fuel Prices: Spain & France Gas Station Prices](https://apify.com/atesen-software/eu-fuel-prices)
- [Wikipedia Pageviews Trend Radar (GDELT News Bonus)](https://apify.com/atesen-software/trend-radar-wikipedia-gdelt)

# Actor input Schema

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

1–10 ISO2/ISO3 country or World Bank aggregate codes. Example US, CA or WLD. all is unsupported.

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

Choose NY.GDP.MKTP.CD (GDP), NY.GDP.PCAP.CD (GDP per capita), NY.GDP.MKTP.KD.ZG (GDP growth), SP.POP.TOTL (population), or SP.DYN.LE00.IN (life expectancy).

## `date` (type: `string`):

Optional YYYY or YYYY:YYYY, from 1960 to 2100, at most 101 years. Use date or latestValues.

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

Used only when date is omitted. Requests MRNEV per country and indicator; years can differ.

## `maxRecords` (type: `integer`):

Hard limit for numeric observation rows across all requested indicators.

## `maxRequests` (type: `integer`):

Hard cap on API pages requested (serial pagination). Up to 3 automatic retries per page on temporary World Bank errors do not count.

## Actor input object example

```json
{
  "countries": [
    "US"
  ],
  "indicators": [
    "NY.GDP.MKTP.CD"
  ],
  "maxRecords": 20,
  "maxRequests": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("atesen-software/world-bank-indicators").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("atesen-software/world-bank-indicators").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 '{}' |
apify call atesen-software/world-bank-indicators --silent --output-dataset

```

## MCP server setup

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

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/RDQTp9chalM8IK0yn/builds/3yR2PmTM9KNJPo25k/openapi.json
