Company Country Analysis API
Retrieve trade statistics grouped by country for a company. The buyer role returns origin countries and the supplier role returns destination countries. Maximum date range is 3 years.
ENDPOINTS
POST /api/v1/company/companyCountry
Request parameters
com_role
integer
Company role in trade. 1 = buyer, 2 = supplier.
- Required:
Yes - Example:
2
com_id
string
Company ID.
- Required:
Yes - Example:
b0c0c20eca1731d19b17043bf8d3f009
date
array<integer>
Date range. Two-element array of 8-digit integers [YYYYMMDD, YYYYMMDD]. Max span: 3 years.
- Required:
Yes - Example:
[20210101, 20231208]
sort
string
Sort field. Supports amount, weight, count.
- Required:
Yes - Example:
weight
order
string
Sort order. asc = ascending, desc = descending. Default: desc.
- Required:
Yes - Example:
desc
page
integer
Page number. Default: 1, max: 1000.
- Required:
No - Example:
1
page_size
integer
Records per page. Default: 10, max: 50.
- Required:
No - Example:
10
Request Example
{
"com_role": 2,
"com_id": "b0c0c20eca1731d19b17043bf8d3f009",
"date": [
20210101,
20231208
],
"order": "desc",
"sort": "weight",
"page": 1,
"page_size": 10
}
curl https://api.tradedata.io/api/v1/company/companyCountry \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"com_role": 2, "com_id": "b0c0c20eca1731d19b17043bf8d3f009", "date": [20210101, 20231208], "order": "desc", "sort": "weight", "page": 1, "page_size": 10}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/company/companyCountry",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"com_role": 2,
"com_id": "b0c0c20eca1731d19b17043bf8d3f009",
"date": [
20210101,
20231208,
],
"order": "desc",
"sort": "weight",
"page": 1,
"page_size": 10,
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/company/companyCountry", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"com_role": 2,
"com_id": "b0c0c20eca1731d19b17043bf8d3f009",
"date": [
20210101,
20231208
],
"order": "desc",
"sort": "weight",
"page": 1,
"page_size": 10
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/company/companyCountry");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer yourTokenHere",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"com_role" => 2,
"com_id" => "b0c0c20eca1731d19b17043bf8d3f009",
"date" => [
20210101,
20231208
],
"order" => "desc",
"sort" => "weight",
"page" => 1,
"page_size" => 10
]),
]);
echo curl_exec($ch);
Response parameters
data
array
Country aggregation list.
data.code
string
Country ISO2 code.
- Example:
ID
data.val
string
Country name (English).
- Example:
INDONESIA
data.amount
string
Total trade amount (USD).
- Example:
28296.66943359375
data.count
string
Number of transactions.
- Example:
2
data.weight
string
Total weight (kg).
- Example:
1124.0
data.iso3Code
string
Country ISO3 code.
- Example:
IDN
sumResult.count
integer
Total transaction count across all countries.
- Example:
7
Response Example
{
"code": 200,
"success": true,
"data": [
{
"code": "ID",
"val": "INDONESIA",
"amount": "28296.66943359375",
"count": "2",
"weight": "1124.0",
"iso3Code": "IDN"
}
],
"msg": "OK",
"total": 5,
"pageSize": 10,
"current": 1,
"sumResult": {
"count": 7
}
}