# Africa API — Full Documentation > Query African country records, indicators, markets, trade and government data through one REST API. Coverage and reporting periods vary by dataset. API base URL: https://api.africa-api.com OpenAPI schema: https://api.africa-api.com/openapi.json Condensed index: https://africa-api.com/llms.txt MCP server: npx -y africa-api-mcp (https://www.npmjs.com/package/africa-api-mcp) --- # Data Explorer URL: https://africa-api.com/data Description: Browse 207 indicators with country rankings, sources and available history. Country and year coverage varies by metric. The currency converter at https://africa-api.com/convert shows USD pairs, rate sources and available history. Query indicator observations with an API key: https://api.africa-api.com/v1/data?metric_key=&latest=true&country_codes=NG,KE,ZA ## Indicators (rankings include countries with available observations) ### Economy - GDP (metric_key: gdp_current_usd) — https://africa-api.com/data/gdp: Gross domestic product in current US dollars. - GDP per Capita (metric_key: gdp_per_capita_usd) — https://africa-api.com/data/gdp-per-capita: Gross domestic product divided by mid-year population, in current US dollars. - Inflation Rate (metric_key: inflation_cpi_latest_yoy_pct) — https://africa-api.com/data/inflation: Latest year-on-year consumer price inflation. - Central Bank Policy Rate (metric_key: policy_rate_pct) — https://africa-api.com/data/central-bank-rate: The central bank's headline monetary policy rate. - Official Exchange Rate (metric_key: official_exchange_rate_latest_lcu_per_usd) — https://africa-api.com/data/exchange-rate: Official local currency units per US dollar. - Budget Balance (metric_key: fiscal_balance_pct_gdp) — https://africa-api.com/data/fiscal-balance: General government net lending (surplus) or borrowing (deficit) as a percentage of GDP. - Unemployment Rate (metric_key: unemployment_pct) — https://africa-api.com/data/unemployment: Share of the labor force that is unemployed. - Public Debt (metric_key: public_debt_pct_gdp) — https://africa-api.com/data/public-debt: General government gross debt as a percentage of GDP. - Trade Balance (metric_key: trade_balance_usd) — https://africa-api.com/data/trade-balance: Exports minus imports of goods and services, in current US dollars. - GDP Growth (metric_key: gdp_growth_annual_pct) — https://africa-api.com/data/gdp-growth: Annual percentage growth of GDP at constant prices. - GNI per Capita (metric_key: gni_per_capita_atlas_usd) — https://africa-api.com/data/gni-per-capita: Gross national income per capita, Atlas method, in current US dollars — the basis for World Bank income-group classification. - GNI per Capita (PPP) (metric_key: gni_per_capita_ppp_intl) — https://africa-api.com/data/gni-per-capita-ppp: Gross national income per capita at purchasing power parity, in international dollars. - GDP (PPP) (metric_key: gdp_ppp_current_intl) — https://africa-api.com/data/gdp-ppp: Gross domestic product at purchasing power parity, in current international dollars. - Agriculture (% of GDP) (metric_key: agriculture_value_added_pct_gdp) — https://africa-api.com/data/agriculture-gdp-share: Value added by agriculture, forestry and fishing as a share of GDP. - Industry (% of GDP) (metric_key: industry_value_added_pct_gdp) — https://africa-api.com/data/industry-gdp-share: Value added by industry, including construction, as a share of GDP. - Manufacturing (% of GDP) (metric_key: manufacturing_value_added_pct_gdp) — https://africa-api.com/data/manufacturing-gdp-share: Value added by manufacturing as a share of GDP. - Services (% of GDP) (metric_key: services_value_added_pct_gdp) — https://africa-api.com/data/services-gdp-share: Value added by services as a share of GDP. - Investment (% of GDP) (metric_key: gross_capital_formation_pct_gdp) — https://africa-api.com/data/investment-gdp-share: Gross capital formation (investment in fixed assets and inventories) as a share of GDP. - Remittances Received (metric_key: remittances_received_usd) — https://africa-api.com/data/remittances: Personal remittances received, in current US dollars. - Remittances (% of GDP) (metric_key: remittances_received_pct_gdp) — https://africa-api.com/data/remittances-gdp-share: Personal remittances received as a share of GDP. - External Debt (% of GNI) (metric_key: external_debt_stocks_pct_gni) — https://africa-api.com/data/external-debt: Total external debt stocks as a share of gross national income. - Foreign Reserves (metric_key: total_reserves_usd) — https://africa-api.com/data/reserves: Total reserves including gold, in current US dollars. - Credit to Private Sector (% of GDP) (metric_key: domestic_credit_private_sector_pct_gdp) — https://africa-api.com/data/private-credit: Credit to the private sector by financial corporations as a share of GDP — a measure of financial depth. - Tax Revenue (% of GDP) (metric_key: tax_revenue_pct_gdp) — https://africa-api.com/data/tax-revenue: Central government tax revenue as a share of GDP. - Labor Force Participation (metric_key: labor_force_participation_pct) — https://africa-api.com/data/labor-force-participation: Share of the population ages 15+ that is economically active (ILO modelled estimate). - Female Labor Force Participation (metric_key: female_labor_force_participation_pct) — https://africa-api.com/data/female-labor-force-participation: Share of women ages 15+ that is economically active (ILO modelled estimate). - Income Inequality (Gini) (metric_key: gini_index) — https://africa-api.com/data/income-inequality: Gini index of income inequality, where 0 is perfect equality and 100 is perfect inequality. - Extreme Poverty Rate (metric_key: poverty_headcount_215_pct) — https://africa-api.com/data/extreme-poverty: Share of the population living on less than $2.15 a day at 2017 international prices. - Account Ownership (metric_key: financial_inclusion_account_pct) — https://africa-api.com/data/financial-inclusion: Share of adults (15+) with an account at a bank or mobile-money provider (World Bank Global Findex). - Youth NEET Rate (metric_key: youth_neet_pct) — https://africa-api.com/data/youth-neet: Share of youth (15-24) not in employment, education or training. - Military Spending (% of GDP) (metric_key: military_expenditure_pct_gdp) — https://africa-api.com/data/military-spending: Military expenditure as a share of GDP (SIPRI via World Bank). - Trade Openness (% of GDP) (metric_key: trade_openness_pct_gdp) — https://africa-api.com/data/trade-openness: Exports plus imports of goods and services as a share of GDP. - Inflation (GDP Deflator) (metric_key: gdp_deflator_inflation_pct) — https://africa-api.com/data/gdp-deflator: Annual growth of the GDP implicit deflator, a broad economy-wide measure of inflation. - Tourism Receipts (metric_key: tourism_receipts_usd) — https://africa-api.com/data/tourism-receipts: Receipts earned from international inbound visitors, in current US dollars. - Tourist Arrivals (metric_key: tourist_arrivals_total) — https://africa-api.com/data/tourist-arrivals: Number of international inbound tourists (overnight visitors). - Current Account Balance (metric_key: current_account_balance_pct_gdp) — https://africa-api.com/data/current-account: Current account balance (trade, income and transfers) as a share of GDP. - Foreign Direct Investment (metric_key: fdi_net_inflows_usd) — https://africa-api.com/data/fdi: Net foreign direct investment inflows, in current US dollars. - FDI (% of GDP) (metric_key: fdi_net_inflows_pct_gdp) — https://africa-api.com/data/fdi-gdp-share: Net foreign direct investment inflows as a share of GDP. - Government Revenue (% of GDP) (metric_key: government_revenue_pct_gdp) — https://africa-api.com/data/government-revenue: General government revenue as a share of GDP. - Government Spending (% of GDP) (metric_key: government_expenditure_pct_gdp) — https://africa-api.com/data/government-spending: General government total expenditure as a share of GDP. - Youth Unemployment Rate (metric_key: youth_unemployment_pct) — https://africa-api.com/data/youth-unemployment: Share of the labor force ages 15-24 that is unemployed (ILO modelled estimate). - Productive Capacity Index (metric_key: productive_capacity_index) — https://africa-api.com/data/productive-capacity: UNCTAD index of a country's productive capacities across human capital, energy, transport, ICT and institutions (0-100). - Natural Resource Rents (metric_key: total_natural_resource_rents_pct_gdp) — https://africa-api.com/data/natural-resource-rents: Sum of oil, gas, coal, mineral and forest rents as a share of GDP — a measure of dependence on extractive resources. - Oil Rents (% of GDP) (metric_key: oil_rents_pct_gdp) — https://africa-api.com/data/oil-rents: Oil rents — the value of crude oil production at world prices less the cost of production — as a share of GDP. - Mineral Rents (% of GDP) (metric_key: mineral_rents_pct_gdp) — https://africa-api.com/data/mineral-rents: Mineral rents — the value of production at world prices less the cost of production — as a share of GDP. - Natural Gas Rents (% of GDP) (metric_key: natural_gas_rents_pct_gdp) — https://africa-api.com/data/natural-gas-rents: Natural gas rents — the value of production at world prices less the cost of production — as a share of GDP. - Foreign Aid (% of GNI) (metric_key: net_oda_received_pct_gni) — https://africa-api.com/data/foreign-aid: Net official development assistance received as a share of gross national income — a measure of aid dependence. - Foreign Aid per Capita (metric_key: net_oda_received_per_capita_usd) — https://africa-api.com/data/foreign-aid-per-capita: Net official development assistance received per person, in current US dollars. - Lending Interest Rate (metric_key: lending_interest_rate_pct) — https://africa-api.com/data/lending-rate: Bank rate that usually meets the short- and medium-term financing needs of the private sector. - Real Interest Rate (metric_key: real_interest_rate_pct) — https://africa-api.com/data/real-interest-rate: Lending interest rate adjusted for inflation as measured by the GDP deflator. - Gross Savings (% of GDP) (metric_key: gross_savings_pct_gdp) — https://africa-api.com/data/gross-savings: Gross savings (gross national income less consumption plus net transfers) as a share of GDP. - Adjusted Net Income per Capita (metric_key: adjusted_net_national_income_per_capita_usd) — https://africa-api.com/data/adjusted-net-income-per-capita: Gross national income less depreciation of fixed capital and depletion of natural resources, per capita, in current US dollars. - Employment in Agriculture (metric_key: employment_agriculture_pct) — https://africa-api.com/data/employment-agriculture: Share of total employment in agriculture (ILO modelled estimate). - Employment in Industry (metric_key: employment_industry_pct) — https://africa-api.com/data/employment-industry: Share of total employment in industry (ILO modelled estimate). - Employment in Services (metric_key: employment_services_pct) — https://africa-api.com/data/employment-services: Share of total employment in services (ILO modelled estimate). - Vulnerable Employment (metric_key: vulnerable_employment_pct) — https://africa-api.com/data/vulnerable-employment: Contributing family workers and own-account workers as a share of total employment (ILO modelled estimate). - Household Consumption (% of GDP) (metric_key: household_consumption_pct_gdp) — https://africa-api.com/data/household-consumption: Household and non-profit final consumption expenditure as a share of GDP. - Income Share of Poorest 20% (metric_key: income_share_lowest_20pct) — https://africa-api.com/data/income-share-poorest: Share of national income or consumption held by the poorest 20% of the population. - Bank Branches per 100,000 (metric_key: bank_branches_per_100k) — https://africa-api.com/data/bank-branches: Number of commercial bank branches per 100,000 adults. - ATMs per 100,000 (metric_key: atms_per_100k) — https://africa-api.com/data/atms: Number of automated teller machines (ATMs) per 100,000 adults. - GDP per Capita Growth (metric_key: gdp_per_capita_growth_pct) — https://africa-api.com/data/gdp-per-capita-growth: Annual percentage growth of GDP per capita at constant prices. - Debt Service (% of GNI) (metric_key: debt_service_pct_gni) — https://africa-api.com/data/debt-service: Total external debt service (principal and interest) as a share of gross national income. - Poverty Rate ($3.65/day) (metric_key: poverty_headcount_365_pct) — https://africa-api.com/data/poverty-365: Share of the population living on less than $3.65 a day at 2017 international prices (lower-middle-income line). - Poverty Rate ($6.85/day) (metric_key: poverty_headcount_685_pct) — https://africa-api.com/data/poverty-685: Share of the population living on less than $6.85 a day at 2017 international prices (upper-middle-income line). ### Trade - Exports of Goods & Services (metric_key: exports_goods_services_usd) — https://africa-api.com/data/exports: Exports of goods and services, in current US dollars. - Imports of Goods & Services (metric_key: imports_goods_services_usd) — https://africa-api.com/data/imports: Imports of goods and services, in current US dollars. - Export Diversification Index (metric_key: export_diversification_index) — https://africa-api.com/data/export-diversification: UNCTAD index of how far a country's export mix differs from the world structure (lower is more diversified). - Export Concentration Index (metric_key: export_concentration_index) — https://africa-api.com/data/export-concentration: UNCTAD Herfindahl-Hirschmann index of how concentrated exports are in a few products (lower is less concentrated). - Liner Shipping Connectivity (metric_key: liner_shipping_connectivity_index) — https://africa-api.com/data/shipping-connectivity: UNCTAD index of how well a country is connected to global container shipping networks (2004 maximum = 100). - Fuel Exports (% of Exports) (metric_key: fuel_exports_pct_merchandise) — https://africa-api.com/data/fuel-exports: Fuels (SITC section 3) as a share of total merchandise exports. - Manufactures Exports (% of Exports) (metric_key: manufactures_exports_pct_merchandise) — https://africa-api.com/data/manufactures-exports: Manufactured goods (SITC sections 5-8 excluding 68) as a share of total merchandise exports. - Food Exports (% of Exports) (metric_key: food_exports_pct_merchandise) — https://africa-api.com/data/food-exports: Food (SITC sections 0, 1, 4 and division 22) as a share of total merchandise exports. - High-Tech Exports (% of Manufactured) (metric_key: high_tech_exports_pct_manufactured) — https://africa-api.com/data/high-tech-exports: High-technology exports (products with high R&D intensity) as a share of manufactured exports. - Exports (% of GDP) (metric_key: exports_goods_services_pct_gdp) — https://africa-api.com/data/exports-gdp-share: Exports of goods and services as a share of GDP. - Imports (% of GDP) (metric_key: imports_goods_services_pct_gdp) — https://africa-api.com/data/imports-gdp-share: Imports of goods and services as a share of GDP. ### Development - Human Development Index (metric_key: human_development_index) — https://africa-api.com/data/human-development-index: UNDP composite index of life expectancy, education and income on a 0-1 scale (higher is better). - Gender Inequality Index (metric_key: gender_inequality_index) — https://africa-api.com/data/gender-inequality: UNDP index of gender-based disadvantage across reproductive health, empowerment and the labour market on a 0-1 scale (higher is worse). - Inequality-adjusted HDI (metric_key: inequality_adjusted_hdi) — https://africa-api.com/data/inequality-adjusted-hdi: Human Development Index discounted for inequality across its dimensions, on a 0-1 scale (higher is better). ### Demographics - Population (metric_key: population_total) — https://africa-api.com/data/population: Total mid-year population. - Population Growth (metric_key: population_growth_pct) — https://africa-api.com/data/population-growth: Annual population growth rate. - Life Expectancy (metric_key: life_expectancy_years) — https://africa-api.com/data/life-expectancy: Life expectancy at birth, in years. - Median Age (metric_key: median_age_years) — https://africa-api.com/data/median-age: Median age of the population, in years. - Fertility Rate (metric_key: fertility_rate_births_per_woman) — https://africa-api.com/data/fertility-rate: Births per woman over a lifetime at current rates. - Rural Population (metric_key: rural_population_pct) — https://africa-api.com/data/rural-population: Share of the population living in rural areas. - Population Under 15 (metric_key: population_0_14_pct) — https://africa-api.com/data/population-under-15: Share of the population aged 0 to 14 years. - Urban Population (metric_key: urban_population_pct) — https://africa-api.com/data/urban-population: Share of the population living in urban areas. - Population Density (metric_key: population_density_per_km2) — https://africa-api.com/data/population-density: People per square kilometre of land area. - Birth Rate (metric_key: crude_birth_rate_per_1000) — https://africa-api.com/data/birth-rate: Live births per 1,000 people per year. - Death Rate (metric_key: crude_death_rate_per_1000) — https://africa-api.com/data/death-rate: Deaths per 1,000 people per year. - Net Migration Rate (metric_key: net_migration_rate_per_1000) — https://africa-api.com/data/net-migration-rate: Net number of migrants per 1,000 people — positive for net immigration, negative for net emigration. - Life Expectancy (Female) (metric_key: life_expectancy_female_years) — https://africa-api.com/data/life-expectancy-female: Female life expectancy at birth, in years. - Life Expectancy (Male) (metric_key: life_expectancy_male_years) — https://africa-api.com/data/life-expectancy-male: Male life expectancy at birth, in years. - Urban Population Growth (metric_key: urban_population_growth_pct) — https://africa-api.com/data/urban-growth: Annual percentage growth of the urban population. ### Health - Infant Mortality (metric_key: infant_mortality_rate) — https://africa-api.com/data/infant-mortality: Infant deaths before age one per 1,000 live births. - HIV Prevalence (metric_key: hiv_prevalence_pct) — https://africa-api.com/data/hiv-prevalence: Share of people ages 15-49 living with HIV. - Health Spending (% of GDP) (metric_key: health_expenditure_pct_gdp) — https://africa-api.com/data/health-spending: Current health expenditure as a share of GDP. - Physicians per 1,000 (metric_key: physicians_per_1000) — https://africa-api.com/data/physicians: Medical doctors (generalists and specialists) per 1,000 people. - UHC Service Coverage Index (metric_key: uhc_service_coverage_index) — https://africa-api.com/data/universal-health-coverage: WHO Universal Health Coverage service coverage index (0-100), based on tracer interventions. - Road Traffic Deaths (metric_key: road_traffic_deaths_per_100k) — https://africa-api.com/data/road-traffic-deaths: Estimated road traffic deaths per 100,000 population (WHO). - Premature NCD Mortality (metric_key: ncd_premature_mortality_pct) — https://africa-api.com/data/ncd-mortality: Probability of dying between ages 30 and 70 from cardiovascular disease, cancer, diabetes or chronic respiratory disease. - Out-of-Pocket Health Spending (metric_key: health_oop_expenditure_pct_che) — https://africa-api.com/data/out-of-pocket-health: Out-of-pocket expenditure as a share of current health expenditure (WHO). - Safely Managed Sanitation (metric_key: safely_managed_sanitation_pct) — https://africa-api.com/data/safe-sanitation: Share of the population using safely managed sanitation services. - Maternal Mortality (metric_key: maternal_mortality_ratio) — https://africa-api.com/data/maternal-mortality: Maternal deaths per 100,000 live births. - Under-Five Mortality (metric_key: under_five_mortality_rate) — https://africa-api.com/data/under-five-mortality: Deaths before age five per 1,000 live births. - Neonatal Mortality (metric_key: neonatal_mortality_rate) — https://africa-api.com/data/neonatal-mortality: Deaths in the first 28 days of life per 1,000 live births. - Tuberculosis Incidence (metric_key: tb_incidence_per_100k) — https://africa-api.com/data/tuberculosis: Estimated new and relapse tuberculosis cases per 100,000 people (WHO). - Measles Immunization (metric_key: measles_immunization_pct) — https://africa-api.com/data/measles-immunization: Share of children ages 12-23 months immunized against measles. - DTP3 Immunization (metric_key: dtp3_immunization_pct) — https://africa-api.com/data/dtp3-immunization: Share of children ages 12-23 months immunized with three doses of diphtheria-tetanus-pertussis vaccine. - Basic Drinking Water (metric_key: basic_drinking_water_pct) — https://africa-api.com/data/drinking-water: Share of the population using at least basic drinking water services (WHO/UNICEF JMP). - Basic Sanitation (metric_key: basic_sanitation_pct) — https://africa-api.com/data/sanitation: Share of the population using at least basic sanitation services (WHO/UNICEF JMP). - Diabetes Prevalence (metric_key: diabetes_prevalence_pct) — https://africa-api.com/data/diabetes: Share of the population ages 20-79 with type 1 or type 2 diabetes. - Hospital Beds per 1,000 (metric_key: hospital_beds_per_1000) — https://africa-api.com/data/hospital-beds: Hospital beds — inpatient beds in public, private, general and specialised hospitals — per 1,000 people. - Contraceptive Prevalence (metric_key: contraceptive_prevalence_pct) — https://africa-api.com/data/contraceptive-prevalence: Share of women ages 15-49, married or in union, using any method of contraception. - Skilled Birth Attendance (metric_key: skilled_birth_attendance_pct) — https://africa-api.com/data/skilled-birth-attendance: Share of live births attended by skilled health personnel (doctors, nurses or midwives). - Nurses & Midwives per 1,000 (metric_key: nurses_midwives_per_1000) — https://africa-api.com/data/nurses-midwives: Number of nurses and midwives per 1,000 people. - Adolescent Fertility Rate (metric_key: adolescent_fertility_per_1000) — https://africa-api.com/data/adolescent-fertility: Births per 1,000 women ages 15-19. - Health Spending per Capita (metric_key: health_expenditure_per_capita_usd) — https://africa-api.com/data/health-spending-per-capita: Current health expenditure per person, in current US dollars. - NCD Share of Deaths (metric_key: ncd_mortality_share_pct) — https://africa-api.com/data/ncd-deaths: Share of total deaths caused by non-communicable diseases (cardiovascular, cancer, diabetes, chronic respiratory). - Smoking Prevalence (metric_key: smoking_prevalence_pct) — https://africa-api.com/data/smoking: Share of adults who currently smoke any tobacco product (age-standardised). - Antenatal Care Coverage (metric_key: antenatal_care_pct) — https://africa-api.com/data/antenatal-care: Share of women with a live birth who received antenatal care from a skilled provider at least once. ### Child Welfare - Child Stunting (metric_key: stunting_under5_pct) — https://africa-api.com/data/child-stunting: Share of children under 5 who are stunted (low height-for-age), a marker of chronic undernutrition. - Child Wasting (metric_key: wasting_under5_pct) — https://africa-api.com/data/child-wasting: Share of children under 5 who are wasted (low weight-for-height), a marker of acute undernutrition. - Birth Registration (metric_key: birth_registration_pct) — https://africa-api.com/data/birth-registration: Share of children under 5 whose births are registered with a civil authority (UNICEF). - Child Marriage (metric_key: child_marriage_women_20_24_pct) — https://africa-api.com/data/child-marriage: Share of women aged 20-24 who were first married or in union before age 18 (UNICEF). - Overweight Children (metric_key: child_overweight_pct) — https://africa-api.com/data/child-overweight: Share of children under 5 who are overweight (weight-for-height above two standard deviations). ### Education - Education Spending (% of GDP) (metric_key: government_expenditure_education_pct_gdp) — https://africa-api.com/data/education-spending: Government expenditure on education as a share of GDP. - Tertiary Enrollment (metric_key: tertiary_enrollment_pct) — https://africa-api.com/data/tertiary-enrollment: Gross enrollment ratio in tertiary education, regardless of age. - Adult Literacy Rate (metric_key: adult_literacy_pct) — https://africa-api.com/data/adult-literacy: Share of people ages 15 and over who can read and write. - Youth Literacy Rate (metric_key: youth_literacy_pct) — https://africa-api.com/data/youth-literacy: Share of people ages 15-24 who can read and write. - Primary Completion Rate (metric_key: primary_completion_pct) — https://africa-api.com/data/primary-completion: Gross intake ratio to the last grade of primary education. - Lower Secondary Completion (metric_key: lower_secondary_completion_pct) — https://africa-api.com/data/lower-secondary-completion: Gross intake ratio to the last grade of lower secondary education. - Primary Net Enrollment (metric_key: primary_net_enrollment_pct) — https://africa-api.com/data/primary-net-enrollment: Share of primary-school-age children enrolled in primary education. - Lower Secondary Enrollment (metric_key: lower_secondary_net_enrollment_pct) — https://africa-api.com/data/lower-secondary-net-enrollment: Net enrollment rate in lower secondary education. - Upper Secondary Enrollment (metric_key: upper_secondary_net_enrollment_pct) — https://africa-api.com/data/upper-secondary-net-enrollment: Net enrollment rate in upper secondary education. - Upper Secondary Completion (metric_key: upper_secondary_completion_pct) — https://africa-api.com/data/upper-secondary-completion: Gross intake ratio to the last grade of upper secondary education. - Qualified Primary Teachers (metric_key: primary_teachers_minimum_qualifications_pct) — https://africa-api.com/data/qualified-primary-teachers: Share of primary-school teachers with the minimum required qualifications. - Secondary Enrollment (metric_key: secondary_enrollment_pct) — https://africa-api.com/data/secondary-enrollment: Gross enrollment ratio in secondary education, regardless of age, as a share of the official secondary-age population. ### Food Security - Undernourishment (metric_key: undernourishment_pct) — https://africa-api.com/data/undernourishment: Share of the population whose food intake is insufficient for an active, healthy life. - Acute Food Insecurity (metric_key: acutely_food_insecure_phase3plus_total) — https://africa-api.com/data/food-insecurity: People in IPC/CH Phase 3 (Crisis) or worse — acute food insecurity requiring urgent action — from FEWS NET's latest current-situation estimate. ### Agriculture - Agricultural Land (% of Land) (metric_key: agricultural_land_pct) — https://africa-api.com/data/agricultural-land: Share of land area that is arable, under permanent crops, or under permanent pasture. - Food Production Index (metric_key: food_production_index) — https://africa-api.com/data/food-production: Food production index (2014-2016 = 100) covering edible, nutritious crops and livestock. - Cassava Production (metric_key: cassava_production_tonnes) — https://africa-api.com/data/cassava: Annual cassava production, in tonnes (FAOSTAT). - Coffee Production (metric_key: coffee_production_tonnes) — https://africa-api.com/data/coffee: Annual green coffee production, in tonnes (FAOSTAT). - Cocoa Production (metric_key: cocoa_production_tonnes) — https://africa-api.com/data/cocoa: Annual cocoa beans production, in tonnes (FAOSTAT). - Sorghum Production (metric_key: sorghum_production_tonnes) — https://africa-api.com/data/sorghum: Annual sorghum production, in tonnes (FAOSTAT). - Millet Production (metric_key: millet_production_tonnes) — https://africa-api.com/data/millet: Annual millet production, in tonnes (FAOSTAT). - Maize Production (metric_key: maize_production_tonnes) — https://africa-api.com/data/maize: Annual maize production, in tonnes (FAOSTAT). - Rice Production (metric_key: rice_production_tonnes) — https://africa-api.com/data/rice: Annual rice (paddy) production, in tonnes (FAOSTAT). - Wheat Production (metric_key: wheat_production_tonnes) — https://africa-api.com/data/wheat: Annual wheat production, in tonnes (FAOSTAT). - Maize Yield (metric_key: maize_yield_kg_per_ha) — https://africa-api.com/data/maize-yield: Maize yield, in kilograms per hectare harvested (FAOSTAT). - Rice Yield (metric_key: rice_yield_kg_per_ha) — https://africa-api.com/data/rice-yield: Rice yield, in kilograms per hectare harvested (FAOSTAT). - Wheat Yield (metric_key: wheat_yield_kg_per_ha) — https://africa-api.com/data/wheat-yield: Wheat yield, in kilograms per hectare harvested (FAOSTAT). - Cattle Stock (metric_key: cattle_stock_head) — https://africa-api.com/data/cattle: Number of live cattle (FAOSTAT). ### Governance - Homicide Rate (metric_key: homicide_rate_per_100k) — https://africa-api.com/data/homicide-rate: Intentional homicides per 100,000 people (UNODC via World Bank). - Corruption Perceptions Index (metric_key: corruption_perceptions_index) — https://africa-api.com/data/corruption-perceptions-index: Transparency International's index of perceived public-sector corruption on a 0-100 scale (higher is cleaner). - Electoral Democracy Index (metric_key: electoral_democracy_index) — https://africa-api.com/data/electoral-democracy: V-Dem electoral democracy (polyarchy) index on a 0-1 scale (higher is more democratic). - Liberal Democracy Index (metric_key: liberal_democracy_index) — https://africa-api.com/data/liberal-democracy: V-Dem liberal democracy index — electoral democracy plus liberal checks and protections — on a 0-1 scale. - Political Corruption Index (metric_key: political_corruption_index) — https://africa-api.com/data/political-corruption: V-Dem expert-coded index of political corruption across government on a 0-1 scale (higher is more corrupt). - Control of Corruption (metric_key: control_of_corruption_estimate) — https://africa-api.com/data/control-of-corruption: World Bank Worldwide Governance Indicator for control of corruption, from −2.5 (weak) to 2.5 (strong). - Government Effectiveness (metric_key: government_effectiveness_estimate) — https://africa-api.com/data/government-effectiveness: World Bank Worldwide Governance Indicator for government effectiveness, from −2.5 (weak) to 2.5 (strong). - Rule of Law (metric_key: rule_of_law_estimate) — https://africa-api.com/data/rule-of-law: World Bank Worldwide Governance Indicator for rule of law, from −2.5 (weak) to 2.5 (strong). - Political Stability (metric_key: political_stability_estimate) — https://africa-api.com/data/political-stability: World Bank Worldwide Governance Indicator for political stability and absence of violence, from −2.5 (weak) to 2.5 (strong). - Regulatory Quality (metric_key: regulatory_quality_estimate) — https://africa-api.com/data/regulatory-quality: World Bank Worldwide Governance Indicator for regulatory quality, from −2.5 (weak) to 2.5 (strong). - Voice and Accountability (metric_key: voice_accountability_estimate) — https://africa-api.com/data/voice-and-accountability: World Bank Worldwide Governance Indicator for voice and accountability, from −2.5 (weak) to 2.5 (strong). - Organized Violence Deaths (metric_key: organized_violence_deaths_estimate) — https://africa-api.com/data/organized-violence-deaths: UCDP best estimate of deaths from state-based conflict, non-state conflict, and one-sided violence within the country's borders. - State-Based Conflict Dyads (metric_key: state_based_conflict_dyads_total) — https://africa-api.com/data/state-based-conflict-dyads: Number of active UCDP state-based conflict dyads within the country's borders. - Non-State Conflict Dyads (metric_key: non_state_conflict_dyads_total) — https://africa-api.com/data/non-state-conflict-dyads: Number of active UCDP non-state conflict dyads within the country's borders. - One-Sided Violence Dyads (metric_key: one_sided_violence_dyads_total) — https://africa-api.com/data/one-sided-violence-dyads: Number of active UCDP one-sided violence dyads within the country's borders. ### Humanitarian - Refugees Hosted (metric_key: refugees_hosted_total) — https://africa-api.com/data/refugees-hosted: Number of refugees hosted in the country (UNHCR). - Internally Displaced People (metric_key: idps_total) — https://africa-api.com/data/internally-displaced: Number of people displaced within their own country (UNHCR). - Asylum Seekers Hosted (metric_key: asylum_seekers_hosted_total) — https://africa-api.com/data/asylum-seekers: Number of asylum seekers hosted in the country (UNHCR). - Stateless People (metric_key: stateless_total) — https://africa-api.com/data/stateless-people: Number of stateless people in the country (UNHCR). ### Technology - Internet Users (metric_key: internet_users_pct) — https://africa-api.com/data/internet-users: Individuals using the internet as a share of population. - Mobile Subscriptions (metric_key: mobile_subscriptions_per_100) — https://africa-api.com/data/mobile-subscriptions: Mobile cellular subscriptions per 100 people. - 4G Coverage (metric_key: population_coverage_4g_pct) — https://africa-api.com/data/4g-coverage: Share of the population covered by a 4G mobile network (ITU). - Fixed Broadband Subscriptions (metric_key: fixed_broadband_subscriptions_per_100) — https://africa-api.com/data/fixed-broadband: Fixed broadband subscriptions per 100 people (ITU). - Mobile Data Price (metric_key: mobile_data_price_pct_gni_pc) — https://africa-api.com/data/mobile-data-price: Price of a 2GB mobile data basket as a share of monthly GNI per capita — lower is more affordable (ITU). - 3G Coverage (metric_key: population_coverage_3g_pct) — https://africa-api.com/data/3g-coverage: Share of the population covered by at least a 3G mobile network (ITU). - Fixed Broadband Price (metric_key: fixed_broadband_price_pct_gni_pc) — https://africa-api.com/data/fixed-broadband-price: Price of a fixed-broadband basket as a share of monthly GNI per capita — lower is more affordable (ITU). - Mobile Bundle Price (metric_key: mobile_voice_data_basket_price_pct_gni_pc) — https://africa-api.com/data/mobile-bundle-price: Price of a mobile voice-and-data basket as a share of monthly GNI per capita — lower is more affordable (ITU). - R&D Spending (% of GDP) (metric_key: rd_expenditure_pct_gdp) — https://africa-api.com/data/rd-spending: Gross domestic expenditure on research and development as a share of GDP. ### Infrastructure - Electricity Access (metric_key: electricity_access_pct) — https://africa-api.com/data/electricity-access: Share of the population with access to electricity. - Air Transport Passengers (metric_key: air_transport_passengers) — https://africa-api.com/data/air-passengers: Passengers carried by air transport registered in the country. - Slum Population (metric_key: slum_population_pct) — https://africa-api.com/data/slum-population: Share of the urban population living in slums, informal settlements or inadequate housing. ### Energy - Renewable Energy Capacity (metric_key: renewable_capacity_total_mw) — https://africa-api.com/data/renewable-capacity: Total installed renewable electricity capacity, in megawatts (IRENA). - Solar Capacity (metric_key: solar_capacity_mw) — https://africa-api.com/data/solar-capacity: Installed solar electricity capacity, in megawatts (IRENA). - Wind Capacity (metric_key: wind_capacity_mw) — https://africa-api.com/data/wind-capacity: Installed wind electricity capacity, in megawatts (IRENA). - Hydropower Capacity (metric_key: hydro_capacity_mw) — https://africa-api.com/data/hydropower-capacity: Installed hydropower electricity capacity, in megawatts (IRENA). - Renewable Energy Share (metric_key: renewable_energy_consumption_pct) — https://africa-api.com/data/renewable-energy-share: Renewable energy as a share of total final energy consumption. - Clean Cooking Access (metric_key: access_to_clean_fuels_pct) — https://africa-api.com/data/clean-cooking: Share of the population with primary reliance on clean fuels and technologies for cooking. - Electricity Consumption per Capita (metric_key: electric_power_consumption_kwh_per_capita) — https://africa-api.com/data/power-consumption: Electric power consumption per person, in kilowatt-hours. - Power Transmission Losses (metric_key: electric_power_transmission_losses_pct) — https://africa-api.com/data/transmission-losses: Electricity lost in transmission and distribution as a share of output. - Off-grid Renewable Capacity (metric_key: offgrid_renewable_capacity_mw) — https://africa-api.com/data/offgrid-renewable-capacity: Installed off-grid renewable electricity capacity, in megawatts (IRENA). - Rural Electricity Access (metric_key: rural_electricity_access_pct) — https://africa-api.com/data/rural-electricity: Share of the rural population with access to electricity. - Solar Share of Electricity (metric_key: solar_electricity_share_pct) — https://africa-api.com/data/solar-electricity-share: Share of electricity generation that comes from solar (Ember via Our World in Data). - Wind Share of Electricity (metric_key: wind_electricity_share_pct) — https://africa-api.com/data/wind-electricity-share: Share of electricity generation that comes from wind (Ember via Our World in Data). - Hydropower Share of Electricity (metric_key: hydro_electricity_share_pct) — https://africa-api.com/data/hydro-electricity-share: Share of electricity generation that comes from hydropower (Ember via Our World in Data). - Fossil Share of Electricity (metric_key: fossil_electricity_share_pct) — https://africa-api.com/data/fossil-electricity-share: Share of electricity generation from fossil fuels — coal, gas and oil (Ember via Our World in Data). - Electricity Demand (metric_key: electricity_demand_twh) — https://africa-api.com/data/electricity-demand: Total electricity demand, in terawatt-hours (Ember via Our World in Data). - Electricity Carbon Intensity (metric_key: electricity_carbon_intensity_gco2_kwh) — https://africa-api.com/data/grid-carbon-intensity: Carbon dioxide emitted per kilowatt-hour of electricity generated — a measure of how clean the grid is (Ember via Our World in Data). - Primary Energy per Capita (metric_key: primary_energy_per_capita_kwh) — https://africa-api.com/data/energy-per-capita: Primary energy consumption per person, in kilowatt-hours (Energy Institute / Ember via Our World in Data). ### Climate - CO2 Emissions per Capita (metric_key: co2e_emissions_per_capita) — https://africa-api.com/data/co2-emissions: Greenhouse gas emissions per person, in tonnes of CO2 equivalent. - Renewable Electricity Output (metric_key: renewable_electricity_output_pct_total) — https://africa-api.com/data/renewable-electricity: Electricity generated from renewable sources as a share of total output. - Forest Area (metric_key: forest_area_pct_land) — https://africa-api.com/data/forest-area: Forest area as a share of total land area. - Protected Areas (metric_key: protected_areas_pct_total) — https://africa-api.com/data/protected-areas: Terrestrial and marine protected areas as a share of total territorial area. - Freshwater Withdrawals (metric_key: freshwater_withdrawals_pct_internal_resources) — https://africa-api.com/data/freshwater-withdrawals: Annual freshwater withdrawals as a share of internal renewable water resources — a water-stress indicator. - PM2.5 Air Pollution (metric_key: pm25_air_pollution_ug_per_m3) — https://africa-api.com/data/air-pollution: Population-weighted mean annual exposure to fine particulate matter (PM2.5), in micrograms per cubic metre. ## Country profiles - Algeria (DZ) — https://africa-api.com/data/algeria - Angola (AO) — https://africa-api.com/data/angola - Benin (BJ) — https://africa-api.com/data/benin - Botswana (BW) — https://africa-api.com/data/botswana - Burkina Faso (BF) — https://africa-api.com/data/burkina-faso - Burundi (BI) — https://africa-api.com/data/burundi - Cabo Verde (CV) — https://africa-api.com/data/cabo-verde - Cameroon (CM) — https://africa-api.com/data/cameroon - Central African Republic (CF) — https://africa-api.com/data/central-african-republic - Chad (TD) — https://africa-api.com/data/chad - Comoros (KM) — https://africa-api.com/data/comoros - Cote d'Ivoire (CI) — https://africa-api.com/data/cote-divoire - Democratic Republic of the Congo (CD) — https://africa-api.com/data/democratic-republic-of-the-congo - Djibouti (DJ) — https://africa-api.com/data/djibouti - Egypt (EG) — https://africa-api.com/data/egypt - Equatorial Guinea (GQ) — https://africa-api.com/data/equatorial-guinea - Eritrea (ER) — https://africa-api.com/data/eritrea - Eswatini (SZ) — https://africa-api.com/data/eswatini - Ethiopia (ET) — https://africa-api.com/data/ethiopia - Gabon (GA) — https://africa-api.com/data/gabon - Gambia (GM) — https://africa-api.com/data/gambia - Ghana (GH) — https://africa-api.com/data/ghana - Guinea (GN) — https://africa-api.com/data/guinea - Guinea-Bissau (GW) — https://africa-api.com/data/guinea-bissau - Kenya (KE) — https://africa-api.com/data/kenya - Lesotho (LS) — https://africa-api.com/data/lesotho - Liberia (LR) — https://africa-api.com/data/liberia - Libya (LY) — https://africa-api.com/data/libya - Madagascar (MG) — https://africa-api.com/data/madagascar - Malawi (MW) — https://africa-api.com/data/malawi - Mali (ML) — https://africa-api.com/data/mali - Mauritania (MR) — https://africa-api.com/data/mauritania - Mauritius (MU) — https://africa-api.com/data/mauritius - Morocco (MA) — https://africa-api.com/data/morocco - Mozambique (MZ) — https://africa-api.com/data/mozambique - Namibia (NA) — https://africa-api.com/data/namibia - Niger (NE) — https://africa-api.com/data/niger - Nigeria (NG) — https://africa-api.com/data/nigeria - Republic of the Congo (CG) — https://africa-api.com/data/republic-of-the-congo - Rwanda (RW) — https://africa-api.com/data/rwanda - Sao Tome and Principe (ST) — https://africa-api.com/data/sao-tome-and-principe - Senegal (SN) — https://africa-api.com/data/senegal - Seychelles (SC) — https://africa-api.com/data/seychelles - Sierra Leone (SL) — https://africa-api.com/data/sierra-leone - Somalia (SO) — https://africa-api.com/data/somalia - South Africa (ZA) — https://africa-api.com/data/south-africa - South Sudan (SS) — https://africa-api.com/data/south-sudan - Sudan (SD) — https://africa-api.com/data/sudan - Tanzania (TZ) — https://africa-api.com/data/tanzania - Togo (TG) — https://africa-api.com/data/togo - Tunisia (TN) — https://africa-api.com/data/tunisia - Uganda (UG) — https://africa-api.com/data/uganda - Zambia (ZM) — https://africa-api.com/data/zambia - Zimbabwe (ZW) — https://africa-api.com/data/zimbabwe --- # Africa API Documentation URL: https://africa-api.com/docs Description: API reference and examples for African country records, indicators, markets, trade, and government data. Africa API provides country reference records, historical indicators and source-specific data such as exchange rates, trade flows and government records. Country and date coverage varies by dataset. See [Coverage](/docs/coverage) before building around a particular metric. ## Make your first request [Create an API key and follow the quickstart](/docs/quickstart). Data requests use bearer authentication and routes under `/v1`: ```text https://api.africa-api.com/v1 ``` `/health` and `/v1/platform/version` are public operational routes. See [Authentication](/docs/authentication) for key handling and protected requests. ## Choose an endpoint | What you need | Start with | | --- | --- | | Country codes, names and reference fields | [Countries](/docs/countries) | | A summary of available observations for one country | [Signals](/docs/signals) | | A metric definition or available country/year coverage | [Indicators](/docs/indicators) | | Indicator values, time series or a specific source | [Data](/docs/data) | | Exchanges, tickers, historical prices or FX | [Markets](/docs/markets) | | Trade partners, products or flows | [Trade](/docs/trade) | | Leaders, cabinets and leadership terms | [Government](/docs/government) | | Election records or results | [Elections](/docs/elections) | | Policy documents and events | [Policies](/docs/policies) | ## Integration guides Choose between country records, profiles and signals. Discover metrics, query observations and rank countries by year. Query supported exchanges, ticker histories and FX rates. Configure read-only API tools in a compatible AI client. Map selected api.dataafrica.io queries and check coverage differences. Compare query patterns and decide which data source fits your task. For topic-specific examples, see [Agriculture](/docs/agriculture), [Climate](/docs/climate), [Health](/docs/health), and the other domain guides in the sidebar. ## Operate your client - [SDKs and clients](/docs/sdks): reuse authentication and request handling. - [Errors](/docs/errors) and [Rate limits](/docs/rate-limits): handle failed requests and account quotas. - [Sources](/docs/sources): inspect provenance, source terms and refresh records. - [Platform](/docs/platform) and [Status](/docs/status): check release identity, source status and platform health. [FAQ](/docs/faq) covers plans, commercial use and other product questions. --- # African Countries API URL: https://africa-api.com/docs/african-countries-api Description: Choose Africa API endpoints for country lists, reference records, profiles, and country signals. Use country endpoints to build a selector, fetch reference fields, or request a summary for one country. Choose the response your page needs: | Task | Endpoint | | --- | --- | | List or filter countries | `/v1/countries` | | Fetch a country's reference record | `/v1/countries/{country_code}` | | Request a country profile | `/v1/countries/{country_code}/profile` | | Inspect available country signals | `/v1/countries/{country_code}/signals` | Country routes require an API key. Start with [Quickstart](/docs/quickstart) if you have not set up authentication. ## Example: List Countries In A Region ```bash curl "https://api.africa-api.com/v1/countries" \ -G \ -d "region=west" \ -d "sort=name" \ -d "paginate=true" \ -d "per_page=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` `region=west` filters the list to West Africa; pagination limits this response to ten records. ## Example: Get A Country Profile ```bash curl "https://api.africa-api.com/v1/countries/ke/profile" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The profile groups country information in one response. See [Countries](/docs/countries) for its fields. ## Example: Get Current Country Signals ```bash curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Signals group available observations from several topics. Fields and observation dates vary by country and source; check [Coverage](/docs/coverage) before building around a particular signal. For a particular metric or a time series, use [`/v1/data`](/docs/data) with an explicit metric key and country filter. ## African Countries API FAQ ### How do I get a list of all African countries via API? `GET /v1/countries` returns all 54 African countries as consistent reference records with ISO codes, capital, region, currencies, and languages. Use `/v1/countries/{country_code}` for the full detail object and `/profile` for a curated summary with indicator highlights. ### Is there a free API for African country data? The Free plan includes country records, profiles and signals within its request limits. Create a key in the [dashboard](/dashboard); see [Rate limits](/docs/rate-limits) for quotas. ### Can I get current data for one country in a single request? `GET /v1/countries/{country_code}/signals` groups the available observations for that country. It can include macro indicators, FX, markets, trade, government, climate and disaster alerts. Check the observation dates and missing fields; sources do not all update at the same time. ## Related Docs Full reference for country list, detail, profile, and signals routes. Country signal fields, dates and source information. Geography hierarchy records when you need regions and parent-child relationships. Query explicit metrics and time series when country profiles are not enough. --- # African Indicators and Time Series API URL: https://africa-api.com/docs/african-indicators-api Description: 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. | Task | Endpoint | | --- | --- | | 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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. ## Related Docs Observation queries filtered by country, year, category and source. Discover metric definitions, coverage, and rankings. Examples for macroeconomic indicator workflows. Examples for climate-related discovery and time-series use cases. --- # African Market Data API URL: https://africa-api.com/docs/african-market-data-api Description: Query supported African exchanges, tickers, historical price observations, and source-specific FX rates. Market routes return exchange metadata, tickers, historical prices and FX observations. Begin by checking which exchanges or currency pairs are available: | Task | Endpoint | | --- | --- | | List exchanges and latest trade dates | `/v1/markets/exchanges` | | Browse instruments on an exchange | `/v1/markets/tickers` | | Fetch one instrument | `/v1/markets/tickers/{exchange_code}/{ticker_symbol}` | | Query currency rates | `/v1/markets/fx-rates` | Market data covers fewer countries than country reference records and historical indicators. Price-history depth varies by exchange and instrument. See [Markets](/docs/markets) for coverage and supported parameters. ## Example: List Exchanges ```bash curl "https://api.africa-api.com/v1/markets/exchanges" \ -G \ -d "country_code=ng" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Remove `country_code=ng` to list exchanges across supported countries. ## Example: Browse Tickers ```bash curl "https://api.africa-api.com/v1/markets/tickers" \ -G \ -d "exchange_code=NGX" \ -d "limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` `exchange_code=NGX` selects the Nigerian Exchange. Use a returned ticker symbol in the detail and history routes. ## Example: Get Historical Prices For One Ticker ```bash curl "https://api.africa-api.com/v1/markets/tickers/NGX/MTNN/history" \ -G \ -d "start_date=2025-01-01" \ -d "end_date=2025-12-31" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The date filters select the requested period. Returned history depends on the observations available for that ticker. Use `price_metadata` to check currency, units and finality before displaying or comparing prices. Older responses without metadata have unverified units and status. ## Example: Query FX Rates ```bash curl "https://api.africa-api.com/v1/markets/fx-rates" \ -G \ -d "base_currency=USD" \ -d "quote_currency=NGN" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Inspect the rate's source and observation date. Providers and reporting schedules vary by currency pair. ## African Market Data API FAQ ### Is there an API for African stock exchanges? `/v1/markets/*` includes exchange metadata, tickers and historical price observations for supported exchanges, including NGX, JSE, Casablanca and BRVM. Query the exchange list and check each instrument's available dates. ### How do I get USD exchange rates for African currencies? Use `GET /v1/markets/fx-rates` with `base_currency=USD` and the required `quote_currency`. The catalog combines USD-based daily rates with central-bank series, including BCEAO, Bank Al-Maghrib and Bank of Tanzania. Check the returned source to distinguish providers. ### Does the API include historical price data? Yes. Ticker history routes return historical price observations for supported instruments, and FX history supports rate-over-time queries. Coverage varies by exchange and instrument, so check the markets reference for current depth. ## Related Docs Full route reference for exchanges, tickers, history, and FX rates. Combine market data with country records and country snapshots. Inspect market observations alongside other country signals. Query trade partners, products and flows. --- # Agriculture URL: https://africa-api.com/docs/agriculture Description: Access crop production, yields, irrigation, land use, and livestock data across African countries with historical series and latest values. ## African Agriculture Data API Query crop production, yields, irrigation, land use, and livestock observations from FAOSTAT. Available countries and years vary by metric. Migrating queries from `api.dataafrica.io`? See the [DataAfrica migration guide](/docs/dataafrica-api) for endpoint mappings and coverage differences. ## Endpoints Agriculture data is exposed through shared indicator, data, and country-profile endpoints. - `GET /v1/indicators?category=agriculture` - `GET /v1/data?category=agriculture` - `GET /v1/countries/{country_code}/profile` - `GET /v1/sources/faostat_agriculture` ## Choose a query - Check metric names and coverage with `/v1/indicators?category=agriculture&has_data=true`. - Fetch the latest available values with `/v1/data?category=agriculture&latest=true`. - Select a country, metric, and year range in `/v1/data` for a time series. - Use country profiles for selected agriculture, economic, and infrastructure indicators. ## Useful Metrics - `agricultural_land_1000ha` - `arable_land_1000ha` - `forest_land_1000ha` - `land_equipped_for_irrigation_1000ha` - `maize_production_tonnes` - `wheat_production_tonnes` - `rice_production_tonnes` - `maize_yield_kg_per_ha` - `wheat_yield_kg_per_ha` - `rice_yield_kg_per_ha` - `cattle_stock_head` - `chicken_stock_1000_head` ## Example: Compare Crop Production Across Countries ```bash curl "https://api.africa-api.com/v1/data?country_codes=ng,et,za&metric_key=maize_production_tonnes&year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example: Discover Agriculture Metrics And Coverage ```bash curl "https://api.africa-api.com/v1/indicators?category=agriculture&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example: Get The Latest Agriculture Snapshot For A Country ```bash curl "https://api.africa-api.com/v1/data?country_code=ke&category=agriculture&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Coverage And Source Notes The listed series use `faostat_agriculture` and have annual frequency. Check each indicator's `coverage` for available countries and years before building a report around it. The latest available year can differ between metrics. ## Related Docs Inspect the agriculture metric catalog and coverage. Query latest agriculture values or full time series. Read country reference records, profiles, and selected signals. Review FAOSTAT coverage, provenance, and freshness. --- # Authentication URL: https://africa-api.com/docs/authentication Description: Authenticate Africa API requests with bearer tokens, create API keys in the dashboard, and understand which routes are public. ## API Keys Create and manage API keys in the [dashboard](https://africa-api.com/dashboard). Protected requests use: ```http Authorization: Bearer ``` ### Public routes - `GET /health` - `GET /v1/platform/version` ### Protected routes All current data-bearing `/v1/*` routes require: ```http Authorization: Bearer ``` Do not assume read routes are public. Countries, signals, indicators, data, markets, trade, government, and policy routes all require an API key. ## Request Format ```bash curl "https://api.africa-api.com/v1/data?country_code=ke&metric_key=population_total&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Implementation Guidance 1. Always send the `Authorization` header from your first protected request. 2. Store API keys server-side for production workloads. 3. Use separate keys per environment. 4. Rotate keys on any suspected exposure. 5. Never embed production keys in public client-side code. ## JavaScript Pattern ```typescript const response = await fetch( "https://api.africa-api.com/v1/indicators?category=health&has_data=true", { headers: { Authorization: `Bearer ${process.env.AFRICA_API_KEY ?? ""}`, }, }, ); ``` ## Expected Auth Errors | Status | Meaning | |--------|---------| | `401` | Missing or invalid bearer token | | `403` | Authenticated but not permitted for the attempted action | See [Errors](/docs/errors) for full handling guidance. ## Related First authenticated request flow. Status codes and response shapes. --- # Central Banks URL: https://africa-api.com/docs/central-banks Description: Query the latest available central-bank policy rates, benchmark rates, and monthly inflation observations for supported countries and currency unions. ## Central Bank Signals Query policy rates and selected economic observations from official central-bank releases. Check the source and reporting period when comparing values. Available series by country or currency union: - CEMAC countries via BEAC - `policy_rate_pct` - Morocco - `policy_rate_pct` - WAEMU countries via BCEAO - `policy_rate_pct` - Nigeria - `policy_rate_pct` - `official_exchange_rate_latest_lcu_per_usd` - `inflation_cpi_latest_yoy_pct` - South Africa - `policy_rate_pct` - `inflation_cpi_latest_yoy_pct` - Kenya - `policy_rate_pct` - `overnight_interbank_rate_pct` - `inflation_cpi_latest_yoy_pct` - Namibia - `policy_rate_pct` - Tanzania - `policy_rate_pct` - `inflation_cpi_latest_yoy_pct` - `interbank_7d_rate_pct` - `official_exchange_rate_latest_lcu_per_usd` - Tunisia - `policy_rate_pct` - `official_exchange_rate_latest_lcu_per_usd` Use `/v1/data` for historical annual series and explicit metric queries. `/v1/countries/{country_code}/signals` returns selected latest releases for one country. ## Example ```bash title="Kenya Signals" curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Nigeria Signals" curl "https://api.africa-api.com/v1/countries/ng/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="South Africa Signals" curl "https://api.africa-api.com/v1/countries/za/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Senegal Signals" curl "https://api.africa-api.com/v1/countries/sn/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Morocco Signals" curl "https://api.africa-api.com/v1/countries/ma/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Namibia Signals" curl "https://api.africa-api.com/v1/countries/na/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Tanzania Signals" curl "https://api.africa-api.com/v1/countries/tz/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Tunisia Signals" curl "https://api.africa-api.com/v1/countries/tn/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="One Explicit Current Series" curl "https://api.africa-api.com/v1/data?country_code=ke&metric_key=policy_rate_pct&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Reporting periods and source coverage Central-bank sources publish at different cadences and with different definitions than annual international datasets. Read `source`, `frequency`, and `as_of_period` to identify the publisher, publication cadence, and period represented by each value. A latest release may describe an earlier month or decision date. BCEAO policy-rate coverage includes: - Benin - Burkina Faso - Côte d'Ivoire - Guinea-Bissau - Mali - Niger - Senegal - Togo BEAC policy-rate coverage includes: - Cameroon - Central African Republic - Chad - Congo - Equatorial Guinea - Gabon Read selected latest observations for one country. Find annual and monthly economic metrics. --- # Climate URL: https://africa-api.com/docs/climate Description: Query annual climate and environment indicators alongside daily and rolling point-based estimates from NASA POWER. ## Climate In Africa API Climate and environment data is exposed through the shared indicator and data endpoints. Available data includes: - historical annual country indicators from World Bank WDI - daily and rolling point-based estimates from NASA POWER for supported countries - `GET /v1/indicators?category=climate` - `GET /v1/data?category=climate` - `GET /v1/sources/world_bank_wdi` ## Annual climate and environment indicators - `co2e_emissions_per_capita` - `co2e_emissions_total_mt` - `pm25_air_pollution_ug_per_m3` - `forest_area_pct_land` - `protected_areas_pct_total` - `renewable_electricity_output_pct_total` - `freshwater_withdrawals_pct_internal_resources` These are annual country-level observations. Check the indicator catalog for available countries and years. ## Current Climate Signals - `temperature_2m_latest_c` - `relative_humidity_latest_pct` - `precipitation_7d_mm` - `precipitation_30d_mm` These daily and rolling values are point-based estimates from NASA POWER, rather than annual national indicators. They appear in `/v1/countries/{country_code}/signals` where available. Check `as_of_period` for the dates represented by each value. ## Example Queries ```bash curl "https://api.africa-api.com/v1/indicators?category=climate&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_codes=ke,ng,za&metric_key=pm25_air_pollution_ug_per_m3&year=2023" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_code=ga&metric_key=forest_area_pct_land&start_year=2018&end_year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="Current Climate Signals" curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Inspect available climate metrics and coverage. Query latest climate values or full time series. Read selected climate and environment indicators in country profiles. Query recent temperature, humidity, and rainfall estimates. --- # Commodities URL: https://africa-api.com/docs/commodities Description: Use benchmark commodity prices from country signals to add current market context without leaving the API. ## Commodity Benchmarks In Africa API Africa API exposes benchmark commodity prices through country signals. Use: - `GET /v1/countries/{country_code}/signals` The `commodity_benchmarks` block is designed for current context, not country-specific supply or production measurement. ## What It Contains Current benchmark series include: - `crude_oil_benchmark_usd_per_bbl` - `natural_gas_europe_benchmark_usd_per_mmbtu` - `maize_benchmark_usd_per_mt` - `rice_benchmark_usd_per_mt` - `wheat_benchmark_usd_per_mt` These are global reference prices sourced from the World Bank Pink Sheet monthly workbook. ## How To Use It Use benchmark commodities when you want: - quick pricing context in a country dashboard - current cost-pressure context alongside inflation and FX - a simple commodity reference layer for applications and agents Do **not** treat these as local retail or domestic producer prices. ## Example ```bash curl "https://api.africa-api.com/v1/countries/ng/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Look for: - `commodity_benchmarks[].commodity_key` - `commodity_benchmarks[].price_value` - `commodity_benchmarks[].price_date` ## When To Use A Different Source If you need: - local pump prices - local food basket prices - domestic farm-gate prices then benchmark commodities are not enough. Those should come from country-specific operational sources, not the benchmark layer. See the country snapshot endpoint that returns benchmark commodities. Combine benchmarks with inflation, FX, and policy signals. Use agricultural indicators alongside benchmark prices for broader context. --- # Countries URL: https://africa-api.com/docs/countries Description: Get reference records for 54 African countries, country profiles, and selected latest observations. Data coverage and reporting periods vary by metric and source. ## African Countries API Query country reference records, selected indicators, and the latest available observations. The reference catalog contains 54 African countries; metric and source coverage varies. ## Choosing The Country Routes - Use `/v1/countries` for country discovery and reference records. - Use `/v1/countries/{country_code}` for the full country detail record. - Use `/v1/countries/{country_code}/profile` for selected indicators, trade data, and government records. - Use `/v1/countries/{country_code}/signals` for selected latest observations and alerts. ## List Countries Returns country metadata for Africa. Authentication required. Set true to enable paginated results Page number when pagination is enabled Items per page (1-100) Filter by region alias such as west, east, north, south, central Sort by `name`, `area`, or `region`; prefix with `-` for descending ```bash title="Request" curl "https://api.africa-api.com/v1/countries" \ -G \ -d "paginate=true" \ -d "page=1" \ -d "per_page=5" \ -d "region=west" \ -d "sort=name" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "id": "gh", "name": "Ghana", "official_name": "Republic of Ghana", "capital": "Accra", "region": "West Africa", "subregion": "Western Africa", "area_km2": 238533, "currencies": ["GHS"], "languages": ["eng"], "flag": "GH" } ], "meta": { "total": 16, "page": 1, "per_page": 5, "total_pages": 4 } } ``` --- ## Get Country By Code Returns a detailed country record by ISO 3166-1 alpha-2 code. ISO alpha-2 code such as `ng`, `ke`, `za` ```bash title="Request" curl "https://api.africa-api.com/v1/countries/ng" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": { "id": "ng", "name": "Nigeria", "official_name": "Federal Republic of Nigeria", "capital": "Abuja", "region": "West Africa", "subregion": "Western Africa", "area_km2": 923768, "iso3": "NGA", "timezone": "Africa/Lagos", "calling_code": "+234", "flag": "NG", "coordinates": { "latitude": 9.082, "longitude": 8.6753 }, "borders": ["bj", "cm", "ne", "td"], "currencies": [ { "code": "NGN", "name": "Nigerian naira", "symbol": "NGN" } ], "languages": [ { "code": "eng", "name": "English" } ] } } ``` --- ## Get Country Profile Returns selected indicators, trade highlights, government records, and transport data for one country. Government fields include current leaders, cabinet members, and the latest election when available. Use `/v1/data` or the individual domain endpoints, such as `/v1/trade/overview/{country_code}`, for detailed queries. ```bash title="Request" curl "https://api.africa-api.com/v1/countries/ke/profile" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The following example illustrates the response structure. Its values are examples, not current country statistics or government records. ```json title="Response shape" { "data": { "country": { "code": "ke", "name": "Kenya", "capital": "Nairobi", "region": "East Africa" }, "highlights": { "population_total": { "value": 55100586, "year": 2024, "source": "world_bank_wdi", "unit": "persons" }, "median_age_years": { "value": 20.4, "year": 2024, "source": "un_wpp", "unit": "years" }, "unemployment_pct": { "value": 5.7, "year": 2024, "source": "ilo_ilostat", "unit": "percent" }, "agricultural_land_1000ha": { "value": 30350, "year": 2023, "source": "faostat_agriculture", "unit": "thousand_hectares" }, "access_to_clean_fuels_pct": { "value": 30.8, "year": 2023, "source": "world_bank_wdi", "unit": "percent" }, "mobile_subscriptions_per_100": { "value": 118.6, "year": 2024, "source": "world_bank_wdi", "unit": "subscriptions_per_100_people" }, "paved_roads_pct": { "value": 14.2, "year": 2022, "source": "world_bank_wdi", "unit": "percent" }, "pm25_air_pollution_ug_per_m3": { "value": 18.4, "year": 2023, "source": "world_bank_wdi", "unit": "micrograms_per_cubic_meter" }, "government_effectiveness_estimate": { "value": -0.41, "year": 2024, "source": "world_bank_wdi", "unit": "estimate" } }, "trade": { "latest_year": 2024, "granular_latest_year": 2024, "granular_years": [2023, 2024], "latest_snapshot": { "year": 2024, "exports_goods_services_usd": 15420000000, "imports_goods_services_usd": 18610000000, "trade_balance_usd": -3190000000, "exports_goods_services_pct_gdp": 12.1, "imports_goods_services_pct_gdp": 14.6, "current_account_balance_pct_gdp": -3.4, "sources": { "exports_goods_services_usd": "world_bank_wdi", "imports_goods_services_usd": "world_bank_wdi", "trade_balance_usd": "world_bank_wdi" } }, "top_export_partners": [ { "partner_country_code": "ug", "partner_country_name": "Uganda", "flow_type": "export", "total_value_usd": 1210000000 } ], "top_import_partners": [ { "partner_country_code": "cn", "partner_country_name": "China", "flow_type": "import", "total_value_usd": 3180000000 } ], "top_export_products": [ { "product_code": "09", "product_name": "Coffee, tea, mate and spices", "classification": "HS", "flow_type": "export", "total_value_usd": 730000000 } ], "top_import_products": [ { "product_code": "84", "product_name": "Machinery and mechanical appliances", "classification": "HS", "flow_type": "import", "total_value_usd": 1110000000 } ] }, "government": { "current_head_of_state": { "wikidata_id": "LEADER_WIKIDATA_ID", "name": "William Ruto", "office_name": "President of Kenya", "role_type": "head_of_state", "start_date": "2022-09-13", "source": "wikidata_government_history" }, "current_head_of_government": { "wikidata_id": "LEADER_WIKIDATA_ID", "name": "William Ruto", "office_name": "President of Kenya", "role_type": "head_of_government", "start_date": "2022-09-13", "source": "wikidata_government_history" }, "cabinet_member_count": 2, "current_cabinet_members": [ { "wikidata_id": "CABINET_MEMBER_WIKIDATA_ID", "name": "John Mbadi", "office_name": "Cabinet Secretary for National Treasury", "role_category": "minister", "party_name": "ODM", "start_date": "2024-08-08", "source": "wikidata_current_governments" } ], "latest_election": { "wikidata_id": "ELECTION_WIKIDATA_ID", "name": "2022 Kenyan general election", "election_scope": "general", "election_date": "2022-08-09", "office_name": "President of Kenya", "election_status": "completed", "successful_candidate_name": "William Ruto", "source": "wikidata_elections" }, "active_policy_count": 14, "latest_policy": { "wikidata_id": "POLICY_WIKIDATA_ID", "title": "POLICY_TITLE", "document_type": "law", "policy_status": "active", "published_at": "2016-05-27", "source": "wikidata_policies" }, "latest_policy_event": { "event_key": "POLICY_WIKIDATA_ID:EVENT_TYPE:EVENT_DATE", "policy_wikidata_id": "POLICY_WIKIDATA_ID", "title": "POLICY_TITLE", "document_type": "law", "event_type": "implemented", "event_date": "2016-06-01", "summary": "Kenya Climate Change Act entered into force", "source": "wikidata_policies" } } } } ``` --- ## Get Country Signals Returns selected latest observations for one country. The response combines available: - current macro and infrastructure observations - FX rates - exchange market snapshots - trade summaries - government records Signals can describe different reporting periods. Check each observation's frequency and period; monthly/latest metrics expose `as_of_period`. Use `/v1/data` for available history and additional filters. ```bash title="Request" curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` This example illustrates the signals response. Its dates and values are not a current country snapshot. ```json title="Illustrative signals response" { "data": { "country": { "code": "ke", "name": "Kenya", "capital": "Nairobi", "region": "East Africa" }, "observations": [ { "metric_key": "inflation_cpi_latest_yoy_pct", "value": 4.8, "year": 2025, "source": "world_bank_gem_signals", "freshness": "current", "as_of_period": "2025-12" } ], "fx_rates": [ { "base_currency": "USD", "quote_currency": "KES", "rate": 129.44, "date": "2026-03-08", "source": "fx_usd_daily", "freshness": "current" } ], "market_snapshots": [], "trade": { "latest_year": 2024, "granular_latest_year": 2024 }, "government": { "current_head_of_state": { "name": "William Ruto", "role_type": "head_of_state" } }, "generated_at": "2026-03-09T18:00:00Z" } } ``` ## Caching `GET /v1/countries` returns `ETag` and `Cache-Control: public, max-age=300`. Send `If-None-Match` to receive `304 Not Modified` when the list is unchanged. --- # Coverage URL: https://africa-api.com/docs/coverage Description: Country and source coverage for historical indicators, country signals, markets, FX, trade, government, and transport. ## Coverage by dataset Coverage varies by country, metric and year. Country reference records and historical indicators cover a wider geography than operational data such as fuel prices and port activity. Use the tables below to choose a dataset, then check [indicator coverage](/docs/indicators) and [source refresh status](/docs/sources) before relying on a particular country or date. A route can exist without data for every filter combination. ## Historical indicators The historical catalog includes the following domains across Africa's 54 countries. This does not mean that every metric has observations for every country or year. | Domain | Geographic scope | | --- | --- | | Demographics | 54 African countries | | Economy | 54 African countries | | Health | 54 African countries | | Education | 54 African countries | | Governance and organized conflict | 54 African countries | | Climate and environment | 54 African countries | | Infrastructure and connectivity | 54 African countries | | Agriculture | 54 African countries | Primary route: - `GET /v1/data` Typical sources behind this layer include World Bank WDI, UN WPP, ILOSTAT, WHO GHO, UNESCO UIS, FAOSTAT, and UCDP. ## Country signals The signals endpoint combines the latest available observations for a country. The observation dates and update schedules differ by source; an API response is not necessarily a real-time reading. | Country or scope | Signal sources and topics | | --- | --- | | CEMAC countries | BEAC policy-rate signals across Cameroon, Central African Republic, Chad, Congo, Equatorial Guinea, and Gabon | | Kenya | central bank signals, Nairobi fuel prices, Kenya maize prices, climate signals | | Morocco | central bank signals | | Namibia | central bank signals | | Nigeria | central bank signals, grid signals, climate signals | | South Africa | central bank signals, power-system signals, fuel prices, airport traffic, airport on-time performance, port operations, climate signals | | Tanzania | central bank signals, climate signals | | Tunisia | central bank signals, climate signals | | WAEMU countries | BCEAO policy-rate signals across Benin, Burkina Faso, Côte d'Ivoire, Guinea-Bissau, Mali, Niger, Senegal, and Togo | | Countries with active GDACS events | disaster alerts | | Countries with UNHCR country totals | annual displacement context | | Country-wide datasets | climate observations and historical indicator highlights where available in `/signals` | Primary route: - `GET /v1/countries/{country_code}/signals` ### Country and topic matrix | Country or scope | Macro | Prices | Power | Airports | Ports | Climate | Disaster and humanitarian | | --- | --- | --- | --- | --- | --- | --- | --- | | Kenya | Yes | Fuel and maize | - | - | Mombasa performance | Yes | GDACS and UNHCR when present | | Morocco | Yes | - | - | - | - | Historical backbone | GDACS and UNHCR when present | | Namibia | Yes | - | - | - | - | Historical backbone | GDACS and UNHCR when present | | Nigeria | Yes | - | Grid signals | - | - | Yes | GDACS and UNHCR when present | | South Africa | Yes | Fuel | Grid signals | Traffic and on-time performance | National port operations | Yes | GDACS and UNHCR when present | | Tanzania | Yes | - | - | - | - | Yes | GDACS and UNHCR when present | | Tunisia | Yes | - | - | - | - | Yes | GDACS and UNHCR when present | | WAEMU countries | BCEAO policy rates | - | - | - | - | Historical backbone | GDACS and UNHCR when present | | CEMAC countries | BEAC policy rates | - | - | - | - | Historical backbone | GDACS and UNHCR when present | ## Markets and FX Market and FX coverage combines exchange data with official central-bank FX layers. | Product area | Coverage | | --- | --- | | Exchange market data | CSE (Morocco), NGX (Nigeria), JSE (South Africa) | | Daily USD-based FX | broad African currency coverage through `fx_usd_daily` | | Official TZS FX | Bank of Tanzania-published rates for Tanzania | | Official MAD FX | Bank Al-Maghrib-published rates for Morocco | | Official XAF FX | BEAC-published rates for CEMAC countries | | Official XOF FX | BCEAO-published rates for WAEMU countries | | WAEMU policy rates | BCEAO-published minimum bid rate available through `/signals` | Primary routes: - `GET /v1/markets/exchanges` - `GET /v1/markets/tickers` - `GET /v1/markets/fx-rates` ## Government, policy and trade These routes return trade, government, election and policy records. Check the relevant route for country and date coverage. | Domain | Coverage pattern | | --- | --- | | Trade | aggregate and granular trade coverage where source reporting exists | | Government | current governments, leader history, cabinets | | Elections | election records and country election timelines | | Policies | policy documents and policy events | Primary routes: - `GET /v1/trade/*` - `GET /v1/government/*` - `GET /v1/elections/*` - `GET /v1/policies/*` ## Transport and operations Transport datasets combine annual indicators with monthly and annual operator reports. | Product area | Coverage and reporting cadence | | --- | --- | | Airport traffic | South Africa via ACSA monthly consolidated stats | | Airport on-time performance | South Africa via ACSA monthly network on-time stats | | Port operations | South Africa via TNPA monthly national port stats, Kenya via KPA annual Port of Mombasa performance stats | | Historical transport indicators | broad country coverage via `/v1/data` | Primary routes: - `GET /v1/countries/za/signals` - `GET /v1/countries/ke/signals` - `GET /v1/data?category=infrastructure` ## Check coverage in your integration - Use `/v1/indicators` to discover metrics and their available coverage. - Use `/v1/data` to check observations for the countries and years you need. - Inspect observation dates in `/v1/countries/{country_code}/signals` before displaying them as current. - Use `/v1/sources` if you need licensing, provenance, or source-specific freshness context. Inspect the country snapshot and its observation dates. Explore exchange and FX coverage in more detail. Review airport, port, and transport connectivity coverage. Inspect provenance, licensing, and latest successful refresh information. --- # Data URL: https://africa-api.com/docs/data Description: Query African indicators, latest values, and time series across countries, years, categories, and sources. Migrating an `api/join` query from `api.dataafrica.io`? See the [DataAfrica migration guide](/docs/dataafrica-api) for `/v1/data` mappings and coverage differences. Data is provided for informational purposes. Observations are aggregated from third-party sources (World Bank, UN, IMF, and others) and may contain errors, omissions, or reporting lags. Check the `source` field on each observation and verify against it before relying on a value for financial, compliance, or other consequential decisions. See [Sources](/docs/sources) for provenance and the [Terms](/terms) for details. ## Query observations `/v1/data` returns country-level observations filtered by metric, source, category, and year. Use it for: - latest country metrics - time-series queries - multi-country comparisons - observations within a category - observations from a specified source Use `/v1/countries/{country_code}/signals` instead when you want a compact latest snapshot without composing the query yourself. Common category values include: - `demographics` - `economy` - `infrastructure` - `energy` - `climate` - `health` - `education` - `agriculture` One country code Comma-separated country codes One metric key Comma-separated metric keys Indicator category filter Source code filter Exact year Inclusive start year Inclusive end year Return only the latest observation per country and metric Max rows to return (1-1000) ```bash title="Request" curl "https://api.africa-api.com/v1/data" \ -G \ -d "country_code=ke" \ -d "metric_key=population_total" \ -d "start_year=2020" \ -d "end_year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "country_code": "ke", "country_name": "Kenya", "metric_key": "population_total", "metric_name": "Total Population", "year": 2020, "period": "annual", "value": 52217334, "unit": "persons", "source": "world_bank_wdi", "value_status": "reported", "retrieved_at": "2026-03-07T12:10:14Z" }, { "country_code": "ke", "country_name": "Kenya", "metric_key": "population_total", "metric_name": "Total Population", "year": 2024, "period": "annual", "value": 55100586, "unit": "persons", "source": "world_bank_wdi", "value_status": "reported", "retrieved_at": "2026-03-07T12:10:14Z" } ], "meta": { "total": 5, "limit": 100 } } ``` --- ## Compare countries for one year ```bash 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" ``` ## Education Query Example ```bash curl "https://api.africa-api.com/v1/data?country_code=ke&category=education&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Agriculture Query Example ```bash curl "https://api.africa-api.com/v1/data?country_code=ng&metric_key=maize_production_tonnes&start_year=2020&end_year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` For metric lists and domain-specific examples, see [Energy](/docs/energy), [Climate](/docs/climate), and [Transport](/docs/transport). ## Canonical Source Behavior When more than one source publishes the same metric, `/v1/data` returns one canonical observation by default. Use `source=` if you need to pin the response to a specific dataset. ## Estimates And Dataset Versions Some sources publish coded estimates rather than single reported values. When the source provides them, observations include: - `estimate_low`: the source's low estimate - `estimate_high`: the source's high estimate - `dataset_version`: the source release used for the observation These fields are optional. Treat `value` as the best estimate only when `value_status` is `estimated`, and retain the low/high range when presenting or modeling uncertainty. ## Validation Rules - `year` cannot be combined with `start_year` or `end_year` - `start_year` must be less than or equal to `end_year` - `limit` is capped at `1000` ## Common Query Patterns - Use `country_code` when you need one country. - Use `country_codes` when you need a comparison set. - Use `latest=true` when you only need the most recent observation per metric. - Use `source=` when your application needs a specific dataset instead of the default canonical result. --- # DataAfrica API (api.dataafrica.io): Migration Guide URL: https://africa-api.com/docs/dataafrica-api Description: Map selected api.dataafrica.io queries to Africa API, check differences in metrics and geography, and review endpoint checks recorded in June 2026. If your code calls `api.dataafrica.io`, use this guide to compare its queries with Africa API. The mapping covers selected agriculture, climate and health data; it does not reproduce every DataAfrica metric or geography. Africa API is independent of DataAfrica and Datawheel. This guide is a migration reference, not an announcement about DataAfrica's support or retirement status. ## Endpoint checks recorded in June 2026 Earlier checks recorded the following results. They describe that point in time, not the service's current state. Recheck the exact URL and response before diagnosing a failed job. | Checked item | Recorded result | |---|---| | `dataafrica.io` website and docs | Unreachable during the check | | `api.dataafrica.io/api/join` (no trailing slash) | `308 Permanent Redirect` to `/api/join/` | | `api.dataafrica.io/api/join/` (trailing slash) | Some queries returned observations from around 2015 | | Other paths (`/`, `/api/data`, profile routes) | `404 Not Found` or inconsistent responses | | [Public API repository](https://github.com/data-africa/data-africa-api) | The latest public commit recorded by the check was September 28, 2017 | If your request receives a redirect, inspect the destination and whether your client follows it with the query parameters intact. If it succeeds, check the observation years before using the result as current data. Neither a failed request nor a public commit date establishes why a service is unavailable. ## What the DataAfrica API was DataAfrica exposed agriculture, climate, health and poverty datasets for African countries, including subnational geographies. An example of its join endpoint: ```text https://api.dataafrica.io/api/join/?show=year&geo=adm0_eth&required=harvested_area ``` Existing integrations may use `api/join` URLs and metric names such as `rainfall_awa_mm`, crop production values, or child nutrition rates. Match the definition and geographic level before replacing a query. ## Map DataAfrica concepts to Africa API The table identifies starting points for a migration. Check units, observation periods, source definitions and available countries before treating two metrics as equivalent. | DataAfrica concept | Africa API option or coverage difference | |---|---| | `api/join` single query endpoint | [`GET /v1/data`](/docs/data), observation queries filtered by `country_code`, `metric_key`, `category`, `year`, and `latest` | | Crops: production, yields, harvested area | [`GET /v1/data?category=agriculture`](/docs/agriculture) includes selected crop production and yield metrics from FAOSTAT. Discover the available keys first; production or yield is not a substitute for harvested area | | Land use and irrigation (rainfed vs irrigated) | `agricultural_land_1000ha`, `arable_land_1000ha`, `land_equipped_for_irrigation_1000ha`, `forest_land_1000ha`. These totals do not reproduce a rainfed/irrigated crop split | | Livestock | `cattle_stock_head`, `chicken_stock_1000_head` | | Rainfall (`rainfall_awa_mm`) | [`Climate metrics`](/docs/climate) include `precipitation_7d_mm` and `precipitation_30d_mm`. These recent windows are different measures; check the period and aggregation required by your analysis | | Health outcomes | [`GET /v1/data?category=health`](/docs/health), immunization coverage, maternal, neonatal, and under-five mortality, TB incidence (WHO GHO) | | Child nutrition (stunted children) | `stunting_under5_pct` and `wasting_under5_pct` under `category=child_welfare`, from UNICEF. See the [health guide](/docs/health) | | Child underweight (moderately underweight) | Underweight prevalence specifically is not exposed yet. Use [UNICEF data](https://data.unicef.org) or [DHS](https://dhsprogram.com) directly | | Poverty (PovcalNet-based splits) | Not exposed in this mapping. Check the World Bank's [Poverty and Inequality Platform](https://pip.worldbank.org) for the required measure | | Subnational geographies (`adm0`, `adm1`) | Africa API is country-level: [`GET /v1/geographies`](/docs/geographies) covers continent, region, subregion, and country | | Country profile pages | [`GET /v1/countries/{country_code}/profile`](/docs/countries) and [`/signals`](/docs/signals) for a current snapshot | ## Migration example Old DataAfrica request (agriculture for Ethiopia): ```text GET https://api.dataafrica.io/api/join/?show=year&geo=adm0_eth&required=harvested_area ``` To inspect available agriculture observations for Ethiopia: ```bash curl "https://api.africa-api.com/v1/data?country_code=et&category=agriculture&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` This lists agriculture observations; it does not reproduce the old `harvested_area` query. For a specific measure, request its metric key. For example, maize production across countries: ```bash curl "https://api.africa-api.com/v1/data?country_codes=et,ng,ke&metric_key=maize_production_tonnes" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Discover agriculture metrics with stored observations: ```bash curl "https://api.africa-api.com/v1/indicators?category=agriculture&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Create an API key in the [dashboard](/dashboard), then follow the [quickstart](/docs/quickstart) for authentication and your first request. ## Keep the original source when the metric does not match For a dataset outside Africa API's coverage, query its original provider. The mapping above links to UNICEF, DHS and the World Bank Poverty and Inequality Platform for the specific gaps described there. The [DataAfrica GitHub organization](https://github.com/data-africa) is a starting point for finding the old API and site code. When reproducing an older analysis, retain its source version, observation years and geographic definitions. ## Related docs Create a key and make your first authenticated request. Query observations with explicit country, metric, year and source filters. Crop production, yields, land use, irrigation, and livestock across Africa. Configure read-only Africa API tools in a compatible AI client. --- # Demographics URL: https://africa-api.com/docs/demographics Description: Use indicators and data endpoints to work with population, age, fertility, and dependency metrics. ## Demographics In Africa API Query demographic indicators through the indicator, data, and country-profile endpoints. There is no dedicated `/v1/demographics` route. Use: - `GET /v1/indicators?category=demographics` - `GET /v1/data?category=demographics` - `GET /v1/countries/{country_code}/profile` ## Useful Metrics - `population_total` - `population_growth_pct` - `urban_population_pct` - `life_expectancy_years` - `fertility_rate_births_per_woman` - `median_age_years` - `population_density_per_km2` - `child_dependency_ratio` - `old_age_dependency_ratio` ## Example Query ```bash curl "https://api.africa-api.com/v1/data?country_code=ng&metric_keys=population_total,median_age_years&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Discover the metric catalog and coverage ranges. Query observations by country, metric, and year. --- # Disasters URL: https://africa-api.com/docs/disasters Description: Use GDACS disaster alerts in country signals to surface current flood, cyclone, wildfire, earthquake, and volcanic-risk context. ## Current Disaster Context Africa API exposes current GDACS disaster alerts inside: - `GET /v1/countries/{country_code}/signals` Read each alert's event dates, severity, and source links before using it in a country summary. ## Fields Each disaster alert can include: - `event_key` - `event_type` - `name` - `description` - `alert_level` - `alert_score` - `severity_value` - `severity_text` - `severity_unit` - `event_from_at` - `event_to_at` - `source_modified_at` - `report_url` - `details_url` - `source_system` - `source` - `freshness` ## Example ```bash title="Request" curl "https://api.africa-api.com/v1/countries/mz/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The following example illustrates the alert fields. Its values are not a current event report. ```json title="Illustrative disaster alert" { "disaster_alerts": [ { "event_key": "1102919:1:fl:mz", "event_type": "FL", "name": "Flooding in Mozambique", "description": "Heavy rain and flooding conditions", "alert_level": "orange", "alert_score": 2.4, "severity_value": 120.0, "severity_text": "Heavy rain", "severity_unit": "mm/24h", "event_from_at": "2026-03-13T09:00:00Z", "event_to_at": "2026-03-16T09:00:00Z", "source_modified_at": "2026-03-13T10:30:00Z", "report_url": "https://www.gdacs.org/report.aspx?eventid=1102919", "details_url": "https://www.gdacs.org/report.aspx?eventid=1102919&episodeid=1", "source_system": "GDACS", "source": "gdacs_disaster_alerts", "freshness": "current" } ] } ``` ## Notes - Alerts are current-event context, not historical indicator series. - Countries without active GDACS coverage return an empty `disaster_alerts` array. - For provenance and source monitoring, see [Platform](/docs/platform) and [Sources](/docs/sources). --- # Economy URL: https://africa-api.com/docs/economy Description: Use indicators and data endpoints to work with GDP, inflation, unemployment, and other macro signals. ## Economy In Africa API Economic data is exposed through the shared indicator and data endpoints. Use: - `GET /v1/indicators?category=economy` - `GET /v1/data?category=economy` - `GET /v1/countries/{country_code}/signals` - `GET /v1/indicators/{metric_key}/rankings` ## Useful Metrics - `gdp_current_usd` - `gdp_per_capita_usd` - `inflation_cpi_pct` - `inflation_cpi_latest_yoy_pct` - `policy_rate_pct` - `treasury_bill_91d_rate_pct` - `overnight_interbank_rate_pct` - `official_exchange_rate_latest_lcu_per_usd` - `petrol_price_local_per_liter` - `diesel_price_local_per_liter` - `kerosene_price_local_per_liter` - `maize_retail_price_local_per_kg` - `maize_wholesale_price_local_per_kg` - `foreign_reserves_import_cover_latest_months` - `unemployment_pct` - `unemployment_rate_latest_pct` - `youth_unemployment_pct` - `merchandise_exports_latest_usd_mn` - `merchandise_imports_latest_usd_mn` - `trade_balance_usd` - `current_account_balance_pct_gdp` Use the `*_latest_*` metrics for the latest available releases. Check `frequency` and `as_of_period` to distinguish their reporting periods from the annual series. Selected official central-bank releases appear in the country signals response where available. The `commodity_benchmarks` block returned by `/v1/countries/{country_code}/signals` contains global reference prices. Local prices in `/signals` include location and source details. Kenya fuel prices use `location_name: Nairobi`. South Africa fuel prices use the official DMRE Gauteng reference zone and carry fuel-grade and scope details in `context`. Kenya maize prices use the World Bank Kenya market feed with `location_name: Market Average`. Retain these labels when displaying or comparing prices. ## Example Query ```bash 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" ``` ```bash title="Current Monthly Inflation Signal" curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Inspect available economic metrics. Query latest values or full time series. Find official monetary series and their country coverage. Add benchmark oil, gas, maize, rice, and wheat prices to your economic snapshots. --- # Elections URL: https://africa-api.com/docs/elections Description: Query African election events, country election overviews, and candidate-level results from Wikidata where available. ## Elections In Africa API Query election events and results through the elections endpoints. Use [Government](/docs/government) for leaders and terms of office. Current source: - `wikidata_elections` Use: - `GET /v1/elections` - `GET /v1/elections/upcoming` - `GET /v1/elections/country/{country_code}` - `GET /v1/elections/{election_wikidata_id}` - `GET /v1/elections/results/{election_wikidata_id}` ## What This Covers Available records include: - presidential elections - parliamentary elections - general elections - election dates and office context - winners when available - country election timelines - candidate-level result rows where Wikidata has them ## Country Election Overview Example ```bash curl "https://api.africa-api.com/v1/elections/country/ng?top_limit=5" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Example response shape (values change as election records are refreshed): ```json { "data": { "country": { "code": "ng", "name": "Nigeria", "region": "West Africa" }, "latest_election": { "wikidata_id": "ELECTION_WIKIDATA_ID", "country_code": "ng", "country_name": "Nigeria", "name": "2023 Nigerian presidential election", "election_scope": "presidential", "election_date": "2023-02-25", "year": 2023, "office_name": "President of Nigeria", "election_status": "completed", "successful_candidate_name": "Bola Tinubu", "source": "wikidata_elections" }, "upcoming_elections": [], "recent_elections": [] } } ``` ## Election List Example ```bash curl "https://api.africa-api.com/v1/elections?country_code=za&election_scope=parliamentary&limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Election Detail Example ```bash curl "https://api.africa-api.com/v1/elections/Q83974481" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Election Results Example ```bash curl "https://api.africa-api.com/v1/elections/results/Q83974481?limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## How It Fits The Government Domain - [Government](/docs/government) covers current leaders, historical terms, and country government overviews - `Elections` covers election events and results - country profiles include the latest available election inside the `government` block Use government history for leaders and terms of office. Read the latest election summary in a country profile when available. Governance indicators remain separate from election events. --- # Energy URL: https://africa-api.com/docs/energy Description: Use indicators and data endpoints to work with electricity access, clean cooking, renewable energy, and longer-run power system efficiency. ## Energy In Africa API Energy data is exposed through the shared indicator and data endpoints. Use: - `GET /v1/indicators?category=energy` - `GET /v1/data?category=energy` - `GET /v1/countries/{country_code}/profile` For current operational grid conditions such as load shedding and generation availability, use the signals layer instead: - `GET /v1/countries/{country_code}/signals` ## Useful Metrics - `access_to_clean_fuels_pct` - `electric_power_consumption_kwh_per_capita` - `electric_power_transmission_losses_pct` - `renewable_energy_consumption_pct` - `energy_use_kg_oil_eq_per_capita` - `electricity_access_pct` ## Example Query ```bash curl "https://api.africa-api.com/v1/data?country_codes=ke,ng,za&metric_key=renewable_energy_consumption_pct&year=2021" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Read the guide for current grid-condition signals and operational power context. Inspect available energy metrics. Query latest values or full time series. --- # Errors URL: https://africa-api.com/docs/errors Description: HTTP status codes, validation failures, and common error shapes returned by Africa API. ## Status Codes You Should Handle | Status | Meaning | Typical Cause | |--------|---------|---------------| | `200` | Success | Request completed normally | | `304` | Not Modified | `If-None-Match` matched the current countries list ETag | | `400` | Bad Request | Invalid query combination such as `year` plus `start_year` | | `401` | Unauthorized | Missing or invalid API key | | `403` | Forbidden | Authenticated but not allowed to perform the action | | `404` | Not Found | Missing country, indicator, geography, source, exchange, or ticker | | `422` | Validation Error | Query parameter type or bounds are invalid | | `429` | Too Many Requests | Per-minute rate limit or monthly request quota exceeded | | `500` | Server Error | Unexpected backend failure | ## Common Error Shapes ### 400 / 404 ```json { "detail": "indicator not found: median_income_usd" } ``` ### 401 ```json { "detail": "missing bearer token" } ``` ### 422 ```json { "detail": [ { "loc": ["query", "limit"], "msg": "Input should be less than or equal to 1000", "type": "less_than_equal" } ] } ``` ## Client Best Practices 1. Treat `304` as success and reuse the cached countries payload. 2. Retry transient per-minute `429` and `5xx` responses with backoff. A monthly quota `429` needs a quota reset or a plan with more remaining capacity; see [Rate limits](/docs/rate-limits). 3. Do not blindly retry `401`, `403`, `404`, or `422`. 4. Log the endpoint, status code, and `detail` payload. ## Related Bearer-token request format and protected routes. Safe retry and batching guidance. --- # FAQ URL: https://africa-api.com/docs/faq Description: Product and integration questions for teams adopting Africa API. The Free plan costs $0: 1,000 requests a month, 5 requests/minute, and 1 API key, with no card required. Analyst is $99/month or $990/year (250,000 requests/month, 60 requests/minute, and 3 API keys). Team is $349/month or $3,490/year (2,000,000 requests/month, 1,000 requests/minute, and 5 API keys). Annual plans include two months free and are billed once per year. Plans have the same data access, with different request limits and API key allowances. See [pricing](/pricing). The Free plan lets you test the same datasets and endpoint families as paid plans, within 1,000 requests a month and 5 requests/minute. Check the countries, metrics, and years your integration needs; coverage varies by dataset. You can review plans and manage billing in the [dashboard](/dashboard). Yes, subject to our [Terms of Service](/terms) and the relevant upstream source terms. Public-facing republication requires attribution to the original sources. Use the response's source code and [source metadata](/docs/sources) to find the underlying dataset, then check its terms for your intended use. No. Countries are the reference layer. The platform also exposes current signals, historical indicators, markets, trade, government records, elections, policies, and FX data. Start with `/v1/data` for metrics and `/v1/countries` for reference metadata. Add `/v1/indicators` so your client can discover available metrics instead of hard-coding assumptions. `/health` and `/v1/platform/version` are public. Current data-bearing `/v1/*` routes require a bearer API key. Public routes are versioned under `/v1`, and the platform is designed for additive changes where possible. `/v1/data` applies canonical source preference by default. If you need a specific upstream dataset, pass `source=` explicitly. Yes. Use `/v1/platform/etl-status` for source-level refresh status and `/v1/sources/{source_code}` for source metadata and the latest successful refresh. Yes. `/v1/markets/*` covers exchanges, tickers, history, and FX while keeping the same auth and error model as the rest of the API. The official MCP server, `africa-api-mcp` on npm, exposes read-only API tools to clients such as Claude and Cursor. See the [MCP server guide](/docs/mcp) for local setup and requirements. Agents can also read [/llms.txt](/llms.txt), [/llms-full.txt](/llms-full.txt), and the OpenAPI schema. No. Africa API is independent of DataAfrica and Datawheel. If you are updating code that calls `api.dataafrica.io`, see the [DataAfrica migration guide](/docs/dataafrica-api) for query mappings and coverage differences. --- # Geographies URL: https://africa-api.com/docs/geographies Description: Traverse continent, region, country, and other geography records exposed by Africa API. ## List Geographies Returns geography records from the hierarchy backing the public platform. Filter by geography type such as `continent`, `region`, `subregion`, or `country` Return children of a geography key Filter to one country-backed geography Case-insensitive search against geography names Maximum rows to return (1-500) ```bash title="Request" curl "https://api.africa-api.com/v1/geographies?type=country&limit=3" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "key": "country:dz", "type": "country", "code": "dz", "name": "Algeria", "parent_key": "subregion:northern-africa", "country_code": "dz", "latitude": 28, "longitude": 3 } ] } ``` --- ## Get Geography Detail Returns one geography record by key. ```bash title="Request" curl "https://api.africa-api.com/v1/geographies/country:ke" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": { "key": "country:ke", "type": "country", "code": "ke", "name": "Kenya", "parent_key": "subregion:eastern-africa", "country_code": "ke", "latitude": -0.0236, "longitude": 37.9062 } } ``` --- # Geography URL: https://africa-api.com/docs/geography Description: Use countries and geographies endpoints to work with location hierarchy and spatial reference data. ## Geography In Africa API There is no standalone `/v1/geography` endpoint. Geography-related data is split across: - `GET /v1/countries` - `GET /v1/countries/{country_code}` - `GET /v1/geographies` - `GET /v1/geographies/{geography_key}` ## What To Use When - Use `countries` for country metadata, borders, coordinates, currencies, and languages. - Use `geographies` for hierarchy traversal across continent, region, subregion, and country nodes. ## Example Query ```bash curl "https://api.africa-api.com/v1/geographies?parent_key=subregion:eastern-africa" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Country metadata and profile routes. Geography hierarchy reference. --- # Governance And Conflict URL: https://africa-api.com/docs/governance Description: Compare institutional quality and query versioned organized-violence estimates across African countries. ## Governance And Conflict In Africa API Governance and organized-conflict data are exposed through the shared indicator and data endpoints. Current coverage combines the World Bank Worldwide Governance Indicators series with the Uppsala Conflict Data Program (UCDP) Country-Year Dataset. Use: - `GET /v1/indicators?category=governance` - `GET /v1/data?category=governance` - `GET /v1/indicators/{metric_key}/rankings` - `GET /v1/countries/{country_code}/profile` ## Institutional Governance Metrics - `voice_accountability_estimate` - `political_stability_estimate` - `government_effectiveness_estimate` - `regulatory_quality_estimate` - `rule_of_law_estimate` - `control_of_corruption_estimate` These are annual country-level estimates. Check the indicator catalog for country and year coverage. ## Organized-Violence Metrics - `organized_violence_deaths_estimate` - `state_based_conflict_dyads_total` - `non_state_conflict_dyads_total` - `one_sided_violence_dyads_total` The documented UCDP release, version `26.1`, covers 54 African countries from 1989 through 2025. A dyad metric counts active conflict pairs; it is not a fatality count or a composite country-risk score. ## Example Queries ```bash curl "https://api.africa-api.com/v1/indicators?category=governance&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_codes=gh,ke,ng,za&metric_key=government_effectiveness_estimate&year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/indicators/control_of_corruption_estimate/rankings?year=2024&limit=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` To filter UCDP observations to Nigeria and 2025: ```bash curl "https://api.africa-api.com/v1/data?country_code=NG&year=2025&source=ucdp_organized_violence&limit=4" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Selected fields from the recorded production response for dataset version `26.1`: ```json { "data": [ { "country_code": "ng", "metric_key": "non_state_conflict_dyads_total", "year": 2025, "value": 28.0, "value_status": "estimated", "dataset_version": "26.1" }, { "country_code": "ng", "metric_key": "one_sided_violence_dyads_total", "year": 2025, "value": 10.0, "value_status": "estimated", "dataset_version": "26.1" }, { "country_code": "ng", "metric_key": "organized_violence_deaths_estimate", "year": 2025, "value": 4158.0, "estimate_low": 3548.0, "estimate_high": 4774.0, "value_status": "estimated", "dataset_version": "26.1" }, { "country_code": "ng", "metric_key": "state_based_conflict_dyads_total", "year": 2025, "value": 3.0, "value_status": "estimated", "dataset_version": "26.1" } ], "meta": { "total": 4, "limit": 4 } } ``` The request filters by country, year, and source; it does not pin a dataset version. Save the response and its `dataset_version` if you need to reproduce an analysis after a later source release. For `organized_violence_deaths_estimate`, `value` is UCDP's best estimate. Preserve `estimate_low` and `estimate_high` when uncertainty matters. Do not describe the best estimate as a reported exact death count. ## Important Scope Note Governance and conflict indicators are not the same thing as historical government records. Use [Government](/docs/government) for leaders and cabinets, [Elections](/docs/elections) for election events, and [Policies](/docs/policies) for policy documents and legal acts. Inspect the governance indicator catalog and coverage. Query annual governance observations and time series. Read selected governance indicators in country profiles. --- # Government URL: https://africa-api.com/docs/government Description: Query African government overviews, current leaders, historical terms, cabinet records, and related country government data. ## Government History In Africa API Government history is a separate domain from governance indicators. Query: - current heads of state and government - historical leadership terms - leader detail pages across countries - country-level government overviews - recent elections embedded into those country overviews - recent policy and law records plus policy-event summaries embedded into those country overviews Current sources: - `wikidata_government_history` - `wikidata_current_governments` Use: - `GET /v1/government/overview/{country_code}` - `GET /v1/government/leaders` - `GET /v1/government/leaders/{leader_wikidata_id}` - `GET /v1/government/terms` - `GET /v1/government/cabinet/{country_code}` - `GET /v1/government/cabinet-members` Related elections routes: - `GET /v1/elections` - `GET /v1/elections/country/{country_code}` - `GET /v1/elections/{election_wikidata_id}` - `GET /v1/elections/results/{election_wikidata_id}` ## Scope Note - [Governance](/docs/governance) covers annual institutional indicators like rule of law or corruption control. - `Government` covers leaders, terms of office, and current cabinet composition. - [Elections](/docs/elections) covers election events and candidate-level results. ## Country Overview Example ```bash curl "https://api.africa-api.com/v1/government/overview/ke" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Illustrative response shape. Values are examples, not a current government roster: ```json { "data": { "country": { "code": "ke", "name": "Kenya", "region": "East Africa" }, "current_head_of_state": { "leader_wikidata_id": "LEADER_WIKIDATA_ID", "leader_name": "William Ruto", "office_name": "President of Kenya", "role_type": "head_of_state", "start_date": "2022-09-13", "source": "wikidata_government_history" }, "current_head_of_government": { "leader_wikidata_id": "LEADER_WIKIDATA_ID", "leader_name": "William Ruto", "office_name": "President of Kenya", "role_type": "head_of_government", "start_date": "2022-09-13", "source": "wikidata_government_history" }, "cabinet_member_count": 3, "current_cabinet_members": [ { "statement_id": "STATEMENT_ID", "leader_wikidata_id": "LEADER_WIKIDATA_ID", "leader_name": "John Mbadi", "country_code": "ke", "country_name": "Kenya", "office_name": "Cabinet Secretary for National Treasury", "role_category": "minister", "party_name": "ODM", "start_date": "2024-08-08", "is_current": true, "source": "wikidata_current_governments", "source_url": "https://www.wikidata.org/wiki/LEADER_WIKIDATA_ID" } ], "recent_terms": [], "recent_elections": [] } } ``` ## Leader Search Example ```bash curl "https://api.africa-api.com/v1/government/leaders?q=ruto¤t_only=true&limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Historical Terms Example ```bash curl "https://api.africa-api.com/v1/government/terms?country_code=ng&role_type=head_of_state&start_date_from=2000-01-01&limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Current Cabinet Example ```bash curl "https://api.africa-api.com/v1/government/cabinet-members?country_code=ke¤t_only=true&limit=25" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## How It Fits The Rest Of The API Country profiles include current leaders, selected cabinet members, and the latest election when available. Use the [Elections](/docs/elections) and [Policies](/docs/policies) endpoints for event histories. Annual governance indicators are queryable through `/v1/data`. Read government records alongside selected indicators and trade data. Use the elections domain for country election timelines and result rows. Use the policies domain for laws, policy documents, and policy-event timelines. Use governance indicators for country-year institutional comparisons. Query annual governance indicators by country and year. --- # Health URL: https://africa-api.com/docs/health Description: Query African immunization, mortality, TB, child nutrition, and water and sanitation indicators from WHO and UNICEF. Available countries and years vary by metric. ## African Health Data API Query immunization, maternal and child mortality, tuberculosis, child nutrition, and water and sanitation indicators as historical series or latest available values. Health data comes from the WHO Global Health Observatory (`who_gho`) and UNICEF child welfare indicators (`unicef_child_welfare`). Check each indicator's coverage for available countries and years. Migrating health queries from `api.dataafrica.io`? See the [DataAfrica migration guide](/docs/dataafrica-api) for mappings and child nutrition coverage differences. ## Start With These Endpoints - `GET /v1/indicators?category=health` - `GET /v1/data?category=health` - `GET /v1/data?category=child_welfare` - `GET /v1/sources/who_gho` ## Available Health Metrics Health outcomes (WHO Global Health Observatory): - `dtp3_immunization_pct` — DTP3 coverage among one-year-olds - `measles_immunization_pct` — measles immunization coverage - `maternal_mortality_ratio` — deaths per 100,000 live births - `neonatal_mortality_rate` — deaths per 1,000 live births - `under_five_mortality_rate` — deaths per 1,000 live births - `tb_incidence_per_100k` — tuberculosis cases per 100,000 population Child nutrition and welfare (UNICEF): - `stunting_under5_pct` — stunting among children under 5 - `wasting_under5_pct` — wasting among children under 5 - `birth_registration_pct` — birth registration under age 5 - `child_marriage_women_20_24_pct` — women 20–24 married before age 18 Water and sanitation (UNICEF WASH): - `basic_drinking_water_pct` — basic drinking water services - `basic_sanitation_pct` — basic sanitation services ## Example: Latest Health Snapshot For One Country ```bash curl "https://api.africa-api.com/v1/data?country_code=ng&category=health&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example: Compare Child Stunting Across Countries ```bash curl "https://api.africa-api.com/v1/data?country_codes=et,ng,ke&metric_key=stunting_under5_pct&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example: Rank Countries By Under-Five Mortality ```bash curl "https://api.africa-api.com/v1/indicators/under_five_mortality_rate/rankings?year=2024&limit=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example: Immunization Time Series ```bash curl "https://api.africa-api.com/v1/data?country_code=ke&metric_key=dtp3_immunization_pct" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Common Health Data Questions ### Which countries have health data? Coverage varies by metric and reporting year. Start with `/v1/indicators?category=health`, then inspect an indicator's detail record for its available countries and years. UNICEF child nutrition metrics use the `child_welfare` category. ### Does Africa API have child malnutrition data? Yes. Stunting (`stunting_under5_pct`) and wasting (`wasting_under5_pct`) among children under 5 are available from UNICEF under the `child_welfare` category. Underweight prevalence specifically is not exposed yet; use [UNICEF data](https://data.unicef.org) directly if you need it. ### Where does the health data come from? WHO Global Health Observatory for health outcomes and UNICEF for child welfare, protection, and WASH indicators. Every observation carries its `source` field, and `/v1/sources/{source_code}` reports provenance and the latest successful refresh. ## Related Docs Inspect the health metric catalog, coverage, and rankings. Query latest health values or full time series. Read population structure and fertility metrics alongside health outcomes. Replace retired api.dataafrica.io health queries. --- # Humanitarian URL: https://africa-api.com/docs/humanitarian Description: Use UNHCR displacement signals in country snapshots and latest-value queries for refugee, asylum seeker, IDP, and stateless-population context. ## Current Humanitarian Context Africa API exposes UNHCR displacement totals through: - `GET /v1/countries/{country_code}/signals` - `GET /v1/data?metric_key=...&latest=true` This gives you official country-level humanitarian context without leaving the core API surface. ## Available Metrics - `refugees_hosted_total` - `asylum_seekers_hosted_total` - `idps_total` - `stateless_total` These figures come from the UNHCR Refugee Statistics API population dataset and are keyed to the country of asylum or reporting country. ## Example ```bash title="Request" curl "https://api.africa-api.com/v1/countries/ug/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Observation Example" { "metric_key": "refugees_hosted_total", "metric_name": "Refugees Hosted", "category": "humanitarian", "frequency": "annual", "year": 2025, "value": 1789456, "unit": "persons", "source": "unhcr_displacement_signals", "value_status": "reported", "freshness": "recent", "retrieved_at": "2026-03-13T18:00:00Z" } ``` ## Notes - These are official annual totals, so they usually show up as `recent` rather than `current` in signals. - Countries with no published UNHCR country row simply omit these metrics. - Use `/v1/data` if you want to pin a specific metric key or compare countries directly. --- # Indicators URL: https://africa-api.com/docs/indicators Description: Discover available metrics, inspect coverage, and request country rankings from Africa API. ## List Indicators Lists indicator definitions available through the public API. Filter by metric category such as demographics, economy, governance, climate, infrastructure, energy, health, education, or agriculture Filter to a specific source code such as `world_bank_wdi`, `who_gho`, `unesco_uis`, or `faostat_agriculture` Return only indicators that currently have observations ```bash title="Request" curl "https://api.africa-api.com/v1/indicators?category=health&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "key": "maternal_mortality_ratio", "name": "Maternal Mortality Ratio", "category": "health", "unit": "per_100k_live_births", "frequency": "annual", "has_data": true }, { "key": "under_five_mortality_rate", "name": "Under-Five Mortality Rate", "category": "health", "unit": "per_1000_live_births", "frequency": "annual", "has_data": true } ] } ``` Use the same `category` filter for other domains. The guides list metric keys and source-specific coverage: - [Agriculture](/docs/agriculture) - [Energy](/docs/energy) - [Governance and conflict](/docs/governance) - [Climate](/docs/climate) - [Transport and connectivity](/docs/transport) --- ## Get Indicator Detail Returns indicator metadata, source list, and coverage ranges. ```bash title="Request" curl "https://api.africa-api.com/v1/indicators/median_age_years" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": { "key": "median_age_years", "name": "Median Age", "description": "Median age of the total population, in years.", "category": "demographics", "unit": "years", "frequency": "annual", "sources": ["un_wpp"], "coverage": { "countries": 54, "min_year": 1950, "max_year": 2026 } } } ``` --- ## Get Indicator Rankings Returns a cross-country ranking for one metric and year. Target year Pin the ranking to one source Maximum items to return (1-100) `desc` for highest-first, `asc` for lowest-first ```bash title="Request" curl "https://api.africa-api.com/v1/indicators/gdp_current_usd/rankings" \ -G \ -d "year=2024" \ -d "limit=5" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": { "indicator": { "key": "gdp_current_usd", "name": "GDP (Current USD)", "unit": "usd" }, "year": 2024, "rankings": [ { "rank": 1, "country_code": "ng", "country_name": "Nigeria", "value": 363845000000, "source": "world_bank_wdi" }, { "rank": 2, "country_code": "za", "country_name": "South Africa", "value": 337512000000, "source": "world_bank_wdi" } ] } } ``` --- # Markets URL: https://africa-api.com/docs/markets Description: Query African exchanges, tickers, historical market data, and FX rates through Africa API. The 9 September 2026 audit found instrument and index observations for: - `CSE`: Casablanca, Morocco - `NGX`: Nigeria - `JSE`: South Africa, sourced through Yahoo Finance - `BRVM`: the regional West African exchange An exchange record does not establish populated or complete price coverage. History depth, fields and finality vary by instrument and observation. BRVM summary-page samples can be intraday. Index values are points. NGX also contains bonds and ETPs; request `instrument_type=EQUITY` when you need equities. FX is a separate dataset. Response examples below illustrate the schema; they are not live coverage counts or price quotes. FX sources include: - `fx_usd_daily` for broad USD-based daily rates across African currencies - `bot_tz_fx_rates` for official Bank of Tanzania-published TZS rates - `bkam_ma_fx_rates` for official Bank Al-Maghrib-published MAD rates for Morocco - `bceao_fx_rates` for official BCEAO-published XOF rates used across WAEMU countries - `beac_fx_rates` for official BEAC-published XAF rates used across CEMAC countries Current WAEMU official FX coverage applies to: - Benin - Burkina Faso - Côte d'Ivoire - Guinea-Bissau - Mali - Niger - Senegal - Togo Current CEMAC official FX coverage applies to: - Cameroon - Central African Republic - Chad - Congo - Equatorial Guinea - Gabon ## List Exchanges Returns exchange records with ticker counts and latest trade dates. Filter to one country Maximum rows to return (1-500) ```bash title="Request" curl "https://api.africa-api.com/v1/markets/exchanges" \ -G \ -d "country_code=ng" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "code": "NGX", "name": "Nigerian Exchange", "country_code": "ng", "currency": "NGN", "timezone": "Africa/Lagos", "primary_index_name": "NGX All-Share Index", "ticker_count": 189, "latest_trade_date": "2026-03-06" } ] } ``` --- ## List Tickers Returns exchange-backed instruments. Filter to one exchange, such as `NGX` or `JSE` Filter to one country Filter by type such as `EQUITY`, `INDEX`, `BOND`, or `ETP` Search by symbol or security name Maximum rows to return (1-500) ```bash title="Request" curl "https://api.africa-api.com/v1/markets/tickers" \ -G \ -d "exchange_code=JSE" \ -d "instrument_type=EQUITY" \ -d "limit=2" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "exchange_code": "JSE", "symbol": "AGL", "security_name": "Anglo American plc", "instrument_type": "EQUITY", "sector": "Basic Materials", "industry": "Metals & Mining", "country_code": "za", "latest_trade_date": "2026-03-06", "latest_close_price": 512.35, "latest_change_percent": 1.27 } ] } ``` --- ## Get Ticker Detail ```bash curl "https://api.africa-api.com/v1/markets/tickers/NGX/MTNN" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` --- ## Price units and observation status Original `close_price`, OHLC fields and `latest_close_price` remain unchanged for compatibility. Do not label them with the exchange currency or divide every JSE value by 100. Instrument history items and `latest_snapshot` include `price_metadata`; ticker-list items include `latest_price_metadata`. These objects may be absent on older API responses. | Metadata field | Meaning | | --- | --- | | `price_currency` | ISO currency for normalized prices, or null when unresolved | | `source_price_unit` | Unit reported by the source, such as `ZAc` | | `price_unit` | `minor_currency_unit`, `major_currency_unit`, `index_points` or `unknown` | | `price_scale` | Source-to-normalized multiplier, or null | | `normalized_open_price`, `normalized_high_price`, `normalized_low_price`, `normalized_close_price` | Normalized values where source evidence supports the unit; missing values remain null | | `price_basis` | `as_published` or `unknown`; not a corporate-action-adjusted series | | `observation_status` | `intraday`, `final` or `unknown` | | `source_url` | Source provenance where recorded | | `observed_at`, `retrieved_at` | Source observation and retrieval timestamps where recorded; either may be null | | `finality_reason` | Explanation of the available finality evidence, when supplied | For example, the audited JSE ABG observation for 8 September 2026 had a source value of 23,199 in `ZAc`. Its normalized value is ZAR 231.99 at scale 0.01. Index points and a source explicitly reporting ZAR use scale 1. Unknown-unit observations must remain explicitly unverified; absence of metadata does not justify a currency guess. `as_published` describes the retained source value, not a verified adjustment methodology. Do not combine unresolved or differently based prices to calculate returns. A successful fetch and a recent retrieval timestamp do not establish a final close. Index history uses `observation_metadata` for status, source and timestamps; its levels remain points and are never currency-scaled. The current contract does not supply complete corporate actions, dividends, financial statements or issuer disclosures. ## Get Ticker History ```bash curl "https://api.africa-api.com/v1/markets/tickers/NGX/MTNN/history" \ -G \ -d "start_date=2026-02-01" \ -d "end_date=2026-03-06" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` --- ## List Latest FX Rates Returns the latest known FX rates for the requested base currency. Official central-bank sources listed above may appear alongside the broader daily FX source, depending on the requested base currency. Check each row's `source_code` and `rate_date` before comparing or displaying rates. Base currency, default `USD` Comma-separated quote currencies Filter by associated country Maximum rows to return (1-500) ```bash title="Request" curl "https://api.africa-api.com/v1/markets/fx-rates" \ -G \ -d "base_currency=USD" \ -d "quote_currencies=NGN,ZAR,KES" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "source_code": "fx_usd_daily", "base_currency": "USD", "quote_currency": "NGN", "country_codes": ["ng"], "rate_date": "2026-03-07", "rate": 1538.12, "created_at": "2026-03-07T01:05:00Z" } ] } ``` --- ## Get FX History ```bash curl "https://api.africa-api.com/v1/markets/fx-rates/USD/NGN/history" \ -G \ -d "start_date=2026-02-01" \ -d "end_date=2026-03-07" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` --- # MCP Server URL: https://africa-api.com/docs/mcp Description: Configure the Africa API MCP server to query countries, indicators, markets, trade, elections, and policies from an AI client. The [`africa-api-mcp` package on npm](https://www.npmjs.com/package/africa-api-mcp) exposes read-only Africa API tools through [MCP](https://modelcontextprotocol.io). Use it to query country records, indicators, markets, trade and government data from a compatible AI client. Available countries, dates and fields vary by dataset; see [Coverage](/docs/coverage). The examples run the server locally with `npx`. Install Node.js and create an API key in the [dashboard](/dashboard) before connecting. Your client must support launching a local MCP process; `npx` may download the package on first use. ## Connect your client Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows): ```json { "mcpServers": { "africa-api": { "command": "npx", "args": ["-y", "africa-api-mcp"], "env": { "AFRICA_API_KEY": "your-api-key-here" } } } } ``` Restart Claude Desktop, then check that Africa API appears in its connected tools. Follow any approval steps shown by the client. One command: ```bash claude mcp add africa-api -e AFRICA_API_KEY=your-api-key-here -- npx -y africa-api-mcp ``` Add the same server definition to `.cursor/mcp.json` in your project (or the global Cursor MCP settings): ```json { "mcpServers": { "africa-api": { "command": "npx", "args": ["-y", "africa-api-mcp"], "env": { "AFRICA_API_KEY": "your-api-key-here" } } } } ``` One command (Copilot agent mode): ```bash code --add-mcp '{"name":"africa-api","command":"npx","args":["-y","africa-api-mcp"],"env":{"AFRICA_API_KEY":"your-api-key-here"}}' ``` For another client that supports local MCP processes, configure the `npx -y africa-api-mcp` command and the `AFRICA_API_KEY` environment variable. The configuration format depends on the client. ## What the tools cover | Domain | Queries | |--------|---------| | Countries | Country records, profiles and signals | | Indicators & data | Indicator discovery, time series and country rankings | | Government | Heads of state, cabinets and leadership terms | | Elections | Results, scheduled elections and country election overviews | | Markets | Exchanges, index levels, tickers, price history and FX rates | | Trade | Bilateral flows, top partners and product breakdowns | | Policies | Laws, regulations, policy timelines and lifecycle events | | Sources & platform | Source metadata and platform information | | Geographies | Continent, region and subregion hierarchy | The tools are read-only and declare MCP safety annotations. Approval behavior depends on your client and its settings. ## What you can ask once connected - "Compare GDP for Nigeria and South Africa over the last 10 years." - "Show current FX rates for East African currencies." - "Who is Kenya's head of state and when did they take office?" - "Which African elections are coming up this year?" - "Rank African countries by under-five mortality." - "What are Nigeria's top export products?" ## For agents reading this programmatically - Condensed docs index: [/llms.txt](/llms.txt) - Full docs as plain text: [/llms-full.txt](/llms-full.txt) - OpenAPI schema: `https://api.africa-api.com/openapi.json` - Base URL: `https://api.africa-api.com/v1` with `Authorization: Bearer` auth ([authentication guide](/docs/authentication)) ## Related docs Create an API key and make a first request. Client patterns for JavaScript, TypeScript, and Python. Safe client behavior, retries, and caching guidance. Country and source coverage by topic. --- # Platform URL: https://africa-api.com/docs/platform Description: Inspect release identity, source freshness, and data quality when you need operational visibility. ## Version Returns the live project name and release SHA currently serving requests. No authentication required. ```bash title="Request" curl "https://api.africa-api.com/v1/platform/version" ``` ```json title="Response" { "data": { "status": "ok", "project_name": "Africa API", "release_sha": "CURRENT_RELEASE_SHA" } } ``` --- ## Source Status Returns refresh status for active data sources, including last success, next scheduled run, dataset version, and latest write counts. Requires an API key. ```bash title="Request" curl "https://api.africa-api.com/v1/platform/etl-status" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "source": "world_bank_wdi", "status": "healthy", "last_success_at": "2026-03-07T12:10:14Z", "next_run_at": "2026-03-08T00:10:14Z", "dataset_version": "wbwdi-1960-2025", "records_written_last_run": 31096 } ] } ``` --- ## Data Quality Returns source-level quality and freshness evaluations used to monitor the data platform. This endpoint exposes: - freshness status - quality status - last and previous write counts - country coverage for country-level sources - active quality rules - anomaly messages when a source looks suspicious Requires an API key. ```bash title="Request" curl "https://api.africa-api.com/v1/platform/data-quality" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "source": "world_bank_wdi", "freshness_status": "healthy", "quality_status": "healthy", "last_success_at": "2026-03-08T17:42:30Z", "next_run_at": "2026-03-09T05:42:30Z", "dataset_version": "wbwdi-1960-2025", "records_written_last_run": 52128, "previous_records_written": 37718, "country_coverage_last_run": 54, "anomalies": [], "rules": { "min_records": 30000, "drop_ratio_threshold": 0.4, "min_country_coverage": 45, "stale_after_minutes": 1080 } } ] } ``` --- # Policies URL: https://africa-api.com/docs/policies Description: Query African laws, policy documents, and lifecycle events from Wikidata, with country overviews and timelines where records are available. ## African Policy Data API Query laws, policy documents, and lifecycle events from `wikidata_policies`. Use the country overview for a summary, the policy list for filtering, and the timeline routes for adoption, implementation, and repeal events. Available records vary by country. Use: - `GET /v1/policies` - `GET /v1/policies/events` - `GET /v1/policies/country/{country_code}` - `GET /v1/policies/country/{country_code}/timeline` - `GET /v1/policies/{policy_wikidata_id}` - `GET /v1/policies/{policy_wikidata_id}/events` ## What This Covers Record types and fields include: - constitutions - laws and acts - regulations and decrees - national strategies and policy documents - policy adoption, implementation, and repeal timelines - issuing-body metadata when available ## Country Policy Overview Example ```bash curl "https://api.africa-api.com/v1/policies/country/ke?top_limit=5" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Illustrative response shape. Values are examples, not a current policy inventory: ```json { "data": { "country": { "code": "ke", "name": "Kenya", "region": "East Africa" }, "latest_policy": { "wikidata_id": "POLICY_WIKIDATA_ID", "country_code": "ke", "country_name": "Kenya", "title": "POLICY_TITLE", "document_type": "law", "policy_status": "active", "published_at": null, "source": "wikidata_policies" }, "active_policy_count": 14, "recent_policies": [] } } ``` ## Policy List Example ```bash curl "https://api.africa-api.com/v1/policies?country_code=ng&document_type=law&status=active&limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Policy Detail Example ```bash curl "https://api.africa-api.com/v1/policies/Q104901625" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Country Policy Timeline Example ```bash curl "https://api.africa-api.com/v1/policies/country/ke/timeline?top_limit=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Illustrative response shape. The event shows the field structure, not a current country timeline: ```json { "data": { "country": { "code": "ke", "name": "Kenya", "region": "East Africa" }, "latest_event": { "event_key": "POLICY_WIKIDATA_ID:EVENT_TYPE:EVENT_DATE", "policy_wikidata_id": "POLICY_WIKIDATA_ID", "title": "POLICY_TITLE", "document_type": "law", "event_type": "implemented", "event_date": "2016-06-01", "summary": "Kenya Climate Change Act entered into force", "source": "wikidata_policies" }, "recent_events": [] } } ``` ## Policy Events Example ```bash curl "https://api.africa-api.com/v1/policies/events?country_code=ng&event_type=adopted&limit=20" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## How It Fits The Government Domain - [Government](/docs/government) covers leaders, terms, and cabinets - [Elections](/docs/elections) covers election events and result rows - country profiles include the latest available policy and policy event inside the `government` block Use government history for leaders, offices, cabinet composition, and state structure. Use elections for event timelines and candidate-level results. Read policy and policy-event summaries in country profiles when available. --- # Power URL: https://africa-api.com/docs/power Description: Query the latest available grid-generation and outage observations for Nigeria and South Africa, alongside historical energy indicators. ## Current Power Signals Use the energy indicators for historical trends and the country signals endpoint for the latest available grid and outage observations. Reporting periods vary by source. Use the regular indicator/data endpoints for: - electricity access - energy consumption - renewable energy share - grid efficiency and losses Use `/v1/countries/{country_code}/signals` for available observations such as: - load shedding stage - energy availability factor - peak and off-peak grid generation - peak and off-peak grid frequency - daily energy generated - daily energy sent out - unplanned generation outages - planned maintenance ## Country and metric coverage - Nigeria - `peak_grid_generation_mw` - `peak_grid_frequency_hz` - `off_peak_grid_generation_mw` - `off_peak_grid_frequency_hz` - `daily_energy_generated_mwh` - `daily_energy_sent_out_mwh` - South Africa - `load_shedding_stage` - `energy_availability_factor_pct` - `unplanned_generation_outages_mw` - `planned_generation_maintenance_mw` ## Example ```bash title="Nigeria Signals" curl "https://api.africa-api.com/v1/countries/ng/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash title="South Africa Signals" curl "https://api.africa-api.com/v1/countries/za/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Reporting periods Check each observation's source and `as_of_period` before displaying grid conditions. A latest available statement may describe an earlier day. Use `/v1/data` for annual energy series. See how current power-system data appears in the country snapshot payload. Use the broader energy indicator guide for annual and structural metrics. --- # Quickstart URL: https://africa-api.com/docs/quickstart Description: Create an API key and make your first authenticated request for African country data. Create an API key, then request Nigeria's country signals. The examples below use a shell with `curl`. ### Create an API key Open the [dashboard](https://africa-api.com/dashboard), create an account or sign in, then generate an API key. ### Export your API key ```bash export AFRICA_API_KEY="your_api_key_here" ``` ### Fetch a country snapshot ```bash curl "https://api.africa-api.com/v1/countries/ng/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The response combines available observations for Nigeria. Check the observation dates: sources update on different schedules. [Coverage](/docs/coverage) lists the topics available by country. ### Query one indicator Use `/v1/data` when you need a specific metric. This request asks for the latest available population observation for Kenya: ```bash 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; it does not imply a measurement from today. See [Data](/docs/data) for year filters and time-series queries. Data routes require an API key. Keep production keys on your server and out of public client-side code. See [Authentication](/docs/authentication). ## Try another route For reference fields such as a country's name and codes: ```bash curl "https://api.africa-api.com/v1/countries/ng" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` For a country trade overview: ```bash curl "https://api.africa-api.com/v1/trade/overview/ng?top_limit=5" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Handle errors and quotas A missing or invalid key returns `401`. A `429` can mean a per-minute limit or an exhausted monthly quota; the retry behavior differs. See [Errors](/docs/errors) and [Rate limits](/docs/rate-limits). Reuse request and authentication code in JavaScript, TypeScript or Python. Find metric keys and inspect available coverage. Check provenance and the latest source refresh. --- # Rate Limits URL: https://africa-api.com/docs/rate-limits Description: Per-plan request quotas, 429 behavior, and client patterns for retries, batching, and caching on the Africa API. Your plan sets a **monthly request quota** and a **per-minute rate limit**, shared across the account's API keys. Exceeding either limit returns `429 Too Many Requests`. ## Plan Limits | Plan | Monthly requests | Per minute | API keys | | --- | --- | --- | --- | | **Free** | 1,000 | 5 | 1 | | **Analyst** | 250,000 | 60 | 3 | | **Team** | 2,000,000 | 1,000 | 5 | Monthly counters reset on the first of each calendar month in UTC. Per-minute limits use fixed minute windows. Plans have the same data and endpoint access. See [pricing](/pricing) for plan details, and manage billing in the [dashboard](/dashboard). ## What a 429 Looks Like The response body tells you which limit you hit: ```json { "detail": "rate limit exceeded for plan 'free' (5 requests/minute)" } ``` ```json { "detail": "This request was blocked because the monthly request limit for Free (1,000 requests) was reached. Upgrade to Analyst: https://africa-api.com/dashboard?section=billing" } ``` - **Per-minute 429:** back off and retry after the next minute window begins. - **Monthly 429:** wait for the counter to reset on the 1st, or choose a plan with a quota above your current usage. Retrying does not restore quota. Responses do not currently include `X-RateLimit-*` or `Retry-After` headers. Check monthly usage in the [dashboard](/dashboard), and inspect the `detail` string to distinguish the two limit errors. ## Recommended Client Controls 1. Set explicit request timeouts. 2. Retry transient failures (`429` per-minute, `5xx`) with backoff. Stop retrying when the monthly quota is exhausted. 3. Batch related observations into one `/v1/data` call instead of many single-resource requests. 4. Cache `GET /v1/countries` using `ETag` and `Cache-Control`. 5. Avoid request spikes when hydrating dashboards. ## Retry Template (JavaScript) ```javascript async function requestWithBackoff(url, init, maxAttempts = 4) { let delayMs = 300; for (let attempt = 1; attempt <= maxAttempts; attempt++) { const response = await fetch(url, init); if (response.ok) return response; let retryable = response.status >= 500; if (response.status === 429) { const body = await response.clone().json().catch(() => null); // Monthly quota 429s won't clear on retry; return them to the caller. retryable = !body?.detail?.includes("monthly request limit"); } if (!retryable || attempt === maxAttempts) return response; await new Promise((resolve) => setTimeout(resolve, delayMs + Math.random() * 200)); delayMs *= 2; } } ``` ## Query Design Tips Make each request count against your quota: - Prefer `country_codes=ng,ke,za` over three separate requests. - Prefer `metric_keys=population_total,gdp_current_usd` where a combined response is acceptable. - Use `latest=true` when you do not need a full time series. - One `/v1/countries/{code}/signals` call replaces several single-domain requests when you need a country snapshot. --- # SDKs URL: https://africa-api.com/docs/sdks Description: HTTP client examples for calling Africa API from JavaScript, TypeScript, and Python. The examples below use HTTP requests directly. Keep these calls in a small shared client to reuse authentication and error handling. ## MCP Server for AI Tools For an AI assistant, the [`africa-api-mcp`](https://www.npmjs.com/package/africa-api-mcp) server exposes read-only API tools. See the [MCP server guide](/docs/mcp) for client configuration and runtime requirements. ## Client Patterns ```typescript const BASE_URL = "https://api.africa-api.com"; async function africaRequest(path: string): Promise { const response = await fetch(`${BASE_URL}${path}`, { headers: { Authorization: `Bearer ${process.env.AFRICA_API_KEY ?? ""}`, }, }); if (!response.ok) { throw new Error(`Africa API request failed: ${response.status}`); } return response.json() as Promise; } export function listIndicators(category?: string) { const suffix = category ? `?category=${encodeURIComponent(category)}` : ""; return africaRequest<{ data: Array<{ key: string; name: string }> }>( `/v1/indicators${suffix}`, ); } export function listData(countryCode: string, metricKey: string) { return africaRequest(`/v1/data?country_code=${countryCode}&metric_key=${metricKey}&latest=true`); } ``` ```python import requests BASE_URL = "https://api.africa-api.com" def africa_request(path: str, api_key: str) -> dict: response = requests.get( f"{BASE_URL}{path}", headers={"Authorization": f"Bearer {api_key}"}, timeout=10, ) response.raise_for_status() return response.json() def list_indicators(api_key: str, category: str | None = None) -> dict: suffix = f"?category={category}" if category else "" return africa_request(f"/v1/indicators{suffix}", api_key) def list_data(api_key: str, country_code: str, metric_key: str) -> dict: return africa_request( f"/v1/data?country_code={country_code}&metric_key={metric_key}&latest=true", api_key, ) ``` ## OpenAPI Schema If you prefer generated clients: ```text https://api.africa-api.com/openapi.json ``` Pin generated clients to the `/v1` routes you actually use. --- # Signals URL: https://africa-api.com/docs/signals Description: Query selected latest observations, exchange rates, commodity benchmarks, alerts, trade summaries, and government records for one country. Coverage and reporting periods vary by source. ## Country Signals Returns selected latest observations and records for one country. Available fields depend on country and source coverage. | Field | Contents when available | | --- | --- | | `observations` | Selected indicators, local prices, grid conditions, airport and port statistics, weather estimates, and displacement totals | | `disaster_alerts` | Country-linked events reported by GDACS | | `fx_rates` | Exchange rates tied to the country | | `commodity_benchmarks` | Global reference prices | | `market_snapshots` | Exchange-level market observations | | `trade` | Trade summaries | | `government` | Selected government records | Records can describe different reporting periods, from daily weather estimates to annual indicators. Check `frequency`, `as_of_period`, and `freshness` before comparing them. An `as_of_period` can identify a month, date, or date range. Location-specific observations include `location_name`. Requires an API key. ISO alpha-2 code such as `ng`, `ke`, `za` ```bash title="Request" curl "https://api.africa-api.com/v1/countries/ke/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The following excerpt illustrates selected response fields. Its values and freshness labels are examples, not a current country snapshot. ```json title="Illustrative response excerpt" { "data": { "country": { "code": "ke", "name": "Kenya", "capital": "Nairobi", "region": "East Africa" }, "observations": [ { "metric_key": "inflation_cpi_latest_yoy_pct", "name": "Inflation (Latest YoY)", "value": 4.8, "unit": "percent", "frequency": "monthly", "source": "cbk_ke_signals", "freshness": "current", "as_of_period": "2026-01", "retrieved_at": "2026-03-09T18:00:00Z" } ], "fx_rates": [ { "base_currency": "USD", "quote_currency": "KES", "rate": 129.44, "date": "2026-03-08", "source": "fx_usd_daily", "freshness": "current" } ], "generated_at": "2026-03-09T18:00:00Z" } } ``` --- ## Country and source coverage This table summarizes the documented source families. It does not report source health or the age of returned observations. Check the source metadata and reporting period for the data you use. See [Coverage](/docs/coverage) for the broader catalog. | Country or scope | Macro | Prices | Power | Airports | Ports | Climate | Risk context | | --- | --- | --- | --- | --- | --- | --- | --- | | Kenya | Yes | Fuel and maize | - | - | Yes | Yes | GDACS and UNHCR when present | | Morocco | Yes | - | - | - | - | Annual indicators where available | GDACS and UNHCR when present | | Namibia | Yes | - | - | - | - | Annual indicators where available | GDACS and UNHCR when present | | Nigeria | Yes | - | Yes | - | - | Yes | GDACS and UNHCR when present | | South Africa | Yes | Fuel | Yes | Yes | Yes | Yes | GDACS and UNHCR when present | | Tanzania | Yes | - | - | - | - | Yes | GDACS and UNHCR when present | | Tunisia | Yes | - | - | - | - | Yes | GDACS and UNHCR when present | | WAEMU countries | BCEAO policy rates | - | - | - | - | Annual indicators where available | GDACS and UNHCR when present | | CEMAC countries | BEAC policy rates | - | - | - | - | Annual indicators where available | GDACS and UNHCR when present | ## South Africa example ```bash title="South Africa Signals" curl "https://api.africa-api.com/v1/countries/za/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The following example shows selected fields inside the response's `data` object. Its values are illustrative and describe different reporting periods. ```json title="Illustrative selected fields" { "country": { "code": "za", "name": "South Africa", "capital": "Pretoria", "region": "Southern Africa" }, "observations": [ { "metric_key": "policy_rate_pct", "value": 7.5, "unit": "percent", "frequency": "ad_hoc", "source": "sarb_za_signals", "as_of_period": "2026-01-30" }, { "metric_key": "petrol_price_local_per_liter", "value": 20.3, "unit": "local_currency_per_liter", "frequency": "monthly", "source": "dmre_za_fuel_signals", "as_of_period": "2026-03", "location_name": "Gauteng Zone 9C" }, { "metric_key": "load_shedding_stage", "value": 0, "unit": "stage", "frequency": "ad_hoc", "source": "eskom_za_grid_signals", "as_of_period": "2026-03-12" }, { "metric_key": "airport_passengers_ytd_total", "value": 34282784, "unit": "passengers", "frequency": "monthly", "source": "acsa_za_airport_signals", "as_of_period": "2026-01" }, { "metric_key": "airport_on_time_performance_latest_month_pct", "value": 90.66, "unit": "percent", "frequency": "monthly", "source": "acsa_za_on_time_performance_signals", "as_of_period": "2026-02" }, { "metric_key": "port_container_throughput_latest_teu", "value": 373644, "unit": "teu", "frequency": "monthly", "source": "tnpa_za_port_signals", "as_of_period": "2025-06" }, { "metric_key": "precipitation_7d_mm", "value": 9.1, "unit": "millimeters", "frequency": "ad_hoc", "source": "nasa_power_climate_signals", "as_of_period": "2026-03-05 to 2026-03-11" } ], "fx_rates": [ { "base_currency": "USD", "quote_currency": "ZAR", "rate": 15.58, "date": "2026-03-14", "source": "fx_usd_daily" } ], "market_snapshots": [ { "exchange_code": "JSE", "latest_trade_date": "2026-03-14", "source": "jse_yahoo_eod" } ], "trade": { "latest_year": 2024, "granular_latest_year": 2024 }, "government": { "current_head_of_state": { "leader_name": "Cyril Ramaphosa", "role_type": "head_of_state" } } } ``` --- ## Choose between signals and data Use `/v1/countries/{country_code}/signals` for selected observations and records in one request. Use `/v1/data` for time series, multi-country comparisons, specific metric queries, and source filtering. Example for a latest monthly signal through the canonical observation endpoint: ```bash title="Latest Monthly Signal Via /v1/data" curl "https://api.africa-api.com/v1/data?country_code=ke&metric_key=inflation_cpi_latest_yoy_pct&latest=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Freshness Model Each signal carries a simple freshness label: - `current` - `recent` - `historical` The label is derived from frequency, year, retrieval time, or the market/FX trade date. It does not mean every value describes the same reporting period. Use the date and source fields alongside the freshness label. Retrieval time records when data was collected; it is not necessarily the source publication date. For selected latest-signal metrics, `/signals` prefers an available country-specific central-bank source over a broader monthly feed. Check the returned `source` field to identify the dataset used. Some price observations are local or market-specific rather than national. Kenya fuel prices reflect the official EPRA Nairobi notice, South Africa fuel prices reflect the official DMRE Gauteng reference zone and national paraffin retail cap, and Kenya food prices reflect the latest World Bank Kenya market estimates. These carry `location_name` and other source context so clients can label them accurately. Grid and transport observations have source-specific geographic scopes and publication cadences. South Africa power-system signals come from Eskom’s power status updates, Nigeria power-system signals come from NISO’s daily grid statement, South Africa airport traffic and on-time performance come from ACSA’s monthly operational statistics, and South Africa port operations come from TNPA’s monthly national port statistics. Kenya port observations come from KPA annual Port of Mombasa performance totals. See [Transport](/docs/transport) for reporting-period and geographic details. NASA POWER temperature, humidity, and rolling rainfall values are point-based estimates. They should not be presented as annual national climate indicators. Check `as_of_period` for the dates represented. GDACS disaster alerts describe country-linked events, including floods, cyclones, earthquakes, wildfires, and volcanic events. Check each alert's event dates and source links. UNHCR displacement observations are annual totals and may describe an earlier year. Commodity benchmarks are global reference prices, not local retail or domestic producer prices. --- # Sources URL: https://africa-api.com/docs/sources Description: Inspect source metadata, licensing context, citations, and the latest successful refresh for a dataset. ## List Sources Lists the sources currently available through the public API. ```bash title="Request" curl "https://api.africa-api.com/v1/sources" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": [ { "code": "world_bank_wdi", "name": "World Development Indicators", "organization": "World Bank" }, { "code": "who_gho", "name": "Global Health Observatory", "organization": "World Health Organization" }, { "code": "unesco_uis", "name": "UIS Education Statistics", "organization": "UNESCO Institute for Statistics" }, { "code": "ucdp_organized_violence", "name": "UCDP Organized Violence", "organization": "Uppsala Conflict Data Program" } ] } ``` The UCDP source uses the official versioned Country-Year archive and is licensed under CC BY 4.0. See [Governance And Conflict](/docs/governance) for the four available metrics, a production response example, and guidance on uncertainty bounds. --- ## Get Source Detail Returns source metadata and the latest successful refresh. Use source detail when licensing, provenance, or freshness matters to your integration. ```bash title="Request" curl "https://api.africa-api.com/v1/sources/un_wpp" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```json title="Response" { "data": { "code": "un_wpp", "name": "World Population Prospects", "organization": "United Nations", "dataset_url": "https://population.un.org/wpp", "license_name": null, "citation": null, "latest_run": { "status": "succeeded", "dataset_version": "unwpp-1950-2026", "records_written": 45738, "completed_at": "2026-03-07T13:10:58Z" } } } ``` --- # Status URL: https://africa-api.com/docs/status Description: Check Africa API platform status, health, and release identity before making protected API calls. ## Platform Health Returns the current platform status and deployed release SHA. No authentication required. No query parameters. Use it for uptime checks, deployment verification, and incident triage. ```bash title="Request" curl "https://api.africa-api.com/health" ``` ```json title="Response · 200" { "status": "ok", "release_sha": "CURRENT_RELEASE_SHA" } ``` --- # Trade URL: https://africa-api.com/docs/trade Description: Use the dedicated trade domain for African trade overviews, partner data, product data, and trade flows, with aggregate trade metrics also available through shared data endpoints. ## Trade Domain In Africa API Query country trade summaries, partner totals, and product composition through the trade endpoints. Trade sources include: - aggregate trade indicators from `world_bank_wdi` - granular partner/product trade flows from `un_comtrade` The partner and product data covers: - bilateral all-commodity partner totals - world-level HS chapter product composition Use: - `GET /v1/trade/overview/{country_code}` - `GET /v1/trade/flows` - `GET /v1/trade/partners` - `GET /v1/trade/products` For aggregate trade indicators, use: - `GET /v1/indicators?category=economy` - `GET /v1/data?metric_key=trade_balance_usd` - `GET /v1/data?metric_key=exports_goods_services_usd` - `GET /v1/countries/{country_code}/profile` Country profiles include a trade section with: - `latest_snapshot` - `granular_latest_year` - top export/import partners - top export/import products ## Useful Metrics - `exports_goods_services_usd` - `imports_goods_services_usd` - `exports_goods_services_pct_gdp` - `imports_goods_services_pct_gdp` - `trade_balance_usd` - `current_account_balance_pct_gdp` ## Overview Example ```bash curl "https://api.africa-api.com/v1/trade/overview/ng?start_year=2020&end_year=2024&top_limit=5" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` The overview response includes: - yearly aggregate series - `latest_snapshot` - `granular_latest_year` - `granular_years` - `top_export_partners` - `top_import_partners` - `top_export_products` - `top_import_products` Start with `/v1/trade/overview/{country_code}` when you need aggregate series and leading partners or products in one response. ## Partner Query Example ```bash curl "https://api.africa-api.com/v1/trade/partners?reporter_country_code=ng&flow_type=export&year=2024&limit=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Product Query Example ```bash curl "https://api.africa-api.com/v1/trade/products?reporter_country_code=ng&flow_type=import&start_year=2020&end_year=2024&limit=10" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Example Queries ```bash curl "https://api.africa-api.com/v1/data?country_codes=ng,ke,za&metric_key=trade_balance_usd&year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_code=eg&metric_key=exports_goods_services_pct_gdp&start_year=2018&end_year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Read country overviews, partner totals, and product composition. Inspect available trade metrics and coverage. Query latest trade aggregates or full time series. Read trade summaries alongside country indicators and government records. --- # Transport URL: https://africa-api.com/docs/transport Description: Query historical transport and connectivity indicators, plus airport and port observations for South Africa and port observations for Kenya. ## Transport And Connectivity In Africa API Transport and connectivity data is exposed through the shared indicator, data, and signals endpoints. Sources include World Bank WDI, South Africa's ACSA airport statistics and TNPA port statistics, and Kenya Ports Authority port statistics. - `GET /v1/indicators?category=infrastructure` - `GET /v1/data?category=infrastructure` - `GET /v1/sources/world_bank_wdi` - `GET /v1/sources/acsa_za_airport_signals` - `GET /v1/sources/acsa_za_on_time_performance_signals` - `GET /v1/sources/kpa_ke_port_signals` - `GET /v1/countries/{country_code}/signals` - `GET /v1/sources/tnpa_za_port_signals` ## Historical Transport Metrics - `air_transport_passengers` - `air_transport_departures` - `liner_shipping_connectivity_index` - `rail_lines_km` - `road_network_total_km` - `paved_roads_pct` - `mobile_subscriptions_per_100` - `fixed_broadband_subscriptions_per_100` - `secure_internet_servers_per_million` These are annual country-level observations. Check the indicator catalog for available countries and years. ## Current Airport And Port Operations South Africa's ACSA airport traffic, ACSA network on-time performance, and TNPA port observations are available through `/v1/countries/za/signals`. Kenya's KPA port observations are available through `/v1/countries/ke/signals`. - `airport_passengers_ytd_total` - `airport_aircraft_movements_ytd_total` - `airport_on_time_performance_ytd_pct` - `airport_on_time_performance_latest_month_pct` - `port_throughput_latest_tonnes` - `port_container_throughput_latest_teu` - `port_transit_cargo_latest_tonnes` - `port_vessel_calls_latest_total` The sources cover different locations and reporting periods: | Source | Geographic scope | Reporting period | | --- | --- | --- | | ACSA airport traffic | ACSA airport network | Year-to-date totals through the latest published month | | ACSA on-time performance | ACSA airport network | Latest published monthly and year-to-date percentages | | TNPA port operations | South Africa's national port system | Published monthly totals | | KPA port operations | Port of Mombasa | Annual performance totals from the Kenya Ports Authority cargo-growth article | Read each observation's `as_of_period` for the period represented. These publications may describe different months or years. ## Example Queries ```bash curl "https://api.africa-api.com/v1/indicators?category=infrastructure&has_data=true" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_codes=eg,ke,za&metric_key=air_transport_passengers&year=2023" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/data?country_code=ng&metric_key=mobile_subscriptions_per_100&start_year=2018&end_year=2024" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ```bash curl "https://api.africa-api.com/v1/countries/za/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` Inspect available transport and connectivity metrics. Query latest values or full time series. Read selected transport and connectivity indicators in country profiles. See how current airport and port operations appear in the country snapshot payload. --- # World Bank API vs Africa API: Which One for African Data? URL: https://africa-api.com/docs/world-bank-api-vs-africa-api Description: Compare World Bank API and Africa API queries, geographic coverage, source selection, authentication, and refresh information. Use the World Bank API when you need its development indicators across countries worldwide. Africa API combines selected World Bank series for African countries with other datasets, including markets, trade and government records. Start with the metric and geography your application needs. Africa API does not ingest every World Bank database or series; use [indicator discovery](/docs/indicators) to check what is available. Africa API is not affiliated with the World Bank. WDI-derived observations use `world_bank_wdi` in the `source` field. Check that field when you need a particular upstream dataset. ## Side-by-side comparison | | World Bank API | Africa API | |---|---|---| | Geographic scope | Economies worldwide | African countries; observations vary by metric and country | | Core content | Development indicators from WDI and other World Bank databases | Selected indicators plus country signals, markets, FX, trade, elections, policies and government records | | Update cadence | Depends on the series and its revisions | Depends on the source; check observation dates and source refresh records | | Authentication | None required | Bearer API key (free to create) | | Response format | JSON or XML, page-based pagination | JSON; query parameters and schemas are documented per route | | Country identifiers | ISO3 codes and World Bank region codes | ISO2 codes plus a geography hierarchy (`/v1/geographies`) | | Provenance | See the selected World Bank database and indicator metadata | Observation `source` field and `/v1/sources/*` refresh reporting | | Cost | Free | Free tier; paid plans for higher volume | ## When to use the World Bank API directly - You need indicators for countries outside Africa in the same workflow. - You need a specific World Bank database (IDS debt statistics, Doing Business archives) that Africa API does not ingest. - You cannot manage an API key and only need annual macro series. A typical World Bank request looks like: ```text GET https://api.worldbank.org/v2/country/zmb/indicator/NY.GDP.MKTP.CD?format=json ``` ## When to query Africa API - Your application combines African country records and indicators with other Africa API datasets. - You need a supported exchange, FX series, fuel-price observation, grid signal, disaster alert or government record. Check [Coverage](/docs/coverage) for the countries and sources included. - You want to discover metrics through `/v1/indicators`, request country rankings, or fetch a country profile. To request the WDI-derived GDP series for Zambia: ```bash curl "https://api.africa-api.com/v1/data?country_code=zm&metric_key=gdp_current_usd&source=world_bank_wdi" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` To inspect other available observations in a country snapshot: ```bash curl "https://api.africa-api.com/v1/countries/zm/signals" \ -H "Authorization: Bearer $AFRICA_API_KEY" ``` ## Source selection and freshness A WDI-derived series in Africa API identifies its source as `world_bank_wdi`. Pin it with `source=world_bank_wdi` when comparing the two APIs: without a source filter, Africa API applies its default source preference where providers overlap. Compare the metric definition, unit, country and observation year as well as the value. Africa API's latest ingestion can differ from the World Bank's latest revision. `/v1/sources/world_bank_wdi` reports the latest successful refresh; it does not establish that every series is complete. You can use both APIs in one application, for example Africa API for a supported country snapshot and the World Bank API for a global comparison. That requires handling both response formats and checking that the series definitions match. ## Related docs The canonical /v1/data endpoint for indicators and time series. Provenance, licensing context, and per-source freshness. Country and source coverage by topic. Available observations grouped into a country snapshot.