Use Cases

African Indicators and Time Series API

Discover African indicators, request observations and time series, and rank countries for a selected year.

Use /v1/indicators to find a metric and /v1/data to request its observations. Country and year coverage varies by metric.

TaskEndpoint
Browse metrics and coverage/v1/indicators
Inspect one metric's definition/v1/indicators/{metric_key}
Query values or time series/v1/data
Rank countries for a year/v1/indicators/{metric_key}/rankings

Start with /v1/indicators when you need discovery. Start with /v1/data when you already know the metric you want.

Example: Discover Climate Indicators

curl "https://api.africa-api.com/v1/indicators?category=climate&has_data=true" \
  -H "Authorization: Bearer $AFRICA_API_KEY"

has_data=true restricts discovery to metrics with stored observations. Inspect each metric for the countries and years available.

Example: Compare GDP Across Countries

curl "https://api.africa-api.com/v1/data?country_codes=ng,ke,za&metric_key=gdp_current_usd&year=2024" \
  -H "Authorization: Bearer $AFRICA_API_KEY"

country_codes requests several countries in one call. A country with no observation for 2024 may be absent from the result.

Example: Get The Latest Value For One Metric

curl "https://api.africa-api.com/v1/data?country_code=ke&metric_key=population_total&latest=true" \
  -H "Authorization: Bearer $AFRICA_API_KEY"

latest=true selects the most recent stored observation. Check its year before presenting it as a current value.

Example: Rank Countries By One Indicator

curl "https://api.africa-api.com/v1/indicators/gdp_current_usd/rankings?year=2024&limit=10" \
  -H "Authorization: Bearer $AFRICA_API_KEY"

Rankings require a year and include countries with observations for that metric. A missing country is not a zero value.

African Indicators API FAQ

Which indicators are available?

/v1/indicators?has_data=true lists metrics with stored data across topics such as demographics, economy, agriculture, climate, health and infrastructure. Check the returned coverage metadata for the countries and years available; the catalog does not imply a complete series for every country.

How do I rank African countries by GDP via API?

GET /v1/indicators/gdp_current_usd/rankings?year=2024 requests countries ordered by GDP for that year. Use another metric key to rank a different indicator, subject to available observations.

Where does the indicator data come from?

Providers include World Bank WDI, IMF, ILO, FAOSTAT, WHO, UNICEF, UNESCO, ITU and IRENA. Use an observation's source field to look up /v1/sources/{source_code} for source metadata and the latest successful refresh. Pin source= in a data query when you need a particular provider.

On this page