Comtrade Snapshot of Latest Values
The Snapshot endpoint offers a momentary view of data, capturing specific information at a particular point in time. It generally includes details such as date, units, and general information, providing a static representation of current data.
By countries
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/country/china/portugal?c={your_api_key}'
data = requests.get(url).json()
print(data)
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/country/china/portugal?c=${your_api_key}`)
console.log(response.data)
})()
Using Requests:
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/country/portugal?c=your_api_key"))
{
request.Headers.TryAddWithoutValidation("Upgrade-Insecure-Requests", "1");
var response = await httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
}
The response data format can be configured by appending the &f= parameter to the URL request.
https://api.tradingeconomics.com/comtrade/country/{country}/{country}?c={your_api_key}&f=json
[
{
"symbol": "CHNPRT00002",
"country1": "China",
"country2": "Portugal",
"value": 5978101967,
"date": 2022,
"type": "Export",
"category": null,
"url": "/china/exports/portugal",
"title": "China exports to Portugal",
"StartDate": 1992,
"lastupdate": "2023-05-04T17:23:00"
},
{
"symbol": "CHNPRT00001",
"country1": "China",
"country2": "Portugal",
"value": 3036088177,
"date": 2022,
"type": "Import",
"category": null,
"url": "/china/imports/portugal",
"title": "China imports from Portugal",
"StartDate": 1992,
"lastupdate": "2023-05-04T17:23:00"
},
{
"symbol": "CHNPRTXX852",
"country1": "China",
"country2": "Portugal",
"value": 2010403509,
"date": 2022,
"type": "Export",
"category": "Electrical, electronic equipment",
"url": "/china/exports/portugal/electrical-electronic-equipment",
"title": "China exports of electrical, electronic equipment to Portugal",
"StartDate": 1992,
"lastupdate": "2023-05-04T16:51:00"
}
]
https://api.tradingeconomics.com/comtrade/country/{country}/{country}?c={your_api_key}&f=csv
CHNPRT00002,China,Portugal,5978101967,2022,Export,,/china/exports/portugal,China exports to Portugal,1992,5/4/2023 5:23:00 PM
CHNPRT00001,China,Portugal,3036088177,2022,Import,,/china/imports/portugal,China imports from Portugal,1992,5/4/2023 5:23:00 PM
CHNPRTXX852,China,Portugal,2010403509,2022,Export,"Electrical, electronic equipment",/china/exports/portugal/electrical-electronic-equipment,"China exports of electrical, electronic equipment to Portugal",1992,5/4/2023 4:51:00 PM
https://api.tradingeconomics.com/comtrade/country/{country}/{country}?c={your_api_key}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| CHNPRT00002 | China | Portugal | 5978101967 | 2022 | Export | /china/exports/portugal | China exports to Portugal | 1992 | 5/4/2023 5:23:00 PM | ||
| CHNPRT00001 | China | Portugal | 3036088177 | 2022 | Import | /china/imports/portugal | China imports from Portugal | 1992 | 5/4/2023 5:23:00 PM | ||
| CHNPRTXX852 | China | Portugal | 2010403509 | 2022 | Export | “Electrical, electronic equipment” | /china/exports/portugal/electrical-electronic-equipment | “China exports of electrical, electronic equipment to Portugal” | 1992 | 5/4/2023 4:51:00 PM |
Import or Export by country
Get total type (import or export) by country for all main categories
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/import/india?c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
Import
te.getCmtCountryByCategory(country = 'India', type = 'import')
Export
te.getCmtCountryByCategory(country = 'India', type = 'export')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/import/india?c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
Import
data = te.getCmtCountryByCategory(country = 'india',
type = 'import').then(function(data){
console.log(data)
});
Export
data = te.getCmtCountryByCategory(country = 'India',
type = 'export').then(function(data){
console.log(data)
});
Using Requests:
Import
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/import/india?c=your_api_key"))
Export
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/export/india?c=your_api_key"))
https://api.tradingeconomics.com/comtrade/{type}/{country}?c={your_api_key}&f=json
[
{
"symbol": "INDWLDXX271",
"country": "India",
"value": 277238257324,
"date": 2022,
"type": "Import",
"category": "Mineral fuels, oils, distillation products",
"url": "/india/imports/mineral-fuels-oils-distillation-products",
"title": "India Imports of Mineral fuels, oils, distillation products",
"StartDate": 1988,
"lastupdate": "2023-05-11T09:16:00"
},
{
"symbol": "INDWLDXX711",
"country": "India",
"value": 78172888292,
"date": 2022,
"type": "Import",
"category": "Pearls, precious stones, metals, coins",
"url": "/india/imports/pearls-precious-stones-metals-coins",
"title": "India Imports of Pearls, precious stones, metals, coins",
"StartDate": 1988,
"lastupdate": "2023-05-11T09:16:00"
},
{
"symbol": "INDWLDXX851",
"country": "India",
"value": 69680021840,
"date": 2022,
"type": "Import",
"category": "Electrical, electronic equipment",
"url": "/india/imports/electrical-electronic-equipment",
"title": "India Imports of Electrical, electronic equipment",
"StartDate": 1988,
"lastupdate": "2023-05-11T09:16:00"
}
]
https://api.tradingeconomics.com/comtrade/{type}/{country}?c={your_api_key}&f=csv
INDWLDXX271,India,277238257324,2022,Import,"Mineral fuels, oils, distillation products",/india/imports/mineral-fuels-oils-distillation-products,"India Imports of Mineral fuels, oils, distillation products",1988,5/11/2023 9:16:00 AM
INDWLDXX711,India,78172888292,2022,Import,"Pearls, precious stones, metals, coins",/india/imports/pearls-precious-stones-metals-coins,"India Imports of Pearls, precious stones, metals, coins",1988,5/11/2023 9:16:00 AM
INDWLDXX851,India,69680021840,2022,Import,"Electrical, electronic equipment",/india/imports/electrical-electronic-equipment,"India Imports of Electrical, electronic equipment",1988,5/11/2023 9:16:00 AM
https://api.tradingeconomics.com/comtrade/import/{country}?c={your_api_key}
| symbol | country | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|
| INDWLDXX271 | India | 277238257324 | 2022 | Import | “Mineral fuels, oils, distillation products” | /india/imports/mineral-fuels-oils-distillation-products | “India Imports of Mineral fuels, oils, distillation products” | 1988 | 5/11/2023 9:16:00 AM | |
| INDWLDXX711 | India | 78172888292 | 2022 | Import | “Pearls, precious stones, metals, coins” | /india/imports/pearls-precious-stones-metals-coins | “India Imports of Pearls, precious stones, metals, coins” | 1988 | 5/11/2023 9:16:00 AM | |
| INDWLDXX851 | India | 69680021840 | 2022 | Import | “Electrical, electronic equipment” | /india/imports/electrical-electronic-equipment | “India Imports of Electrical, electronic equipment” | 1988 | 5/11/2023 9:16:00 AM |
Import or Export by country and category
Get type (import or export) by country and specific category
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/import/united%20kingdom/Coffee,%20tea,%20mate%20and%20spices?c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
Import
te.getCmtCountryByCategory(country = 'United Kingdom', type = 'import',
category='Coffee, tea, mate and spices')
Export
te.getCmtCountryByCategory(country = 'United Kingdom', type = 'export',
category='Coffee, tea, mate and spices')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/import/united%20kingdom/Coffee,%20tea,%20mate%20and%20spices?c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
Import
data = te.getCmtCountryByCategory(country = 'india', type = 'import',
category='Coffee, tea, mate and spices').then(function(data){
console.log(data)
});
Export
data = te.getCmtCountryByCategory(country = 'india', type = 'export',
category='Coffee, tea, mate and spices').then(function(data){
console.log(data)
});
Using Requests:
Import
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/import/united%20kingdom/Coffee,%20tea,%20mate%20and%20spices?c=your_api_key"))
Export
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/export/united%20kingdom/Coffee,%20tea,%20mate%20and%20spices?c=your_api_key"))
https://api.tradingeconomics.com/comtrade/{type}/{country}/{category}?c={your_api_key}&f=json
[
{
"symbol": "GBRWLDXX091",
"country1": "United Kingdom",
"country2": "World",
"value": 2027958871,
"date": 2023,
"type": "Import",
"category": "Coffee, tea, mate and spices",
"url": "/united-kingdom/imports/coffee-tea-mate-spices",
"title": "United Kingdom Imports of Coffee, tea, mate and spices",
"StartDate": 1993,
"lastupdate": "2024-03-08T09:30:00"
},
{
"symbol": "GBRBRAXX091",
"country1": "United Kingdom",
"country2": "Brazil",
"value": 261221802,
"date": 2023,
"type": "Import",
"category": "Coffee, tea, mate and spices",
"url": "/united-kingdom/imports/brazil/coffee-tea-mate-spices",
"title": "United Kingdom Imports from Brazil of Coffee, tea, mate and spices",
"StartDate": 1993,
"lastupdate": "2024-03-08T09:35:00"
},
{
"symbol": "GBRCHEXX091",
"country1": "United Kingdom",
"country2": "Switzerland",
"value": 228464421,
"date": 2023,
"type": "Import",
"category": "Coffee, tea, mate and spices",
"url": "/united-kingdom/imports/switzerland/coffee-tea-mate-spices",
"title": "United Kingdom Imports from Switzerland of Coffee, tea, mate and spices",
"StartDate": 1993,
"lastupdate": "2024-03-08T10:01:00"
}
]
https://api.tradingeconomics.com/comtrade/{type}/{country}/{category}?c={your_api_key}&f=csv
GBRWLDXX091,United Kingdom,World,2027958871,2023,Import,"Coffee, tea, mate and spices",/united-kingdom/imports/coffee-tea-mate-spices,"United Kingdom Imports of Coffee, tea, mate and spices",1993,3/8/2024 9:30:00 AM
GBRBRAXX091,United Kingdom,Brazil,261221802,2023,Import,"Coffee, tea, mate and spices",/united-kingdom/imports/brazil/coffee-tea-mate-spices,"United Kingdom Imports from Brazil of Coffee, tea, mate and spices",1993,3/8/2024 9:35:00 AM
GBRCHEXX091,United Kingdom,Switzerland,228464421,2023,Import,"Coffee, tea, mate and spices",/united-kingdom/imports/switzerland/coffee-tea-mate-spices,"United Kingdom Imports from Switzerland of Coffee, tea, mate and spices",1993,3/8/2024 10:01:00 AM
https://api.tradingeconomics.com/comtrade/{type}/{country}/{category}?c={your_api_key}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| GBRWLDXX091 | United Kingdom | World | 2027958871 | 2023 | Import | “Coffee, tea, mate and spices” | /united-kingdom/imports/coffee-tea-mate-spices | “United Kingdom Imports of Coffee, tea, mate and spices” | 1993 | 3/8/2024 9:30:00 AM | |
| GBRBRAXX091 | United Kingdom | Brazil | 261221802 | 2023 | Import | “Coffee, tea, mate and spices” | /united-kingdom/imports/brazil/coffee-tea-mate-spices | “United Kingdom Imports from Brazil of Coffee, tea, mate and spices” | 1993 | 3/8/2024 9:35:00 AM | |
| GBRCHEXX091 | United Kingdom | Switzerland | 228464421 | 2023 | Import | “Coffee, tea, mate and spices” | /united-kingdom/imports/switzerland/coffee-tea-mate-spices | “United Kingdom Imports from Switzerland of Coffee, tea, mate and spices” | 1993 | 3/8/2024 10:01:00 AM |
Total imports and exports by country
Get total type (export or export) by a specific country
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/import/india/totals?c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
Import
te.getCmtTotalByType(country = 'India', type = 'import')
Export
te.getCmtTotalByType(country = 'India', type = 'export')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/import/india/totals?c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
Import
data = te.getComtradeTotalByType(country = 'India', type = 'import').then(function(data){
console.log(data)
});
Export
data = te.getComtradeTotalByType(country = 'India', type = 'export').then(function(data){
console.log(data)
});
Using Requests:
Import
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/import/india/totals?c=your_api_key"))
Export
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/export/india/totals?c=your_api_key"))
https://api.tradingeconomics.com/comtrade/{type}/{country}/totals?c={your_api_key}&f=json
[
{
"symbol": "INDWLD00001",
"country1": "India",
"country2": "World",
"value": 732565993392,
"date": 2022,
"type": "Import",
"category": null,
"url": "/india/imports",
"title": "India imports",
"StartDate": 1988,
"lastupdate": "2023-05-11T10:25:00"
},
{
"symbol": "INDCHN00001",
"country1": "India",
"country2": "China",
"value": 102249179657,
"date": 2022,
"type": "Import",
"category": null,
"url": "/india/imports/china",
"title": "India imports from China",
"StartDate": 1988,
"lastupdate": "2023-05-11T10:30:00"
},
{
"symbol": "INDARE00001",
"country1": "India",
"country2": "United Arab Emirates",
"value": 53851376669,
"date": 2022,
"type": "Import",
"category": null,
"url": "/india/imports/united-arab-emirates",
"title": "India imports from United Arab Emirates",
"StartDate": 1988,
"lastupdate": "2023-05-11T10:56:00"
}
]
https://api.tradingeconomics.com/comtrade/{type}/{country}/totals?c={your_api_key}&f=csv
INDWLD00001,India,World,732565993392,2022,Import,,/india/imports,India imports,1988,5/11/2023 10:25:00 AM
INDCHN00001,India,China,102249179657,2022,Import,,/india/imports/china,India imports from China,1988,5/11/2023 10:30:00 AM
INDARE00001,India,United Arab Emirates,53851376669,2022,Import,,/india/imports/united-arab-emirates,India imports from United Arab Emirates,1988,5/11/2023 10:56:00 AM
https://api.tradingeconomics.com/comtrade/{type}/{country}/totals?c={your_api_key}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| INDWLD00001 | India | World | 732565993392 | 2022 | Import | /india/imports | India imports | 1988 | 5/11/2023 10:25:00 AM | ||
| INDCHN00001 | India | China | 102249179657 | 2022 | Import | /india/imports/china | India imports from China | 1988 | 5/11/2023 10:30:00 AM | ||
| INDARE00001 | India | United Arab Emirates | 53851376669 | 2022 | Import | /india/imports/united-arab-emirates | India imports from United Arab Emirates | 1988 | 5/11/2023 10:56:00 AM |
Trade between countries
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/country/portugal/spain?c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
te.getCmtTwoCountries(country1 ='portugal', country2 ='spain')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/country/portugal/spain?c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
data = te.getComtrade(country = 'portugal', country1 = 'spain').then(function(data){
console.log(data)
});
Using Requests:
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/country/portugal/spain?c=your_api_key"))
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}&f=json
[
{
"symbol": "PRTESP00001",
"country1": "Portugal",
"country2": "Spain",
"value": 38348660154,
"date": 2023,
"type": "Import",
"category": null,
"url": "/portugal/imports/spain",
"title": "Portugal imports from Spain",
"StartDate": 1988,
"lastupdate": "2024-02-17T09:27:00"
},
{
"symbol": "PRTESP00002",
"country1": "Portugal",
"country2": "Spain",
"value": 21634181445,
"date": 2023,
"type": "Export",
"category": null,
"url": "/portugal/exports/spain",
"title": "Portugal exports to Spain",
"StartDate": 1988,
"lastupdate": "2024-02-17T09:27:00"
},
{
"symbol": "PRTESPXX871",
"country1": "Portugal",
"country2": "Spain",
"value": 4062012117,
"date": 2023,
"type": "Import",
"category": "Vehicles other than railway, tramway",
"url": "/portugal/imports/spain/vehicles-not-railway-tramway",
"title": "Portugal Imports from Spain of Vehicles other than railway, tramway",
"StartDate": 1990,
"lastupdate": "2024-02-17T08:56:00"
}
]
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}&f=csv
PRTESP00001,Portugal,Spain,38348660154,2023,Import,,/portugal/imports/spain,Portugal imports from Spain,1988,2/17/2024 9:27:00 AM
PRTESP00002,Portugal,Spain,21634181445,2023,Export,,/portugal/exports/spain,Portugal exports to Spain,1988,2/17/2024 9:27:00 AM
PRTESPXX871,Portugal,Spain,4062012117,2023,Import,"Vehicles other than railway, tramway",/portugal/imports/spain/vehicles-not-railway-tramway,"Portugal Imports from Spain of Vehicles other than railway, tramway",1990,2/17/2024 8:56:00 AM
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| PRTESP00001 | Portugal | Spain | 38348660154 | 2023 | Import | /portugal/imports/spain | Portugal imports from Spain | 1988 | 2/17/2024 9:27:00 AM | ||
| PRTESP00002 | Portugal | Spain | 21634181445 | 2023 | Export | /portugal/exports/spain | Portugal exports to Spain | 1988 | 2/17/2024 9:27:00 AM | ||
| PRTESPXX871 | Portugal | Spain | 4062012117 | 2023 | Import | “Vehicles other than railway, tramway” | /portugal/imports/spain/vehicles-not-railway-tramway | “Portugal Imports from Spain of Vehicles other than railway, tramway” | 1990 | 2/17/2024 8:56:00 AM |
Trade between countries by type
type = (import or export)
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/country/portugal/spain?type=import&c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
Import
te.getCmtCountryFilterByType(country1 ='portugal', country2 ='spain',
type='import')
Export
te.getCmtCountryFilterByType(country1 ='portugal', country2 ='spain',
type='export')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/country/portugal/spain?type=import&c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
Import
data = te.getComtrade(country = 'portugal', country1 = 'spain',
category='import').then(function(data){
console.log(data)
});
Export
data = te.getComtrade(country = 'portugal', country1 = 'spain',
category='export').then(function(data){
console.log(data)
});
Using Requests:
Import
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/country/portugal/spain?type=import&c=your_api_key"))
Export
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/country/portugal/spain?type=export&c=your_api_key"))
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}&type={type}&f=json
[
{
"symbol": "PRTESP00001",
"country1": "Portugal",
"country2": "Spain",
"value": 38348660154,
"date": 2023,
"type": "Import",
"category": null,
"url": "/portugal/imports/spain",
"title": "Portugal imports from Spain",
"StartDate": 1988,
"lastupdate": "2024-02-17T09:27:00"
},
{
"symbol": "PRTESP00002",
"country1": "Portugal",
"country2": "Spain",
"value": 21634181445,
"date": 2023,
"type": "Export",
"category": null,
"url": "/portugal/exports/spain",
"title": "Portugal exports to Spain",
"StartDate": 1988,
"lastupdate": "2024-02-17T09:27:00"
},
{
"symbol": "PRTESPXX871",
"country1": "Portugal",
"country2": "Spain",
"value": 4062012117,
"date": 2023,
"type": "Import",
"category": "Vehicles other than railway, tramway",
"url": "/portugal/imports/spain/vehicles-not-railway-tramway",
"title": "Portugal Imports from Spain of Vehicles other than railway, tramway",
"StartDate": 1990,
"lastupdate": "2024-02-17T08:56:00"
}
]
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}&type={type}&f=csv
PRTESP00001,Portugal,Spain,38348660154,2023,Import,,/portugal/imports/spain,Portugal imports from Spain,1988,2/17/2024 9:27:00 AM
PRTESP00002,Portugal,Spain,21634181445,2023,Export,,/portugal/exports/spain,Portugal exports to Spain,1988,2/17/2024 9:27:00 AM
PRTESPXX871,Portugal,Spain,4062012117,2023,Import,"Vehicles other than railway, tramway",/portugal/imports/spain/vehicles-not-railway-tramway,"Portugal Imports from Spain of Vehicles other than railway, tramway",1990,2/17/2024 8:56:00 AM
https://api.tradingeconomics.com/comtrade/country/{country_1}/{country_2}?c={your_api_key}&type={type}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| PRTESP00001 | Portugal | Spain | 38348660154 | 2023 | Import | /portugal/imports/spain | Portugal imports from Spain | 1988 | 2/17/2024 9:27:00 AM | ||
| PRTESP00002 | Portugal | Spain | 21634181445 | 2023 | Export | /portugal/exports/spain | Portugal exports to Spain | 1988 | 2/17/2024 9:27:00 AM | ||
| PRTESPXX871 | Portugal | Spain | 4062012117 | 2023 | Import | “Vehicles other than railway, tramway” | /portugal/imports/spain/vehicles-not-railway-tramway | “Portugal Imports from Spain of Vehicles other than railway, tramway” | 1990 | 2/17/2024 8:56:00 AM |
Updates by country and date
Using Requests:
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/updates/country/mexico?from=2020-01-01&c={your_api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
te.getCmtLastUpdates(country = 'mexico', start_date = '2020-01-01')
Using Requests:
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/comtrade/updates/country/mexico?from=2020-01-01&c=${your_api_key}`)
console.log(response.data)
})()
Or using our package:
data = te.getCmtLastUpdates(country = 'mexico', start_date='2020-01-01').then(function(data){
console.log(data)
});
Using Requests:
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/comtrade/updates/country/mexico?from=2020-01-01&c=your_api_key"))
https://api.tradingeconomics.com/comtrade/updates/country/{country}?c={your_api_key}&from={yyyy-mm-dd}&f=json
[
{
"symbol": "MEXCAN29372",
"country1": "Mexico",
"country2": "Canada",
"value": null,
"date": 0,
"type": "Export",
"category": "Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",
"url": "/mexico/exports/canada/hormones-steroids-used-hormones",
"title": "Mexico exports of hormons and their derivatives, other steroids used primarily as hormone to Canada",
"StartDate": 1990,
"lastupdate": "2024-02-02T07:21:00"
},
{
"symbol": "MEXHKG29371",
"country1": "Mexico",
"country2": "Hong Kong",
"value": null,
"date": 0,
"type": "Import",
"category": "Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",
"url": "/mexico/imports/hong-kong/hormones-steroids-used-hormones",
"title": "Mexico Imports from Hong Kong of Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",
"StartDate": 1992,
"lastupdate": "2024-01-29T07:09:00"
},
{
"symbol": "MEXHKG85081",
"country1": "Mexico",
"country2": "Hong Kong",
"value": null,
"date": 0,
"type": "Import",
"category": "Electromechanical tools, working in hand, parts",
"url": "/mexico/imports/hong-kong/electromechanical-tools-working-hand-parts",
"title": "Mexico Imports from Hong Kong of Electromechanical tools, working in hand, parts",
"StartDate": 1990,
"lastupdate": "2024-01-29T07:09:00"
}
]
https://api.tradingeconomics.com/comtrade/updates/country/{country}?c={your_api_key}&from={yyyy-mm-dd}&f=csv
symbol,country1,country2,value,date,type,category,url,title,StartDate,lastupdate
MEXCAN29372,Mexico,Canada,,0,Export,"Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",/mexico/exports/canada/hormones-steroids-used-hormones,"Mexico exports of hormons and their derivatives, other steroids used primarily as hormone to Canada",1990,2/2/2024 7:21:00 AM
MEXHKG29371,Mexico,Hong Kong,,0,Import,"Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",/mexico/imports/hong-kong/hormones-steroids-used-hormones,"Mexico Imports from Hong Kong of Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone",1992,1/29/2024 7:09:00 AM
MEXHKG85081,Mexico,Hong Kong,,0,Import,"Electromechanical tools, working in hand, parts",/mexico/imports/hong-kong/electromechanical-tools-working-hand-parts,"Mexico Imports from Hong Kong of Electromechanical tools, working in hand, parts",1990,1/29/2024 7:09:00 AM
https://api.tradingeconomics.com/comtrade/updates/country/{country}?c={your_api_key}&from={yyyy-mm-dd}
| symbol | country1 | country2 | value | date | type | category | url | title | StartDate | lastupdate | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| MEXCAN29372 | Mexico | Canada | 0 | Export | “Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone” | /mexico/exports/canada/hormones-steroids-used-hormones | “Mexico exports of hormons and their derivatives, other steroids used primarily as hormone to Canada” | 1990 | 2/2/2024 7:21:00 AM | ||
| MEXHKG29371 | Mexico | Hong Kong | 0 | Import | “Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone” | /mexico/imports/hong-kong/hormones-steroids-used-hormones | “Mexico Imports from Hong Kong of Hormons and Their Derivatives, Other Steroids Used Primarily as Hormone” | 1992 | 1/29/2024 7:09:00 AM | ||
| MEXHKG85081 | Mexico | Hong Kong | 0 | Import | “Electromechanical tools, working in hand, parts” | /mexico/imports/hong-kong/electromechanical-tools-working-hand-parts | “Mexico Imports from Hong Kong of Electromechanical tools, working in hand, parts” | 1990 | 1/29/2024 7:09:00 AM |
Response fields
| Field | Type | Description | Example |
|---|---|---|---|
| Symbol | string | Unique symbol used by Trading Economics | “MWIBEL85173” |
| Country1 | string | Reporting Country | “Malawi” |
| Country2 | string | Trading Partner | “Belgium” |
| Value | number | Trade value in the specified unit | 17219 |
| Date | number | Year of the data observation | 2022 |
| Type | string | Trade type (e.g., Export, Import, Re-Export) | “Re-Export” |
| Category | string | Product category name | “Pepper, genus piper, genus capsicum or pimenta” |
| URL | string | Hyperlink at Trading Economics | “/portugal/exports/aruba” |
| Title | string | Title describing the trade flow | “Portugal exports to Aruba” |
| StartDate | number | Starting year of the data series | “2023-04-05T00:03:00” |
| lastupdate | string | Timestamp of the last data update | “2023-04-05T00:03:00” |
Notes
*Country2 is not used for ‘Import or Export by country’.