Back to Home

HS Code Lookup API

Search tariff codes and classify commodities with AI

https://api.compliancegrid.ai/v1/hs
7 endpoints
~45ms avg response

Overview

The HS Code Lookup API provides two ways to find the right tariff classification. Keyword search queries the official USITC Harmonized Tariff Schedule in real time, returning HTS numbers with duty rates, indent hierarchy, and statistical suffixes. AI-powered classification uses OpenAI to analyze commodity descriptions and suggest HTS codes with confidence levels and GRI reasoning. Results are enriched with live USITC data including duty rates and units of quantity.

Key Features

Real-time keyword search against the official USITC HTS database
AI-powered commodity classification with confidence levels (HIGH/MEDIUM/LOW)
General Rules of Interpretation (GRI) reasoning in AI suggestions
HTS number lookup with duty rates (general, special, other/Column 2)
Schedule B number derivation from HTS codes
USITC data enrichment: descriptions, indent hierarchy, units of quantity
6-hour in-memory cache for search results (500-entry cap)
HTS section and chapter reference data (22 sections, 99 chapters)
GRI rules reference endpoint for classification guidance

Endpoints

POST/v1/hs/search
GET/v1/hs/search?q=
POST/v1/hs/classify
GET/v1/hs/lookup/:htsNumber
GET/v1/hs/reference/sections
GET/v1/hs/reference/gri
GET/v1/hs/cache-stats
View full API reference

Quick Example

hs-lookup-example.ts
import ComplianceGrid from "@compliancegrid/sdk";

const client = new ComplianceGrid({
  apiKey: process.env.COMPLIANCEGRID_API_KEY,
});

// Search by keyword
const results = await client.hs.search({ query: "laptop computer" });
console.log(results.totalResults); // 25
console.log(results.results[0].htsNumber); // "8471.30.01.00"
console.log(results.results[0].generalDutyRate); // "Free"

// AI-powered classification
const classification = await client.hs.classify({
  description: "Stainless steel kitchen knife set with wooden handles",
  countryOfOrigin: "CN",
  intendedUse: "household kitchen use",
});

classification.suggestions.forEach((s) => {
  console.log(`${s.htsNumber} [${s.confidence}] - ${s.reasoning}`);
});

Sample Response

response.json
{
  "success": true,
  "data": {
    "query": "laptop computer",
    "totalResults": 25,
    "results": [
      {
        "htsNumber": "8471.30.01.00",
        "description": "Portable automatic data processing machines, weighing not more than 10 kg",
        "indent": 1,
        "generalDutyRate": "Free",
        "specialDutyRate": null,
        "otherDutyRate": "35%",
        "units": [],
        "chapter": "84",
        "heading": "8471",
        "subheading": "847130"
      },
      {
        "htsNumber": "8471.41.01",
        "description": "Comprising in the same housing at least a central processing unit and an input and output unit",
        "indent": 2,
        "generalDutyRate": "Free",
        "chapter": "84",
        "heading": "8471",
        "subheading": "847141"
      }
    ]
  }
}

Ready to integrate?

Get your free API key and start building in minutes.

Get API Key