Search HTS Codes
curl --request GET \
--url https://htsapi.com/v1/hts \
--header 'Authorization: Bearer <token>'import requests
url = "https://htsapi.com/v1/hts"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://htsapi.com/v1/hts")
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>"
}
]
}
],
"meta": {
"total": 123,
"page": 123,
"limit": 123,
"total_pages": 123
},
"clarification": {
"needed": true,
"message": "<string>",
"suggestions": [
"<string>"
],
"grouped_by": "heading"
},
"ai_context": "<string>"
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}API Reference
Get HTS Codes
Search US HTS codes by keyword, code prefix, or chapter/heading/subheading filters
GET
/
hts
Search HTS Codes
curl --request GET \
--url https://htsapi.com/v1/hts \
--header 'Authorization: Bearer <token>'import requests
url = "https://htsapi.com/v1/hts"
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', 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",
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"
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")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://htsapi.com/v1/hts")
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>"
}
]
}
],
"meta": {
"total": 123,
"page": 123,
"limit": 123,
"total_pages": 123
},
"clarification": {
"needed": true,
"message": "<string>",
"suggestions": [
"<string>"
],
"grouped_by": "heading"
},
"ai_context": "<string>"
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}Search HTS codes using full-text search, code prefix matching, or hierarchical filtering. Returns paginated results with optional clarification suggestions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | No | Full-text search query (max 500 chars) |
code | string | No | Exact or prefix code match (e.g., ‘8517’ or ‘8517.12’) |
chapter | string | No | Filter by chapter (2 digits, e.g., ‘85’) |
heading | string | No | Filter by heading (4 digits, e.g., ‘8517’) |
subheading | string | No | Filter by subheading (6 digits, e.g., ‘851712’) |
page | integer | No | Page number (default: 1, min: 1) |
limit | integer | No | Results per page (default: 25, min: 1, max: 100) |
Example Request
curl -X GET "https://htsapi.com/v1/hts?q=coffee&page=1&limit=25" \
-H "Authorization: Bearer your_hts_api_key"
Example Response
{
"data": [
{
"id": 12345,
"code": "0901.11.00",
"normalized_code": "09011100",
"description": "Coffee, not roasted, not decaffeinated",
"indent": 2,
"chapter": "09",
"heading": "0901",
"subheading": "090111",
"rates": {
"general": "Free",
"special": "Free (A+,AU,BH,CA...)",
"other": "Free"
},
"units": [],
"footnotes": []
}
],
"meta": {
"total": 45,
"page": 1,
"limit": 25,
"total_pages": 2
},
"clarification": {
"needed": true,
"message": "Your search for \"coffee\" returned multiple classifications. Please refine your search:",
"suggestions": [
"Unroasted (green) coffee - 0901.11 or 0901.12",
"Roasted coffee - 0901.21 or 0901.22",
"Decaffeinated coffee - specify roasted (0901.22) or unroasted (0901.12)",
"Note: Instant/soluble coffee is classified under 2101.11, not 0901"
],
"grouped_by": "heading"
}
}
Clarifications
When a search returns multiple classifications, the API includes aclarification object with suggestions to help refine your search. Business plans can also receive ai_context with AI-assisted guidance.Authorizations
API key as Bearer token. Format: Bearer your_hts_api_key
Query Parameters
Full-text search query
Maximum string length:
500Exact or prefix code match (e.g., '8517' or '8517.12')
Maximum string length:
50Filter by chapter (2 digits, e.g., '85')
Maximum string length:
10Filter by heading (4 digits, e.g., '8517')
Maximum string length:
10Filter by subheading (6 digits, e.g., '851712')
Maximum string length:
10Page number (default: 1)
Required range:
x >= 1Results per page (max: 100, default: 25)
Required range:
1 <= x <= 100