HS Code Detail
Retrieve HS code breakdown statistics for the selected filters, including value, quantity, average price, and share.
ENDPOINTS
POST /api/v1/tradeAnalytics/hsDetail
Request parameters
countryCode
string
Country ISO3 code
- Required:
Yes - Example:
USA
startDate
string
Start period in YYYY-MM format
- Required:
Yes - Example:
2024-01
endDate
string
End period in YYYY-MM format
- Required:
Yes - Example:
2024-12
hsCode
string
HS code
- Required:
No - Example:
28
sortType
int
Sort type. 1 sorts by value; 2 sorts by quantity.
- Required:
No - Example:
1
ie
string
Trade flow. Use i for import and e for export.
- Required:
No - Example:
i
partnerIso3
string
Partner country ISO3 code(s), separated by commas.
- Required:
No - Example:
ITA,MEX
type
int
HS code depth level
- Required:
Yes - Example:
6
Request Example
{
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType": 1,
"ie": "i",
"partnerIso3": "ITA,MEX",
"type": 6
}
curl https://api.tradedata.io/api/v1/tradeAnalytics/hsDetail \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"countryCode": "USA", "startDate": "2024-01", "endDate": "2024-12", "hsCode": "28", "sortType": 1, "ie": "i", "partnerIso3": "ITA,MEX", "type": 6}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/tradeAnalytics/hsDetail",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType": 1,
"ie": "i",
"partnerIso3": "ITA,MEX",
"type": 6,
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/tradeAnalytics/hsDetail", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"countryCode": "USA",
"startDate": "2024-01",
"endDate": "2024-12",
"hsCode": "28",
"sortType": 1,
"ie": "i",
"partnerIso3": "ITA,MEX",
"type": 6
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/tradeAnalytics/hsDetail");
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",
"startDate" => "2024-01",
"endDate" => "2024-12",
"hsCode" => "28",
"sortType" => 1,
"ie" => "i",
"partnerIso3" => "ITA,MEX",
"type" => 6
]),
]);
echo curl_exec($ch);
Response parameters
code
int
Status code
- Example:
200
data
array
Result container
data.strAvgPrice
string
Average price as a formatted string
- Example:
7.08
data.quantity
number
Quantity
- Example:
2203563727
data.valueProportion
number
Value share
- Example:
91.28
data.name
string
HS code
- Example:
020230
data.averagePrice
number
Average price
- Example:
7.08
data.quantityProportion
number
Quantity share
- Example:
83.55
data.value
number
Trade value
- Example:
15593703187
Response Example
{
"code": 200,
"success": true,
"data": [
{
"strAvgPrice": "7.08",
"quantity": 2203563727,
"valueProportion": 91.28,
"name": "020230",
"averagePrice": 7.08,
"quantityProportion": 83.55,
"value": 15593703187
},
{
"strAvgPrice": "3.44",
"quantity": 432525595,
"valueProportion": 8.7,
"name": "020220",
"averagePrice": 3.44,
"quantityProportion": 16.4,
"value": 1486831622
},
{
"strAvgPrice": "2.78",
"quantity": 1304068,
"valueProportion": 0.02,
"name": "020210",
"averagePrice": 2.78,
"quantityProportion": 0.05,
"value": 3631037
}
],
"msg": "success",
"total": 3,
"pageSize": 10,
"current": 1,
"sumResult": null
}