---
title: "World Bank API: how to query indicators, with examples | APIFor"
description: "How the free World Bank Indicators API works (v2, no key) and how to get the same World Development Indicators from APIFor. Real requests and responses in curl, Python and JavaScript."
canonical: "https://apifor.dev/guides/world-bank-api/"
---

**All guides All docs**

- [Guides](https://apifor.dev/guides/)
- World Bank API documentation

# World Bank API: how to query indicators, with examples

The World Bank Indicators API is free, needs no API key and lives at https://api.worldbank.org/v2/; for example /v2/country/NO/indicator/SP.POP.TOTL?format=json&date=2024 returns Norway's population for 2024. APIFor serves the World Development Indicators at /v1/indicators if you want them behind the same key and JSON shape as other public data, at 1 credit per request.

Last checked 1 Dec 2026. Service: [World development indicators dataset](https://apifor.dev/indicators/). Reference: [endpoint docs](https://apifor.dev/docs/reference/indicators/).

## The official World Bank API in one minute

The World Bank's documentation says the Indicators API gives access to nearly 16,000 time series indicators from over 45 databases, and that API keys are no longer needed. Version 1 was retired in 2018 and switched off in June 2020, so every call needs `v2` in the path.

A call is `/v2/country/{code}/indicator/{indicator}`. Add `format=json`, because the default is XML. `date=2024` or `date=2015:2024` limits the years. On 1 Dec 2026, `https://api.worldbank.org/v2/country/NO/indicator/SP.POP.TOTL?format=json&date=2024` returned a two-element array: paging metadata first (`"lastupdated":"2026-11-11"`), then the rows, with `"value":5572279` for 2024.

That first element trips people up. The data is in `response[1]`, and you have to follow `pages` when a query returns more than `per_page` rows.

## Request

Send your key in the `x-api-key` header. New accounts get 1,000 free requests after email verification; [the quickstart](https://apifor.dev/docs/quickstart/) takes about a minute.

GET curl

```bash
curl 'https://api.apifor.dev/v1/indicators?country=NO&indicator=SP.POP.TOTL' \
  -H 'x-api-key: YOUR_API_KEY'
```

Python

```
import os
import requests

r = requests.get(
    "https://api.apifor.dev/v1/indicators",
    params={
        "country": "NO",
        "indicator": "SP.POP.TOTL",
    },
    headers={"x-api-key": os.environ["APIFOR_API_KEY"]},
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
```

JavaScript

```
const res = await fetch("https://api.apifor.dev/v1/indicators?country=NO&indicator=SP.POP.TOTL", {
  headers: { "x-api-key": process.env.APIFOR_API_KEY },
});
const { data } = await res.json();
console.log(data);
```

## Response

The OpenAPI example shows the shape with an Aruba row. For Norway, our snapshot holds SP.POP.TOTL 5,610,870 for 2025. The full spec is at [api.apifor.dev/v1/openapi.json](https://api.apifor.dev/v1/openapi.json).

200 OK

```json
{
  "success": true,
  "data": [
    {
      "indicator_code": "AG.LND.FRST.ZS",
      "country_iso3": "ABW",
      "country_code": "AW",
      "name": "Forest area (% of land area)",
      "unit": "% of land area",
      "year": 2000,
      "value": 2.72222222222222
    }
  ]
}
```

## The same indicators from APIFor

APIFor holds 298,281 indicator rows for 217 countries and territories from World Development Indicators. Filter by two-letter `country`, World Bank `indicator` code, `year`, or search indicator names with `q`. The response is the usual `{ success, data }` envelope with one row per country, indicator and year, so there is no metadata element to skip.

Use the official API when World Bank data is all you need; it is free and has every series. APIFor is worth it when you already call it for holidays, postal codes or other data and want one key, or when an AI agent reaches it over the [MCP server](https://apifor.dev/docs/mcp/).

## Common indicator codes

`SP.POP.TOTL` is total population, `NY.GDP.MKTP.CD` is GDP in current US dollars and `SP.DYN.LE00.IN` is life expectancy at birth. In our snapshot, Norway's GDP for 2025 is about US$530.8 billion and life expectancy for 2024 is 83.2 years. The World Bank's own indicator list at `https://api.worldbank.org/v2/indicator?format=json` has the full catalogue.

## Errors, limits and cost

A missing or wrong key returns 401, bad parameters return 400 with an `error.code`, and an unknown id returns 404. Rate limits are per key: a limited request gets 429 with a `Retry-After` header in seconds, so wait that long and retry. Calls that fail before any work starts are refunded. Details are in [errors](https://apifor.dev/docs/errors/) and [rate limits](https://apifor.dev/docs/rate-limits/).

This request costs 1 credit. Pricing is prepaid: 1,000 free requests once after email verification, then packs from $5 for 5,000 requests to $149 for 400,000. Credits never expire and there is no subscription. See [pricing](https://apifor.dev/pricing/).

## From an AI assistant

The same data is available as a tool on the APIFor MCP server at `https://mcp.apifor.dev/mcp`. Add it as a remote server in any client that supports remote MCP, sign in with OAuth or send your API key as a Bearer token, and ask in plain language. MCP calls use the same key and credits as REST. Setup steps are on the [MCP page](https://apifor.dev/docs/mcp/).

## Alternatives

- [World Bank Indicators API (v2)](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation): Free, no key, nearly 16,000 indicators from over 45 databases, per its documentation.
- [wbgapi for Python](https://pypi.org/project/wbgapi/): A Python wrapper around the official API that returns pandas DataFrames. Our Python guide shows it side by side with APIFor.

Facts about other services come from their own pages or a test call on 1 Dec 2026. Prices and limits change, so confirm them there.

## Source and licence

World Development Indicators, The World Bank, CC BY 4.0 (https://data.worldbank.org). APIFor serves a copy; the World Bank does not endorse it.

Every APIFor response carries the same attribution in `meta.attribution`. All sources are listed on [sources and licences](https://apifor.dev/sources/).

## FAQ

### Does the World Bank API need an API key?

No. The World Bank's documentation says API keys and other authentication are no longer needed.

### Why does the World Bank API return XML?

XML is the default. Add format=json to the query string to get JSON.

### What does APIFor add over the official API?

One key and one response shape shared with other datasets and services, and access from AI clients over MCP. It holds fewer series than the World Bank, so use the official API for anything outside World Development Indicators.

## Related

- [World development indicators dataset](https://apifor.dev/indicators/)
- [Endpoint reference](https://apifor.dev/docs/reference/indicators/)
- [World Bank API in Python](https://apifor.dev/docs/world-bank-python/)
- [Statistics API (OECD, IMF)](https://apifor.dev/services/statistics/)
- [All datasets for Norway](https://apifor.dev/countries/norway/)
- [All guides](https://apifor.dev/guides/)

[Get a free API key](https://app.apifor.dev/register) [Use it from an AI client (MCP)](https://apifor.dev/docs/mcp/)
