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/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

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

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"

On this page