# AI HS Code Classifier: HTS, TARIC & UK Tariff Codes (`messnomore/hs-code-classifier`) Actor

Classify product descriptions into 6-digit HS codes with AI, then map them to US HTS, EU TARIC and UK tariff codes with base duty rates, confidence scores and reasoning. Batch customs classification for e-commerce and logistics.

- **URL**: https://apify.com/messnomore/hs-code-classifier.md
- **Developed by:** [Wong Xian Qi](https://apify.com/messnomore) (community)
- **Categories:** E-commerce, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.50 / 1,000 classified products

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does AI HS Code Classifier do?

**AI HS Code Classifier** turns product titles and descriptions into **6-digit Harmonized System (HS) codes** in bulk, then maps each code to the **US HTS (10-digit)**, **EU TARIC (10-digit)** and **UK commodity code**, with the **base duty rate**, a **confidence score**, short **reasoning** and **alternative codes**. Low-confidence results are flagged for human review.

The AI never invents national codes: it chooses only from lines returned live by official tariff sources, the [USITC Harmonized Tariff Schedule](https://hts.usitc.gov/) and the [UK Trade Tariff](https://www.trade-tariff.service.gov.uk/) (whose Northern Ireland service applies EU TARIC measures). Use it in Apify Console with no code, or as an **HS code lookup API** from your own scripts.

### Why use AI HS Code Classifier?

Classifying a catalogue by hand means reading tariff chapters, notes and subheadings for every SKU, then repeating the lookup for every country you ship to. AI HS Code Classifier does the first pass for you:

- 🧠 **AI classification with reasoning**: applies the General Interpretative Rules and explains the heading it chose, plus up to 3 alternative HS codes.
- ✅ **Checked against official tariffs**: the 6-digit code is re-checked against the official subheading texts, and the 10-digit codes come straight from USITC and the UK Trade Tariff.
- 🌍 **US, EU and UK in one run**: national tariff code, base duty rate (US general/MFN rate, EU and UK third-country duty) and UK VAT.
- 🚩 **Review flags**: every result has a confidence score; anything below your threshold is marked `needsReview` with the reason.
- 📦 **Batch processing**: up to 10,000 products per run, with any extra fields you have (material, brand, intended use).
- 🤖 **Apify platform features**: run it on a schedule, call it by API, or send the results to Slack, email, Google Sheets, Make or Zapier with [integrations](https://docs.apify.com/platform/integrations).

Who uses it: **e-commerce sellers and marketplaces** preparing cross-border listings, **customs brokers and freight forwarders** pre-classifying shipments, **sourcing and trade compliance teams** estimating landed cost.

### What data does AI HS Code Classifier return?

| Field | Description |
| --- | --- |
| `sku`, `title`, `inputIndex` | Your product identifier, title and position in the input list |
| `hs6` | 6-digit HS subheading, e.g. `610910` |
| `hs6Description` | Official heading and subheading text |
| `national[].country` | `US`, `EU` or `UK` |
| `national[].code` | 10-digit national tariff code (US format `6109.10.0012`) |
| `national[].generalDutyRate` | Base duty rate as published, e.g. `16.5%` or `12.00 %` |
| `national[].vatRate` | UK standard VAT (UK only) |
| `national[].selection` | How the line was chosen: `only-candidate`, `ai` or `ai-assumed`; when no line is given: `not-determined` (pick from `otherCandidates`), `not-found` or `source-error` |
| `national[].otherCandidates` | Other national lines under the same HS code |
| `confidence` | 0 to 1 |
| `reasoning` | 2 to 4 sentences: heading, deciding rule, product facts used |
| `needsReview`, `reviewReasons` | Whether a human should check the result, and why |
| `alternatives` | Other plausible HS codes |
| `missingInformation` | Facts that would make the classification certain (e.g. fibre content) |

The run's **SUMMARY** record lists counts, skipped input items and any products that could not be classified.

### How to classify products with AI HS Code Classifier

1. Click **Try for free** and open the **Input** tab.
2. Paste your products as JSON, each with at least a `title` or `description`.
3. Choose the **destination tariffs** (US, EU, UK) and the **minimum confidence**.
4. Set **Maximum products** and click **Start**.
5. When the run finishes, open the **Output** tab. The **National codes and duty** view shows one row per product and country; filter on `needsReview` to see what needs a second look.

### How much does it cost to classify HS codes?

AI HS Code Classifier uses **pay-per-event pricing**: you pay **$0.01 per classified product** (all destination tariffs included), plus a start fee of $0.00005 per run. There is no charge for compute time.

- 100 products cost **$1.00**; 1,000 products cost **$10.00**.
- Products that cannot be classified are **not charged**.
- **Maximum products** is a hard cap, and Apify also stops charging when your run reaches the maximum cost you set.
- On the Apify free plan, each run classifies up to 20 products.

### How accurate is it?

We tested the classifier on **89 real US Customs (CBP) classification rulings** from 2024–2026, comparing its HS code with the one CBP issued:

| Measure | Result |
| --- | --- |
| Exact 6-digit HS code | 70% |
| Correct code among the answer and its alternatives | 85% |
| Exact HS code when confidence ≥ 0.85 | 90% |

Rulings are requested for products that are hard to classify (craft kits, machine parts, medical devices), so everyday catalogue items usually do better. Treat the output as a well-reasoned first pass and review flagged items.

### Input

See the **Input** tab for every option. Example input:

```json
{
    "products": [
        {
            "sku": "A1",
            "title": "Men's cotton crew-neck T-shirt",
            "description": "100% cotton, knitted jersey, short sleeves",
            "material": "cotton"
        },
        { "sku": "B2", "title": "Wireless Bluetooth earbuds with charging case" }
    ],
    "destinations": ["US", "EU", "UK"],
    "minConfidence": 0.7,
    "reasoningLanguage": "en",
    "maxProducts": 1000
}
```

- **products**: any extra text fields (brand, gender, intendedUse, size, voltage) are passed to the AI as product facts.
- **minConfidence**: results below it get `needsReview: true`. Raise it to 0.85 if every flagged item will be checked by an expert.
- **reasoningLanguage**: `en` or `zh` (Simplified Chinese).

### Output

You can download the dataset in various formats such as **JSON, HTML, CSV or Excel**. Example result:

```json
{
    "sku": "A1",
    "title": "Men's cotton crew-neck T-shirt",
    "hs6": "610910",
    "hs6Description": "T-shirts, singlets, tank tops and similar garments, knitted or crocheted > Of cotton",
    "chapter": "61",
    "national": [
        {
            "country": "US",
            "code": "6109.10.0012",
            "description": "Of cotton > Men's or boys' > Other T-shirts > Men's",
            "generalDutyRate": "16.5%",
            "dutyRateType": "General (column 1, MFN) rate",
            "vatRate": null,
            "selection": "ai",
            "selectionNote": "The product is a men's cotton T-shirt, and the all-white T-shirt line would require a colour and trim fact that the product does not state, so the general men's T-shirt line applies.",
            "otherCandidates": [
                "6109.10.0004",
                "6109.10.0007",
                "6109.10.0011",
                "6109.10.0014",
                "6109.10.0018",
                "6109.10.0023",
                "6109.10.0027",
                "6109.10.0037",
                "6109.10.0040",
                "6109.10.0045"
            ],
            "source": "USITC HTS REST API (hts.usitc.gov)"
        },
        {
            "country": "EU",
            "code": "6109100010",
            "description": "Of cotton > T-shirts",
            "generalDutyRate": "12.00 %",
            "dutyRateType": "Third country duty (ERGA OMNES)",
            "vatRate": null,
            "selection": "ai",
            "selectionNote": "The product is a cotton T-shirt, which matches the specific EU T-shirts line without needing further assumptions.",
            "otherCandidates": [
                "6109100090"
            ],
            "source": "UK Trade Tariff API, Northern Ireland (XI) tariff applying EU TARIC measures (Open Government Licence v3.0)"
        },
        {
            "country": "UK",
            "code": "6109100010",
            "description": "Of cotton > T-shirts",
            "generalDutyRate": "12.00 %",
            "dutyRateType": "Third country duty",
            "vatRate": "20.00 %",
            "selection": "ai",
            "selectionNote": "The product is a cotton T-shirt, which matches the specific UK T-shirts line without needing further assumptions.",
            "otherCandidates": [
                "6109100090"
            ],
            "source": "UK Trade Tariff API (GOV.UK, Open Government Licence v3.0)"
        }
    ],
    "confidence": 0.95,
    "reasoning": "The product is a men's knitted cotton crew-neck T-shirt with short sleeves, 100% cotton by material. Under heading 6109 (T-shirts, singlets and other vests, knitted or crocheted), the subheading 610910 covers goods of cotton, which matches the stated material exactly. Heading 6105 covers shirts rather than T-shirts, so 610510 is a weaker alternative, and 610990 applies only to non-cotton textiles.",
    "needsReview": false,
    "reviewReasons": [],
    "alternatives": [
        "610510",
        "610990"
    ],
    "missingInformation": [],
    "inputIndex": 0
}
```

### Use AI HS Code Classifier as an API

```bash
curl -X POST "https://api.apify.com/v2/acts/messnomore~hs-code-classifier/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"products":[{"sku":"A1","title":"Men'\''s cotton crew-neck T-shirt","material":"cotton"}],"destinations":["US","EU","UK"]}'
```

See the **API** tab for clients in JavaScript and Python. You can also run it from AI assistants through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp).

### Tips for better results

- Give the **material and its share** ("60% cotton, 40% polyester"), how textiles are made (**knitted or woven**) and **who it is for** (men's, women's, children's).
- Say **what it does** and **how it is powered** for machines and electronics, and list the **contents of sets and kits**.
- Look at `missingInformation`: adding those facts usually lifts the confidence.
- Use the `national[].otherCandidates` list when the 10-digit line depends on facts you did not supply.

### Related guides

- [How do you find the HS code for a product, and its US, EU and UK tariff codes?](https://wong13977-oss.github.io/hs-code-lookup/)
- [中文指南：商品HS编码怎么查？美国HTS、欧盟TARIC、英国商品编码查询方法](https://wong13977-oss.github.io/zh/hs-code-lookup/)

### FAQ

#### How does the classification work?

Each product goes through three steps. First, Claude (Anthropic) proposes an HS code with alternatives, following the General Interpretative Rules and the Section and Chapter notes. Second, the official subheading texts of every heading it considered are fetched, and the AI must pick the final code from that official list. Third, the national 10-digit lines under that code are fetched for each destination; if there is more than one, the AI picks the line that matches the product facts, and if there is only one it is used directly.

#### Are the duty rates the final duty I will pay?

No. The rate shown is the **base rate**: the US general (column 1, MFN) rate and the EU and UK third-country duty. It does **not** include US additional duties under Chapter 99 (such as Section 301, 232 or other tariff actions), anti-dumping or countervailing duties, preferential rates under trade agreements, quotas, excise, or import VAT (except the UK standard VAT rate shown). Check the official tariff or your customs broker before you declare goods.

#### Is the result legally binding?

No. Only customs authorities issue binding classifications (US CBP rulings, EU Binding Tariff Information, UK Advance Tariff Rulings). This Actor gives a reasoned suggestion for reference; the importer remains responsible for the declared code.

#### Which tariffs and sources are covered?

US: USITC Harmonized Tariff Schedule (public domain). UK: UK Trade Tariff (UK Global Tariff). EU: the Northern Ireland tariff of the UK Trade Tariff service, which applies EU TARIC measures. UK and EU data: contains public sector information licensed under the Open Government Licence v3.0.

#### How fresh is the tariff data?

Tariff lines and rates are fetched live from the official services and cached for up to 24 hours.

#### Why did I get fewer results than I asked for?

Products without a title or description are skipped, products the AI could not classify are not charged, and runs stop at **Maximum products**, at your maximum cost per run, or at 20 products on the Apify free plan. The SUMMARY record lists each case.

#### Is my product data stored or shared?

Your product text is sent to the Anthropic API only to classify it, and AI HS Code Classifier doesn't write it to its logs. Like every Apify run, your input and results stay in your own run storage, which you can delete at any time.

#### I found a wrong code or a missing country. What can I do?

Open the **Issues** tab and include the product text and the code you expected. Feedback and feature requests are welcome there too.

# Actor input Schema

## `products` (type: `array`):

Products to classify, one object each. Give at least a "title" or "description"; "sku", "material" and "category" help, and any extra text fields (brand, intendedUse, size, gender) are used as product facts. Material, function and who it is for decide most codes.

## `destinations` (type: `array`):

National tariffs to map each HS code to: US = USITC Harmonized Tariff Schedule (10-digit HTS), EU = EU TARIC (10-digit), UK = UK Global Tariff (10-digit commodity code). Each adds the base duty rate.

## `minConfidence` (type: `number`):

Results with a confidence below this value (0 to 1) are flagged "needsReview": true. 0.7 lets most products through; use 0.85 when every flagged item must be checked by a customs expert anyway.

## `reasoningLanguage` (type: `string`):

Language of the classification reasoning and notes.

## `maxProducts` (type: `integer`):

Stop after this many products are classified. It also caps the cost of a run.

## Actor input object example

```json
{
  "products": [
    {
      "sku": "A1",
      "title": "Men's cotton crew-neck T-shirt",
      "description": "100% cotton, knitted jersey, short sleeves",
      "material": "cotton"
    },
    {
      "sku": "B2",
      "title": "Wireless Bluetooth earbuds with charging case",
      "description": "True wireless stereo earphones with built-in microphone"
    },
    {
      "sku": "C3",
      "title": "Vacuum-insulated stainless steel water bottle 750 ml",
      "material": "stainless steel"
    }
  ],
  "destinations": [
    "US"
  ],
  "minConfidence": 0.7,
  "reasoningLanguage": "en",
  "maxProducts": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "products": [
        {
            "sku": "A1",
            "title": "Men's cotton crew-neck T-shirt",
            "description": "100% cotton, knitted jersey, short sleeves",
            "material": "cotton"
        },
        {
            "sku": "B2",
            "title": "Wireless Bluetooth earbuds with charging case",
            "description": "True wireless stereo earphones with built-in microphone"
        },
        {
            "sku": "C3",
            "title": "Vacuum-insulated stainless steel water bottle 750 ml",
            "material": "stainless steel"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("messnomore/hs-code-classifier").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "products": [
        {
            "sku": "A1",
            "title": "Men's cotton crew-neck T-shirt",
            "description": "100% cotton, knitted jersey, short sleeves",
            "material": "cotton",
        },
        {
            "sku": "B2",
            "title": "Wireless Bluetooth earbuds with charging case",
            "description": "True wireless stereo earphones with built-in microphone",
        },
        {
            "sku": "C3",
            "title": "Vacuum-insulated stainless steel water bottle 750 ml",
            "material": "stainless steel",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("messnomore/hs-code-classifier").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "products": [
    {
      "sku": "A1",
      "title": "Men'\''s cotton crew-neck T-shirt",
      "description": "100% cotton, knitted jersey, short sleeves",
      "material": "cotton"
    },
    {
      "sku": "B2",
      "title": "Wireless Bluetooth earbuds with charging case",
      "description": "True wireless stereo earphones with built-in microphone"
    },
    {
      "sku": "C3",
      "title": "Vacuum-insulated stainless steel water bottle 750 ml",
      "material": "stainless steel"
    }
  ]
}' |
apify call messnomore/hs-code-classifier --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,messnomore/hs-code-classifier"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jYaMOiv1cFxg5T6XZ/builds/a6EIWqLAlZpoNNma5/openapi.json
