Guides
Trade
Use the dedicated trade domain for overview, partner, product, and flow queries, with aggregate trade metrics also available through the shared data endpoints.
Trade Domain In Africa API
Africa API now has a dedicated trade surface for country-level trade analysis.
Current trade data comes from two layers:
- aggregate trade indicators from
world_bank_wdi - granular partner/product trade flows from
un_comtrade
The granular un_comtrade source currently stores:
- bilateral all-commodity partner totals
- world-level HS chapter product composition
Use:
GET /v1/trade/overview/{country_code}GET /v1/trade/flowsGET /v1/trade/partnersGET /v1/trade/products
The existing shared observation layer still exposes trade aggregates through:
Use:
GET /v1/indicators?category=economyGET /v1/data?metric_key=trade_balance_usdGET /v1/data?metric_key=exports_goods_services_usdGET /v1/countries/{country_code}/profile
Country profiles now embed a compact trade section with:
latest_snapshotgranular_latest_year- top export/import partners
- top export/import products
Useful Metrics
exports_goods_services_usdimports_goods_services_usdexports_goods_services_pct_gdpimports_goods_services_pct_gdptrade_balance_usdcurrent_account_balance_pct_gdp
Overview Example
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 now includes:
- yearly aggregate series
latest_snapshotgranular_latest_yeargranular_yearstop_export_partnerstop_import_partnerstop_export_productstop_import_products
That makes /v1/trade/overview/{country_code} the best first call for building a country trade panel.
Partner Query Example
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
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
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"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"Trade Overview
Start with the dedicated trade domain for country-level overview and future partner or product analysis.
Indicators
Inspect available trade metrics and coverage.
Data
Query latest trade aggregates or full time series.
Countries
Use country profiles to blend trade with the rest of the platform.