# World Bank Indicators Data (`grit-77/world-bank-indicators`) Actor

World Bank development-indicator scraper for country and annual time-series datasets. Export observations or search indicator metadata as JSON, with optional missing-value rows.

- **URL**: https://apify.com/grit-77/world-bank-indicators.md
- **Developed by:** [Grit](https://apify.com/grit-77) (community)
- **Categories:** AI, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 data blocks

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 Data

World Bank indicators API returns annual observations by country, indicator, and year from the public World Bank API. World Bank data scraper output can also search indicator metadata and preserve missing values when requested.

### What it does

Choose country codes, indicator IDs, and an annual date range. `mode: "search"` searches indicator names, IDs, and source notes instead of returning observations. `includeNulls` keeps missing-value rows; otherwise those rows are omitted.

### Input example

```json
{
  "mode": "data",
  "countries": [
    "USA"
  ],
  "indicators": [
    "SP.POP.TOTL"
  ],
  "startYear": 2022,
  "endYear": 2022,
  "maxItems": 10
}
```

The example uses fields defined in the actor input schema. Other filters can be set in the Apify input form.

### Output fields

Examples below come from the first record in [sample_output.json](sample_output.json); long strings and arrays are shown as excerpts. Other modes and error rows can have different fields.

| Field | Type in sample | Example value |
|---|---|---|
| `type` | string | `"datapoint"` |
| `countryCode` | string | `"USA"` |
| `countryId` | string | `"US"` |
| `countryName` | string | `"United States"` |
| `indicatorId` | string | `"SP.POP.TOTL"` |
| `indicatorName` | string | `"Population, total"` |
| `year` | number | `2022` |
| `value` | number | `333996304` |
| `unit` | string | `""` |
| `decimal` | number | `0` |
| `observationStatus` | string | `""` |
| `sourceId` | string | `"2"` |
| `lastUpdated` | string | `"2026-07-13"` |
| `sourceUrl` | string | `"https://api.worldbank.org/v2/country/USA/indicator/SP.POP.TOTL?format=json&source…` |
| `retrievedAt` | string | `"2026-10-05T12:44:25.062410+00:00"` |
| `errors` | array | `[]` |

### Output example

A trimmed record copied from [sample_output.json](sample_output.json):

```json
{
  "type": "datapoint",
  "countryCode": "USA",
  "countryId": "US",
  "countryName": "United States",
  "indicatorId": "SP.POP.TOTL",
  "indicatorName": "Population, total",
  "year": 2022,
  "value": 333996304,
  "unit": "",
  "decimal": 0,
  "observationStatus": "",
  "sourceId": "2",
  "lastUpdated": "2026-07-13",
  "sourceUrl": "https://api.worldbank.org/v2/country/USA/indicator/SP.POP.TOTL?format=json&source=2&date=2022",
  "retrievedAt": "2026-10-05T12:44:25.062410+00:00",
  "errors": []
}
```

### FAQ

**What limits the export?** `maxItems` caps all rows, including missing values, search results, and errors. Data mode is annual, and pagination and concurrency are bounded by the input settings.

**Do I need a key, proxy, or login?** No. The actor uses public World Bank endpoints without authentication.

**What is the pricing model?** The proposed `datapoint` event costs $0.001 per block of up to 100 saved non-null observations, pooled across the run. Search, null, and error rows do not trigger that event. The owner must configure the event in Apify before publication.

**How are rate limits handled?** Timeouts, invalid JSON, HTTP 429, and server failures get at most four attempts with backoff. Numeric `Retry-After` is honored up to 30 seconds.

**How current are the values?** `lastUpdated` comes from the World Bank response and `retrievedAt` records the run. Recent values can be missing and historical values can be revised; no interpolation is performed.

### Use with AI agents / MCP

After this actor is available to your account, configure it as an actor tool in the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp), or start a run through the [Apify API](https://docs.apify.com/api/v2) with the same input JSON. Give the agent the actor identifier and access through your Apify credentials. Read the completed run’s default dataset through the returned run or dataset reference, check error fields before using records, and keep source URLs with quoted data. Limit the input to the task the agent is answering.

### Source and reuse notes

An empty `unit` may be source data. Read the indicator definition before interpreting a value. Aggregates should not be added to country totals. Follow the [World Bank dataset terms](https://www.worldbank.org/ext/en/legal/terms-conditions/datasets) and source-specific attribution restrictions.

# Actor input Schema

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

Data mode retrieves annual observations. Search mode finds case-insensitive substrings in indicator IDs, names and source notes within the selected source. Search results generate no datapoint events.

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

ISO two- or three-character country codes, World Bank aggregate codes such as WLD, or the single entry all. Duplicate codes are removed. At most 300 entries; used in data mode.

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

World Bank indicator IDs. Use search mode to find codes and source descriptions. At most 200 entries; duplicates are removed; used in data mode.

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

First annual observation year, inclusive. Must not exceed the end year or current UTC year.

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

Last annual observation year, inclusive. Omit to use the previous UTC year. Values for recent years may be missing.

## `sourceId` (type: `integer`):

Defaults to source 2: World Development Indicators. Applies to both catalogue search and observation requests; an indicator must exist in this source. Only annual observation dates are supported.

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

Required in search mode. A literal, case-insensitive substring of the ID, name or source note; at most 200 characters.

## `includeNulls` (type: `boolean`):

Return null observation rows when true. Missing values and error rows never generate datapoint events. Numeric zero is a valid, billable point.

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

Hard cap across the entire dataset, including observations, missing values, search results and errors. Concurrent jobs may finish in different orders.

## `concurrency` (type: `integer`):

Maximum active country/indicator queries. Pages within a query are fetched sequentially. Search mode uses one catalogue stream.

## `pageSize` (type: `integer`):

Requested records per official API page. Smaller values are useful for narrow queries; catalogue search may need more requests.

## Actor input object example

```json
{
  "mode": "data",
  "countries": [
    "USA",
    "TUR"
  ],
  "indicators": [
    "SP.POP.TOTL",
    "NY.GDP.MKTP.CD"
  ],
  "startYear": 2020,
  "endYear": 2025,
  "sourceId": 2,
  "query": "GDP",
  "includeNulls": false,
  "maxItems": 1000,
  "concurrency": 3,
  "pageSize": 1000
}
```

# Actor output Schema

## `dataset` (type: `string`):

Read the default dataset as JSON; use dataset export parameters for other formats.

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

// Run the Actor and wait for it to finish
const run = await client.actor("grit-77/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 = {
    "countries": [
        "USA",
        "TUR",
    ],
    "indicators": [
        "SP.POP.TOTL",
        "NY.GDP.MKTP.CD",
    ],
    "endYear": 2025,
    "query": "GDP",
}

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,grit-77/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/JLPv7BSv9CZxqIUuH/builds/3RtZguj2PgjwVh3tD/openapi.json
