Skip to content
Docs
Get API key
Comtrade

Comtrade Categories and Countries

Use the following API endpoints to obtain detailed information about Comtrade categories and countries.

The United Nations Comtrade database is recognized as the world’s most comprehensive global trade data platform, providing detailed trade statistics by product and trading partner. It serves governments, academia, and enterprises globally, covering around 200 countries and representing over 99% of the world’s merchandise trade. This extensive database offers valuable insights for various sectors and industries.

List categories

Using Requests:

Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/categories?c={your_api_key}'
data = requests.get(url).json()
print(data)

Or using our package:

Python
import tradingeconomics as te
te.login('your_api_key')
te.getCmtCategories()

The response data format can be configured by appending the &f= parameter to the URL request.

Text
https://api.tradingeconomics.com/comtrade/categories?c={your_api_key}&f=json
JSON
[
  {
    "id": "01",
    "name": "Live animals",
    "parentId": "a1",
    "pretty_name": "Live animals"
  },
  {
    "id": "0101",
    "name": "Horses, asses, mules and hinnies, live",
    "parentId": "01",
    "pretty_name": "Horses, asses, mules and hinnies, live"
  },
  {
    "id": "0102",
    "name": "Bovine animals, live",
    "parentId": "01",
    "pretty_name": "Bovine animals, live"
  }
]

List countries

Using Requests:

Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/countries?c={your_api_key}'
data = requests.get(url).json()
print(data)

Or using our package:

Python
te.getCmtCountry()
Text
https://api.tradingeconomics.com/comtrade/countries?c={your_api_key}&f=json
JSON
[
  {
    "id": "100",
    "name": "Bulgaria",
    "region": "Europe",
    "subregion": "Eastern Europe",
    "iso": "BGR",
    "year": "2023"
  },
  {
    "id": "104",
    "name": "Myanmar",
    "region": "Asia",
    "subregion": "South-Eastern Asia",
    "iso": "MMR",
    "year": "2023"
  },
  {
    "id": "108",
    "name": "Burundi",
    "region": "Africa",
    "subregion": "Western Africa",
    "iso": "BDI",
    "year": "2022"
  }
]

Response fields

Fields in ‘List categories’

FieldTypeDescriptionExample
IdstringUnique Comtrade identifier for the category“01”
NamestringOfficial category name“Live animals”
ParentIdstringIdentifier of the parent category (if applicable)“a1”
Pretty_NamestringHuman-readable or display-friendly category name“Agricultural for Soil Preparation”

Fields in ‘List countries’

FieldTypeDescriptionExample
IdstringUnique Comtrade identifier“01”
NamestringCountry name“Mexico”
RegionstringRegion where the country is located“Europe”
SubregionstringSubregion where the country is located“Eastern Europe”
ISOstringThree-letter ISO country code“BGR”
YearstringMost recent year of data update“2021”