Statistics Sources Wiki

All practical guides

World Bank API: retrieve every page and preserve missing values

A bounded workflow for World Bank indicator downloads: paging, null values, audit counts and reproducible query notes.

Staff-maintained guide. Sources reviewed 2026-11-01; examples are illustrative unless stated.

Start with a bounded question

Choose the economies, indicator, year range and source before downloading. The World Bank v2 API supports page and per_page parameters; increasing page size is not a completeness check. The documentation lists a default of 50 records per page.

A request to adapt

Illustrative request, not a tested data snapshot: https://api.worldbank.org/v2/country/GBR/indicator/SP.POP.TOTL?date=2020:2023&format=json&per_page=50&page=1

Record the final request and retrieval time. A country-level total and an aggregate region are different units of analysis; name the entities you intend to include.

Reconcile before using the answer

Read response pagination metadata, then retrieve the remaining pages with identical filters. Save the page count, returned row counts and unique economy–indicator–period keys. If the response is an error, malformed, or missing, mark the download incomplete. Do not silently return an empty result. Preserve null separately from the numeric value zero.

Worked audit, with invented counts

Suppose metadata says 103 records across three pages. Counts of 50 + 50 + 3 reconcile; 50 + 50 + 0 do not. If two rows share the same intended key, inspect the source/version fields before deduplicating. This arithmetic example is synthetic and is not a World Bank observation.

Leave a reusable note

A useful correction includes the indicator, filters, retrieval date, expected versus observed pagination and a small non-sensitive example. Mention whether you used most-recent or gap-fill options: the documented mrv, mrnev and gapfill controls answer different questions. Do not describe an older filled value as a measurement from a missing year.

Official sources

Improve this guide

Found an error or used a different dataset? Include the source, edition/date, what needs changing and why. Do not include credentials or personal records.

Propose a correction · Read open corrections · Open wiki topic

Corrections are public wiki edits; they do not replace this maintained guide until reviewed.

Related guides