Every World Bank indicator, queryable offline, with cross-country SQL and rankings no wrapper has.
A single-binary CLI for the World Bank Open Data API. Mirrors the ~16,000-indicator catalog and observations into local SQLite for offline search, then adds cross-country compare, rankings, trend stats, and pipeline exports the Python wrappers and MCP shims don't offer. No API key — World Bank is fully public.
Quick Start
# confirm the API is reachable (no key needed)
world-bank-pp-cli doctor --dry-run
# discover the indicator code you want
world-bank-pp-cli indicators find "gdp"
# pull the time-series
world-bank-pp-cli data USA NY.GDP.MKTP.CD --date 2010:2024
# compare across countries
world-bank-pp-cli compare NY.GDP.MKTP.CD USA,CHN,IND --date 2024
Unique Features
These capabilities aren't available in any other tool for this API.
Offline catalog
-
indicators find — Search the full ~16,000-indicator catalog by keyword in a single call.
Agents discover the exact indicator code before fetching values, in one local call.
world-bank-pp-cli indicators find "co2 emissions" --json
Local joins
-
compare — Line up one indicator across many countries in a single aligned table with deltas vs a baseline.
One call answers 'how do these economies compare' without N separate fetches.
world-bank-pp-cli compare NY.GDP.MKTP.CD USA,CHN,IND --date 2024 --agent
-
trend — CAGR, year-over-year change, min/max/latest for one country+indicator series.
Agents get the trajectory summary directly instead of parsing decades of rows.
world-bank-pp-cli trend USA NY.GDP.MKTP.CD --window 10 --agent
-
rank — Rank all economies by an indicator for a year, filtered by region or income level.
Find leaders/laggards on any indicator in one call.
world-bank-pp-cli rank NY.GDP.PCAP.CD --year 2024 --top 10 --income HIC --agent
Data pipeline
-
export — Bulk country x indicator pull emitted as pipeline-ready wide or long CSV.
Drops straight into notebooks, sheets, and ETL without reshaping.
world-bank-pp-cli export USA,CHN NY.GDP.MKTP.CD,SP.POP.TOTL --wide --csv
-
data diff — Compare a fresh pull against the last synced snapshot to surface revised observations.
Detect World Bank data revisions between vintages automatically.
world-bank-pp-cli data diff USA NY.GDP.MKTP.CD --agent
Recipes
Find then fetch
world-bank-pp-cli indicators find "life expectancy" --json --select id,name
Discover the code, then pass it to data fetch.
Compact cross-country GDP
world-bank-pp-cli compare NY.GDP.MKTP.CD USA,CHN,IND,DEU --date 2024 --agent --select country.value,date,value
Narrow a deeply nested response to just the fields that matter.
Top economies by GDP per capita
world-bank-pp-cli rank NY.GDP.PCAP.CD --year 2024 --top 10 --income HIC
Rank and filter in one call.
Pipeline export
world-bank-pp-cli export USA,CHN NY.GDP.MKTP.CD,SP.POP.TOTL --wide --csv
Wide CSV ready for a notebook.
Usage
Run world-bank-pp-cli --help for the full command reference and flag list.
Commands
countries
Economies (countries and aggregates) with region, income level, lending type
world-bank-pp-cli countries get - Get one economy by ISO code (e.g. USA, BRA)
world-bank-pp-cli countries list - List economies
data
Indicator observations (the time-series). Polished output via hand-authored fetch.
world-bank-pp-cli data <country> <indicator> - Fetch indicator observations for one or more countries (raw envelope)
income_levels
Income level classifications
world-bank-pp-cli income-levels - List income levels
indicators
The ~16,000 indicator catalog (series definitions)
world-bank-pp-cli indicators get - Get indicator metadata by code (e.g. NY.GDP.MKTP.CD)
world-bank-pp-cli indicators list - List indicators
lending_types
Lending type classifications
world-bank-pp-cli lending-types - List lending types
regions
Regions
world-bank-pp-cli regions - List regions
sources
Data sources (e.g. World Development Indicators)
world-bank-pp-cli sources - List data sources
topics
Topics (e.g. Health, Education) and their indicators
world-bank-pp-cli topics indicators - List indicators under a topic
world-bank-pp-cli topics list - List topics
Output Formats
# Human-readable table (default in terminal, JSON when piped)
world-bank-pp-cli countries list
# JSON for scripting and agents
world-bank-pp-cli countries list --json
# Filter to specific fields
world-bank-pp-cli countries list --json --select id,name,status
# Dry run — show the request without sending
world-bank-pp-cli countries list --dry-run
# Agent mode — JSON + compact + no prompts in one flag
world-bank-pp-cli countries list --agent
Agent Usage
This CLI is designed for AI agent consumption:
- Non-interactive - never prompts, every input is a flag
- Pipeable -
--json output to stdout, errors to stderr
- Filterable -
--select id,name returns only fields you need
- Previewable -
--dry-run shows the request without sending
- Read-only by default - this CLI does not create, update, delete, publish, send, or mutate remote resources
- Offline-friendly - sync/search commands can use the local SQLite store when available
- Agent-safe by default - no colors or formatting unless
--human-friendly is set
Exit codes: 0 success, 2 usage error, 3 not found, 5 API error, 7 rate limited, 10 config error.
Health Check
world-bank-pp-cli doctor
Verifies configuration and connectivity to the API.
Configuration
Config file: ~/.config/world-bank-pp-cli/config.toml
Static request headers can be configured under headers; per-command header overrides take precedence.
Troubleshooting
Not found errors (exit code 3)
- Check the resource ID is correct
- Run the
list command to see available items
API-specific
- Empty data array for a country+indicator — Not all indicators cover all economies; try --mrv 5 or a wider --date range.
- Aggregate rows mixed with countries — Use --income or --region filters, or filter by countryiso3code in --select.
Sources & Inspiration
This CLI was built by studying these projects and resources:
Generated by CLI Printing Press