Get HTS Code by Code
curl --request GET \
--url https://htsapi.com/v1/hts/{code} \
--header 'Authorization: Bearer <token>'import requests
url = "https://htsapi.com/v1/hts/{code}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://htsapi.com/v1/hts/{code}', 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://htsapi.com/v1/hts/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://htsapi.com/v1/hts/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://htsapi.com/v1/hts/{code}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://htsapi.com/v1/hts/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"description": "<string>",
"code": "<string>",
"normalized_code": "<string>",
"indent": 123,
"chapter": "<string>",
"heading": "<string>",
"subheading": "<string>",
"rates": {
"general": "<string>",
"special": "<string>",
"other": "<string>"
},
"units": [
"<string>"
],
"footnotes": [
{
"marker": "<string>",
"value": "<string>"
}
],
"hierarchy": [
{
"code": "<string>",
"description": "<string>"
}
],
"children": [
{
"id": 123,
"description": "<string>",
"code": "<string>",
"normalized_code": "<string>",
"indent": 123,
"chapter": "<string>",
"heading": "<string>",
"subheading": "<string>",
"rates": {
"general": "<string>",
"special": "<string>",
"other": "<string>"
},
"units": [
"<string>"
],
"footnotes": [
{
"marker": "<string>",
"value": "<string>"
}
]
}
]
}
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}API Reference
Get HTS Code by Code
Fetch a single HTS code with hierarchy, children, duty rates, units, and footnotes
GET
/
hts
/
{code}
Get HTS Code by Code
curl --request GET \
--url https://htsapi.com/v1/hts/{code} \
--header 'Authorization: Bearer <token>'import requests
url = "https://htsapi.com/v1/hts/{code}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://htsapi.com/v1/hts/{code}', 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://htsapi.com/v1/hts/{code}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://htsapi.com/v1/hts/{code}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://htsapi.com/v1/hts/{code}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://htsapi.com/v1/hts/{code}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"description": "<string>",
"code": "<string>",
"normalized_code": "<string>",
"indent": 123,
"chapter": "<string>",
"heading": "<string>",
"subheading": "<string>",
"rates": {
"general": "<string>",
"special": "<string>",
"other": "<string>"
},
"units": [
"<string>"
],
"footnotes": [
{
"marker": "<string>",
"value": "<string>"
}
],
"hierarchy": [
{
"code": "<string>",
"description": "<string>"
}
],
"children": [
{
"id": 123,
"description": "<string>",
"code": "<string>",
"normalized_code": "<string>",
"indent": 123,
"chapter": "<string>",
"heading": "<string>",
"subheading": "<string>",
"rates": {
"general": "<string>",
"special": "<string>",
"other": "<string>"
},
"units": [
"<string>"
],
"footnotes": [
{
"marker": "<string>",
"value": "<string>"
}
]
}
]
}
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}Get a single HTS code with its full hierarchy and children. This endpoint is useful for exploring the code structure and understanding parent-child relationships.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | The HTS code (e.g., ‘8517.12.00.50’) |
Example Request
curl -X GET "https://htsapi.com/v1/hts/8517.12.00.50" \
-H "Authorization: Bearer your_hts_api_key"
Example Response
{
"data": {
"id": 12345,
"code": "8517.12.00.50",
"normalized_code": "8517120050",
"description": "Telephone sets, including telephones for cellular networks or for other wireless networks",
"indent": 3,
"chapter": "85",
"heading": "8517",
"subheading": "851712",
"rates": {
"general": "Free",
"special": "Free (A+,AU,BH,CA...)",
"other": "Free"
},
"units": ["No."],
"footnotes": [],
"hierarchy": [
{
"code": "85",
"description": "Electrical machinery and equipment and parts thereof"
},
{
"code": "8517",
"description": "Telephone sets, including telephones for cellular networks or for other wireless networks"
}
],
"children": []
}
}
Response Fields
hierarchy: Array of parent codes in order from chapter to immediate parentchildren: Array of child codes (if any exist)units: Measurement units for the codefootnotes: Footnotes and additional information
Use Cases
- Explore code structure and relationships
- Build hierarchical navigation UIs
- Understand code context within the classification system
- Get complete code details including rates and units
⌘I