# World Bank WDI Indicators (`lanternlab318/world-bank-indicators`) Actor

Collect country-year GDP and population observations for market research with source attribution and explicit missing values.

- **URL**: https://apify.com/lanternlab318/world-bank-indicators.md
- **Developed by:** [Lantern Lab](https://apify.com/lanternlab318) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.49 / 1,000 observation 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/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 WDI Indicators

Collect country-year GDP and population observations for market research with source attribution and explicit missing values.

### Input

```json
{
  "countries": [
    "US"
  ],
  "indicators": [
    "SP.POP.TOTL"
  ],
  "startYear": 2023,
  "endYear": 2024,
  "maxItems": 20
}
```

Only WDI source 2 and SP.POP.TOTL (population), NY.GDP.MKTP.CD (GDP current USD), NY.GDP.PCAP.CD (GDP per capita current USD) are supported. No arbitrary source or indicator passthrough. Attribution: World Bank, World Development Indicators, original indicator source as described at https://data.worldbank.org/indicator/<indicator>. CC BY 4.0 with World Bank additional terms; preserve source and license URLs. Values may be revised or unavailable; null is a free missing_value row, never replaced with zero. Country/indicator/year keys are deduplicated; each page has at most 100 observations. Data are research inputs, not investment advice.

`maxItems` defaults to 100 (hard maximum 1,000 unique billable rows). `maxUpstreamRequests` defaults to 5 (hard maximum 20); every attempt including failed requests counts. Input limits are enforced in code as well as the UI. Omitted request limits use the documented finite default.

### Output and charging

One `observation` row per unique stable ID, with `id`, `country`, `countryName`, `indicator`, `indicatorName`, `year`, `value`, `unit`, `source`, `license`, `licenseUrl`, `sourceUrl`, and `collectedAt`. Missing optional source fields are null, never fabricated. Free `input_status` rows distinguish empty input results from HTTP failures, schema drift, blocked/rate-limited sources and budget stops. A free `run_summary` row and `RUN_SUMMARY` key-value record expose result count, actual SDK charged count, failures, duplicates, request attempts and stop reason. A cap or failure marks the summary partial; already stored results remain real observations.

Only unique real result rows pass the named result event to `Actor.pushData`. No run-start charge is emitted. Free statuses, summary rows and missing-value rows have no event. The price is $0.49 per 1,000 `observation` rows, with no start fee. A pre-push SDK budget check prevents the SDK from attempting an extra paid row at a depleted budget; its charge-limit response stops collection immediately. Positive default dataset-item pricing is refused to keep status rows free; only the named result event is priced, with no automatic run-start charge. Local runs may report zero charged events when billing is not configured. Empty successful collections are valid; failed collections with no real results fail the run after saving diagnostics. Storage or charging failures abort the run and are not disguised as upstream errors.

### Cost and access boundaries

Built-in Node HTTPS fetch only; fixed official hostname, no credentials, cookies, arbitrary input URLs, proxies, redirects, browser or paid upstream. Requests are sequential and separated by at least 1.1 seconds, timeout 20 seconds per request, decoded response hard limit 5 MiB. Collection has a 180-second wall-clock budget (plus bounded final storage writes). The SDK handles abort shutdown; an abort listener also cancels the in-flight fetch/body or pacing wait and prevents new requests and result charges. Diagnostics on platform abort are best-effort because the SDK exits. No retries. HTTP 403/429 stops the run, preserving partial results. Requests and item ceilings bound work; platform usage is included in the result price. Rerunning starts a fresh dataset; restart/resume idempotency across process crashes is not implemented.

### Official upstream references

- https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation
- https://datahelpdesk.worldbank.org/knowledgebase/articles/898581-api-basic-call-structures
- https://datacatalog.worldbank.org/public-licenses

The official API can be slow or temporarily unavailable. A network error or transient server error receives one retry when the request and time budgets allow. Each attempt counts toward the same limit. An unrecovered lookup produces explicit diagnostics and no observation charge.

# Actor input Schema

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

ISO2 or ISO3 country codes, such as US. The all-country selector is not supported.

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

Supported WDI source 2 indicators: SP.POP.TOTL, NY.GDP.MKTP.CD, NY.GDP.PCAP.CD.

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

First year to include, from 1960 to the current year.

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

Last year to include; defaults to the current UTC year.

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

Stop after this many unique real result rows. Status and missing-value rows are free.

## `maxUpstreamRequests` (type: `integer`):

Hard cap on all upstream request attempts, including failed requests.

## Actor input object example

```json
{
  "countries": [
    "US"
  ],
  "indicators": [
    "SP.POP.TOTL"
  ],
  "startYear": 2023,
  "endYear": 2023,
  "maxItems": 3,
  "maxUpstreamRequests": 2
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "countries": [
        "US"
    ],
    "indicators": [
        "SP.POP.TOTL"
    ],
    "startYear": 2023,
    "endYear": 2023,
    "maxItems": 3,
    "maxUpstreamRequests": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("lanternlab318/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": ["US"],
    "indicators": ["SP.POP.TOTL"],
    "startYear": 2023,
    "endYear": 2023,
    "maxItems": 3,
    "maxUpstreamRequests": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("lanternlab318/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": [
    "US"
  ],
  "indicators": [
    "SP.POP.TOTL"
  ],
  "startYear": 2023,
  "endYear": 2023,
  "maxItems": 3,
  "maxUpstreamRequests": 2
}' |
apify call lanternlab318/world-bank-indicators --silent --output-dataset

```

## MCP server setup

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