Guides
Trade
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
Africa API has a dedicated trade surface for country-level trade analysis.
Trade coverage currently comes from two layers:
- aggregate trade indicators from
world_bank_wdi - granular partner/product trade flows from
un_comtrade
Granular trade coverage 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 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
For most applications, /v1/trade/overview/{country_code} should be the first call.
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.