curl --request POST \
--url https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"period": "2019",
"reporter_code": "156"
}
'import requests
url = "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data"
payload = {
"period": "2019",
"reporter_code": "156"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({period: '2019', reporter_code: '156'})
};
fetch('https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'period' => '2019',
'reporter_code' => '156'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data"
payload := strings.NewReader("{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}"
response = http.request(request)
puts response.read_body{
"count": 1,
"observed_at_ms": 1792433616822,
"periods": [
{
"count": 1,
"period": "2019",
"source_url": "https://comtradeapi.un.org/public/v1/preview/C/A/HS?reporterCode=156&period=2019&partnerCode=0&flowCode=M&cmdCode=850440&includeDesc=true",
"truncated": false
}
],
"records": [
{
"aggr_level": 6,
"alt_qty": 2189054044,
"alt_qty_unit_abbr": "u",
"cif_value": 7111977093,
"classification_code": "H5",
"cmd_code": "850440",
"cmd_desc": "Electrical static converters",
"customs_code": "C00",
"customs_desc": "TOTAL CPC",
"flow_code": "M",
"flow_desc": "Import",
"fob_value": 0,
"freq_code": "A",
"gross_wgt": 0,
"is_aggregate": true,
"is_leaf": true,
"is_net_wgt_estimated": true,
"is_qty_estimated": true,
"is_reported": false,
"mot_code": 0,
"mot_desc": "TOTAL MOT",
"net_wgt": 142925552.458,
"partner2_code": 0,
"partner2_desc": "World",
"partner_code": 0,
"partner_desc": "World",
"partner_iso": "W00",
"period": "2019",
"primary_value": 7111977093,
"qty": 2189051044.308,
"qty_unit_abbr": "u",
"qty_unit_code": 5,
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"type_code": "C"
}
],
"request": {
"classification": "HS",
"cmd_code": "850440",
"flow_code": "M",
"freq_code": "A",
"include_desc": true,
"partner_code": "0",
"periods": [
"2019"
],
"reporter_code": "156",
"type_code": "C"
},
"truncated": false
}Trade data
Annual or monthly import/export value, net weight and quantity of one HS/SITC/BEC/EBOPS code (or TOTAL, AG2/AG4/AG6 aggregates) for a reporter, optionally broken down by partner, e.g. China HS6 850440 imports 2012-2019.
curl --request POST \
--url https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"period": "2019",
"reporter_code": "156"
}
'import requests
url = "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data"
payload = {
"period": "2019",
"reporter_code": "156"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({period: '2019', reporter_code: '156'})
};
fetch('https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'period' => '2019',
'reporter_code' => '156'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data"
payload := strings.NewReader("{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"period\": \"2019\",\n \"reporter_code\": \"156\"\n}"
response = http.request(request)
puts response.read_body{
"count": 1,
"observed_at_ms": 1792433616822,
"periods": [
{
"count": 1,
"period": "2019",
"source_url": "https://comtradeapi.un.org/public/v1/preview/C/A/HS?reporterCode=156&period=2019&partnerCode=0&flowCode=M&cmdCode=850440&includeDesc=true",
"truncated": false
}
],
"records": [
{
"aggr_level": 6,
"alt_qty": 2189054044,
"alt_qty_unit_abbr": "u",
"cif_value": 7111977093,
"classification_code": "H5",
"cmd_code": "850440",
"cmd_desc": "Electrical static converters",
"customs_code": "C00",
"customs_desc": "TOTAL CPC",
"flow_code": "M",
"flow_desc": "Import",
"fob_value": 0,
"freq_code": "A",
"gross_wgt": 0,
"is_aggregate": true,
"is_leaf": true,
"is_net_wgt_estimated": true,
"is_qty_estimated": true,
"is_reported": false,
"mot_code": 0,
"mot_desc": "TOTAL MOT",
"net_wgt": 142925552.458,
"partner2_code": 0,
"partner2_desc": "World",
"partner_code": 0,
"partner_desc": "World",
"partner_iso": "W00",
"period": "2019",
"primary_value": 7111977093,
"qty": 2189051044.308,
"qty_unit_abbr": "u",
"qty_unit_code": 5,
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"type_code": "C"
}
],
"request": {
"classification": "HS",
"cmd_code": "850440",
"flow_code": "M",
"freq_code": "A",
"include_desc": true,
"partner_code": "0",
"periods": [
"2019"
],
"reporter_code": "156",
"type_code": "C"
},
"truncated": false
}Request contract
- Method and path: POST /apis/v1/comtradeplus-un-org/trade-statistics/trade-data
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/trade-data
{
"operationId": "comtradeplus-un-org.trade-statistics.trade-data",
"method": "POST",
"path": "/apis/v1/comtradeplus-un-org/trade-statistics/trade-data",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"provider": {
"summary": "Official provider example; checked against AIsa request constraints",
"value": {
"cmd_code": "850440",
"flow_code": "M",
"partner_code": "0",
"period": "2019",
"reporter_code": "156"
}
}
},
"schema": {
"additionalProperties": true,
"properties": {
"classification": {
"default": "HS",
"description": "Product classification in the URL path: HS (as reported, any HS edition), H0-H6 (a specific HS edition), S1-S4 (SITC), BE/BE5 (BEC), EB/EB10/EB02/EBS (EBOPS, services).\n\nProvider reference: allowed values [\"HS\", \"H6\", \"H5\", \"H4\", \"H3\", \"H2\", \"H1\", \"H0\", \"S4\", \"S3\", \"S2\", \"S1\", \"BE\", \"BE5\", \"EB\", \"EB10\", \"EB02\", \"EBS\"]; default \"HS\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"HS",
"H6",
"H5",
"H4",
"H3",
"H2",
"H1",
"H0",
"S4",
"S3",
"S2",
"S1",
"BE",
"BE5",
"EB",
"EB10",
"EB02",
"EBS"
]
}
},
"cmd_code": {
"default": "TOTAL",
"description": "One commodity code: TOTAL, an HS/SITC/BEC/EBOPS code at any level (85, 8504, 850440), or an aggregate alias AG2/AG4/AG6 for every code at that digit level. Default TOTAL. Pattern: ^[A-Za-z0-9]{1,12}$.\n\nProvider reference: default \"TOTAL\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"flow_code": {
"description": "Trade flow code(s), comma-separated: M import, X export, RM re-import, RX re-export, MIP/XIP/MOP/XOP/MIF/XIF/DX/FM sub-flows. Omit for every flow. Pattern: ^[A-Za-z]{1,3}(,[A-Za-z]{1,3})*$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"freq_code": {
"default": "A",
"description": "Frequency: A annual (period YYYY), M monthly (period YYYYMM).\n\nProvider reference: allowed values [\"A\", \"M\"]; default \"A\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"A",
"M"
]
}
},
"include_desc": {
"description": "Ask the API for description and ISO columns (reporter_desc, partner_iso, cmd_desc ...). When false those come back null.",
"type": "boolean",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"partner_code": {
"description": "Partner area code(s), comma-separated. 0 is World (the reporter's total); omit for a breakdown by every partner. Look codes up with reference_codes table=partnerAreas. Pattern: ^\\d{1,4}(,\\d{1,4})*$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"period": {
"description": "Period(s): YYYY (annual) or YYYYMM (monthly); a comma-separated list and/or inclusive ranges (2012-2019, 201901-201906). At most 12 periods after expansion; each costs one upstream request. Pattern: ^\\d{4}(\\d{2})?(-\\d{4}(\\d{2})?)?(,\\d{4}(\\d{2})?(-\\d{4}(\\d{2})?)?)*$.",
"type": "string"
},
"reporter_code": {
"description": "UN M49 numeric reporter code(s), comma-separated (156 China, 842 USA, 276 Germany). Look codes up with reference_codes table=Reporters. Pattern: ^\\d{1,4}(,\\d{1,4})*$.",
"type": "string"
},
"type_code": {
"default": "C",
"description": "Type of trade: C commodities (goods), S services.\n\nProvider reference: allowed values [\"C\", \"S\"]; default \"C\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"C",
"S"
]
}
}
},
"required": [
"period",
"reporter_code"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.0005 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
Product classification in the URL path: HS (as reported, any HS edition), H0-H6 (a specific HS edition), S1-S4 (SITC), BE/BE5 (BEC), EB/EB10/EB02/EBS (EBOPS, services).
Provider reference: allowed values ["HS", "H6", "H5", "H4", "H3", "H2", "H1", "H0", "S4", "S3", "S2", "S1", "BE", "BE5", "EB", "EB10", "EB02", "EBS"]; default "HS".
Response
Trade values, quantities and weights from the public preview of UN Comtrade (GET /public/v1/preview/{type}/{freq}/{classification}). One commodity code per call; the API accepts one period per request and silently caps each request at 500 records, so the function issues one request per requested period (up to 12, listed or as a range such as 2012-2019) and reports truncated per period. Partner omitted = breakdown by every partner; partner 0 = the reporter's world total. Values are USD as published (CIF for imports, FOB for exports); the full key-gated /data/v1 endpoint is not used.
The response contains the tool result directly.
| Documented field | Provider type | Description |
|---|---|---|
count | number | Total records across all periods. |
observed_at_ms | number | Unix milliseconds when this result was fetched. |
periods | object[] | One entry per requested period, in request order. |
records | object[] | |
request | object | The selection as sent upstream (defaults filled in, periods expanded). |
truncated | boolean | True when any period hit the 500-record preview cap; narrow the selection (partner, flow) or use fewer aggregates. |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.