curl --request POST \
--url https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reporter_code": "156"
}
'import requests
url = "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability"
payload = { "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({reporter_code: '156'})
};
fetch('https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability', 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/data-availability",
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([
'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/data-availability"
payload := strings.NewReader("{\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/data-availability")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reporter_code\": \"156\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability")
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 \"reporter_code\": \"156\"\n}"
response = http.request(request)
puts response.read_body{
"count": 8,
"datasets": [
{
"classification_code": "H4",
"dataset_code": "20156201201092100",
"first_released": "2013-05-22T23:19:21.98",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2013-05-22T23:19:21.98",
"length_cmd_code": null,
"period": "2012",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 696476,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201301092100",
"first_released": "2014-06-17T16:53:27.77",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2014-06-17T16:53:27.77",
"length_cmd_code": null,
"period": "2013",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 709963,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201401092100",
"first_released": "2015-05-07T15:34:46.78",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2017-06-28T16:19:59.03",
"length_cmd_code": null,
"period": "2014",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 730672,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201501092100",
"first_released": "2016-05-25T20:53:01.2733333",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2017-06-29T02:31:54.9566667",
"length_cmd_code": null,
"period": "2015",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 2894591,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201601092100",
"first_released": "2017-05-26T04:00:52.57",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2021-12-13T20:23:32.8933333",
"length_cmd_code": null,
"period": "2016",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 2991492,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201701182100",
"first_released": "2018-08-16T14:55:42.4666667",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2018-08-16T14:55:42.4666667",
"length_cmd_code": null,
"period": "2017",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 3086454,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201801182100",
"first_released": "2019-11-03T17:39:20.5066667",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2022-06-08T05:01:46.5066667",
"length_cmd_code": null,
"period": "2018",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 787828,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201901182100",
"first_released": "2020-10-27T04:41:22.7",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2022-05-21T09:34:45.3933333",
"length_cmd_code": null,
"period": "2019",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 811658,
"type_code": "C"
}
],
"observed_at_ms": 1792433666111,
"request": {
"classification": "HS",
"freq_code": "A",
"period": "2012,2013,2014,2015,2016,2017,2018,2019",
"reporter_code": "156",
"type_code": "C"
},
"source_url": "https://comtradeapi.un.org/public/v1/getDA/C/A/HS?reporterCode=156&period=2012%2C2013%2C2014%2C2015%2C2016%2C2017%2C2018%2C2019"
}Data availability
Before pulling data: which years/months exist for a reporter, how many records each dataset has, when it was first and last released, which HS edition it uses. Also to resolve dataset_code values for dataset_metadata.
curl --request POST \
--url https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reporter_code": "156"
}
'import requests
url = "https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability"
payload = { "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({reporter_code: '156'})
};
fetch('https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability', 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/data-availability",
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([
'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/data-availability"
payload := strings.NewReader("{\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/data-availability")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reporter_code\": \"156\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability")
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 \"reporter_code\": \"156\"\n}"
response = http.request(request)
puts response.read_body{
"count": 8,
"datasets": [
{
"classification_code": "H4",
"dataset_code": "20156201201092100",
"first_released": "2013-05-22T23:19:21.98",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2013-05-22T23:19:21.98",
"length_cmd_code": null,
"period": "2012",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 696476,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201301092100",
"first_released": "2014-06-17T16:53:27.77",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2014-06-17T16:53:27.77",
"length_cmd_code": null,
"period": "2013",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 709963,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201401092100",
"first_released": "2015-05-07T15:34:46.78",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2017-06-28T16:19:59.03",
"length_cmd_code": null,
"period": "2014",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 730672,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201501092100",
"first_released": "2016-05-25T20:53:01.2733333",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2017-06-29T02:31:54.9566667",
"length_cmd_code": null,
"period": "2015",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 2894591,
"type_code": "C"
},
{
"classification_code": "H4",
"dataset_code": "20156201601092100",
"first_released": "2017-05-26T04:00:52.57",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2021-12-13T20:23:32.8933333",
"length_cmd_code": null,
"period": "2016",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 2991492,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201701182100",
"first_released": "2018-08-16T14:55:42.4666667",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2018-08-16T14:55:42.4666667",
"length_cmd_code": null,
"period": "2017",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 3086454,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201801182100",
"first_released": "2019-11-03T17:39:20.5066667",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2022-06-08T05:01:46.5066667",
"length_cmd_code": null,
"period": "2018",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 787828,
"type_code": "C"
},
{
"classification_code": "H5",
"dataset_code": "20156201901182100",
"first_released": "2020-10-27T04:41:22.7",
"freq_code": "A",
"is_original_classification": true,
"last_released": "2022-05-21T09:34:45.3933333",
"length_cmd_code": null,
"period": "2019",
"reporter_code": 156,
"reporter_desc": "China",
"reporter_iso": "CHN",
"total_records": 811658,
"type_code": "C"
}
],
"observed_at_ms": 1792433666111,
"request": {
"classification": "HS",
"freq_code": "A",
"period": "2012,2013,2014,2015,2016,2017,2018,2019",
"reporter_code": "156",
"type_code": "C"
},
"source_url": "https://comtradeapi.un.org/public/v1/getDA/C/A/HS?reporterCode=156&period=2012%2C2013%2C2014%2C2015%2C2016%2C2017%2C2018%2C2019"
}Request contract
- Method and path: POST /apis/v1/comtradeplus-un-org/trade-statistics/data-availability
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/comtradeplus-un-org/trade-statistics/data-availability
{
"operationId": "comtradeplus-un-org.trade-statistics.data-availability",
"method": "POST",
"path": "/apis/v1/comtradeplus-un-org/trade-statistics/data-availability",
"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": {
"period": "2012,2013,2014,2015,2016,2017,2018,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"
]
}
},
"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"
]
}
},
"period": {
"description": "Period(s) YYYY or YYYYMM, comma-separated; omit for every period. Pattern: ^\\d{4}(\\d{2})?(,\\d{4}(\\d{2})?)*$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"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"
},
"tariffline": {
"description": "Query the tariffline dataset catalogue instead of the standard one.",
"type": "boolean",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"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": [
"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
Which datasets UN Comtrade holds for a reporter, frequency, classification and period(s), with record counts, the HS edition actually reported and release dates (GET /public/v1/getDA or, with tariffline=true, /public/v1/getDATariffline). An empty list is a legitimate answer: nothing published for that selection.
The response contains the tool result directly.
| Documented field | Provider type | Description |
|---|---|---|
count | number | |
datasets | object[] | |
observed_at_ms | number | Unix milliseconds when this result was fetched. |
request | object | The selection as sent upstream (defaults filled in). |
source_url | string | The comtradeapi.un.org request that produced this result. |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.