africaAPI

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/flows
  • GET /v1/trade/partners
  • GET /v1/trade/products

The shared observation layer still exposes trade aggregates through:

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 now embed a compact 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 now includes:

  • yearly aggregate series
  • latest_snapshot
  • granular_latest_year
  • granular_years
  • top_export_partners
  • top_import_partners
  • top_export_products
  • top_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"

On this page