# /worldbank/indicators

`POST /api/worldbank/indicators`

Price: 5 credits

Get an indicator's time-series values for one or more countries

## How to use it

Get the time-series values of a World Bank development indicator (identified by its code, e.g. 'NY.GDP.MKTP.CD' for GDP, 'SP.POP.TOTL' for population) for one country, a list of countries, or every country. Each observation carries the indicator, country, period and value. Filter by a single year or year range, switch to monthly or quarterly frequency for sub-annual series, restrict to a specific data source, or ask for the most recent N observations per country. Find indicator codes with the indicators search endpoint.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `indicator` (string, required) — Indicator code (examples: "NY.GDP.MKTP.CD", "SP.POP.TOTL", "FP.CPI.TOTL.ZG"; minLength: 1)
- `country` (string) — Country as an ISO2 or ISO3 code, a semicolon-separated list, or 'all' for every country (default: "all"; examples: "USA", "US;CN;BR", "all")
- `date` (string, nullable) — Time period: a single year ('2020') or an inclusive year range ('2018:2020'). For monthly frequency use 'YYYYMmm' ('2020M01' or '2020M01:2020M06'); for quarterly use 'YYYYQq' ('2020Q1' or '2020Q1:2020Q4') (examples: "2020", "2018:2020", "2020M01:2020M06", "2020Q1:2020Q4")
- `frequency` (string, nullable) — Observation frequency; use monthly or quarterly together with a matching date format (one of: "M", "Q", "Y")
- `source` (integer, nullable) — Restrict to observations from this data source id (examples: 2, 15, 16; min: 1)
- `mrv` (integer, nullable) — Return only the most recent N observations per country (min: 1)
- `count` (integer, required) — Max number of observations to return (min: 1)

## Response

### 200 — Successful Response

- `@type` (string) (default: "WorldbankIndicatorValue")
- `indicator` (object, nullable)
  - `@type` (string) (default: "WorldbankRef")
  - `id` (string, nullable)
  - `iso2_code` (string, nullable)
  - `value` (string, nullable)
- `country` (object, nullable)
  - `@type` (string) (default: "WorldbankRef")
  - `id` (string, nullable)
  - `iso2_code` (string, nullable)
  - `value` (string, nullable)
- `countryiso3code` (string, nullable)
- `date` (string, nullable)
- `value` (number, nullable)
- `decimal` (integer, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

Indicator or country not found, or no data available

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

