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
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/flowsGET /v1/trade/partnersGET /v1/trade/products
For aggregate trade indicators, 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 include a 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 includes:
- yearly aggregate series
latest_snapshotgranular_latest_yeargranular_yearstop_export_partnerstop_import_partnerstop_export_productstop_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
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"