Top 10 HS Codes
Retrieve the top 10 HS codes by value for a selected country, trade flow, and period.
ENDPOINTS
POST /api/v1/tradeAnalytics/top10Hs
Request parameters
countryCode
string
Country ISO3 code
- Required:
Yes - Example:
CHN
ie
string
Trade flow. Use i for import and e for export.
- Required:
No - Example:
i
hsCode
string
HS code
- Required:
No - Example:
02
startDate
string
Start period in YYYY-MM format
- Required:
Yes - Example:
2021-01
endDate
string
End period in YYYY-MM format
- Required:
Yes - Example:
2023-01
type
int
HS code depth level
- Required:
Yes - Example:
6
Request Example
{
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"startDate": "2024-01",
"endDate": "2024-12",
"type": 6
}
curl https://api.tradedata.io/api/v1/tradeAnalytics/top10Hs \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"countryCode": "USA", "ie": "i", "hsCode": "28", "startDate": "2024-01", "endDate": "2024-12", "type": 6}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/tradeAnalytics/top10Hs",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"startDate": "2024-01",
"endDate": "2024-12",
"type": 6,
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/tradeAnalytics/top10Hs", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"startDate": "2024-01",
"endDate": "2024-12",
"type": 6
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/tradeAnalytics/top10Hs");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer yourTokenHere",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"countryCode" => "USA",
"ie" => "i",
"hsCode" => "28",
"startDate" => "2024-01",
"endDate" => "2024-12",
"type" => 6
]),
]);
echo curl_exec($ch);
Response parameters
code
int
Status code
- Example:
200
data
array
Result container
data.hsCode
string
HS code
- Example:
0203
data.value
number
Trade value
- Example:
2203563727
data.percent
number
Share
- Example:
10.25
Response Example
{
"code": 200,
"success": true,
"data": [
{
"hsCode": "0203",
"value": 2203563727,
"percent": 10.25
}
],
"msg": "success",
"total": 0,
"pageSize": 0,
"current": 0,
"sumResult": null
}