# HS Code Classifier - Bulk Product to HS, HTS & CN Codes (`helenisapi/hs-code-classifier`) Actor

HS code classifier: product titles, descriptions or page links in, 6-digit HS 2022 code out with confidence and reasoning, plus the US HTS line with duty rate or the EU CN line. 📦

- **URL**: https://apify.com/helenisapi/hs-code-classifier.md
- **Developed by:** [Helenis API](https://apify.com/helenisapi) (community)
- **Categories:** E-commerce, AI, Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$7.50 / 1,000 products classified

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/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

## 📦 HS Code Classifier - Bulk Product to HS, HTS & CN Codes

**Give every product in your catalogue its customs code, in minutes.** Paste product titles or descriptions (any language), product page links, or the dataset of another scraper, and get for each product its **6-digit HS code**, a **confidence** score, the **reasoning**, the official **chapter, heading and subheading texts**, and on request the **US HTS 10-digit line with its duty rate** or the **EU Combined Nomenclature 8-digit line**.

No API key: paste your products and hit **Run**.

***

### ⚡ Why this actor?

- 🎯 **Accurate:** 106 of 108 test products classified exactly at 6 digits (98%), all 108 within the top 3 candidates.
- ✅ **Real codes only:** every code is checked against the HS 2022 nomenclature; the AI never invents one.
- 🇺🇸 **US duty rate:** the HTS statistical line and its general (MFN) duty, live from the USITC.
- 🇪🇺 **EU CN code:** the 8-digit Combined Nomenclature line for European declarations.
- 🤔 **Explainable:** a one-line reasoning and the facts to confirm (fibre content, knitted or woven...).
- 🧩 **Chains with scrapers:** classify the output of a Shopify, Amazon or marketplace scraper by its dataset ID.
- 💸 **Cheap:** pay per product classified; failed products are free.

***

### 📊 What data do you get?

One row per product:

| Field | Description | Example |
|---|---|---|
| `input` | Your product text or link | `Men's short-sleeve crew-neck T-shirt, 100% cotton jersey` |
| `hsCode` / `hsCodeFormatted` | Best 6-digit HS code | `610910` / `6109.10` |
| `confidence` | 0 to 1 | `1.0` |
| `description` | Official subheading text | `T-shirts, singlets and other vests; of cotton, knitted or crocheted` |
| `heading` / `chapter` / `section` | Hierarchy, with their descriptions | `6109` / `61` / `XI` |
| `reasoning` | Why this code | `A knitted cotton T-shirt: heading 6109, cotton subheading.` |
| `nationalCode` / `nationalDescription` | HTS or CN line (option) | `6109100012` / `Of cotton › Men's or boys' › ... Men's (338)` |
| `generalDuty` | US general duty rate | `16.5%` |
| `alternatives` | Other plausible codes | `[{"hsCode": "610990", "confidence": 0.1}]` |
| `toConfirm` | Facts that would change the code | `["Fibre content"]` |
| `error` | Why a product was skipped | `{"code": "not_classifiable"}` |

***

### 🚀 How to use it

1. Paste your **product descriptions**, one per line, and/or **product page links**, or give the **dataset ID** of a scraper run.
2. Pick a **national tariff line** (United States or European Union) if you need one.
3. Click **Run**, then export the table (CSV, Excel, JSON).

#### Input example

```json
{
  "products": [
    "Men's short-sleeve crew-neck T-shirt, 100% cotton jersey",
    "Wireless Bluetooth earbuds with charging case",
    "Roasted coffee beans, Arabica, 1 kg bag"
  ],
  "country": "US",
  "maxResults": 3
}
```

#### Output example

```json
{
  "input": "Men's short-sleeve crew-neck T-shirt, 100% cotton jersey",
  "inputType": "description",
  "success": true,
  "hsCode": "610910",
  "hsCodeFormatted": "6109.10",
  "confidence": 1.0,
  "description": "T-shirts, singlets and other vests; of cotton, knitted or crocheted",
  "heading": "6109",
  "headingDescription": "T-shirts, singlets and other vests; knitted or crocheted",
  "chapter": "61",
  "chapterDescription": "Apparel and clothing accessories; knitted or crocheted",
  "section": "XI",
  "reasoning": "The product is a knitted T-shirt made of cotton, which is specifically provided for in heading 6109 under GIR 1 and 6.",
  "country": "US",
  "nationalCode": "6109100012",
  "nationalCodeFormatted": "6109.10.00.12",
  "nationalDescription": "Of cotton › Men's or boys' › Other T-shirts › Men's (338)",
  "generalDuty": "16.5%",
  "alternatives": [],
  "toConfirm": [],
  "product": "A men's short-sleeve crew-neck T-shirt made of 100% cotton jersey knit fabric.",
  "edition": "HS 2022"
}
```

***

### 💰 Pricing

Pay per event, no subscription:

| Event | Price |
|---|---|
| `product-classified` | $0.0075 per product (national line included) |

1,000 products cost **$7**, where HS classification APIs charge $11 to $100. Products that fail (unreadable page, not a physical good) are **not charged**.

🆓 **Apify free plan:** the first **10 products** of each run are classified. Upgrade your Apify plan to classify whole catalogues.

***

### 💡 Use cases

- **Cross-border e-commerce:** an HS code on every product before you ship abroad
- **Marketplaces:** classify sellers' listings and flag low-confidence ones for review
- **Freight forwarders and customs brokers:** a first proposal with reasoning, the expert only reviews
- **Landed cost:** HS code and US duty rate for a whole catalogue
- **ERP and PIM clean-up:** fill or audit the tariff code column

***

### ❓ FAQ

**Can I declare these codes as they are?**
They are a classification aid, not a binding ruling: have them confirmed by a licensed customs broker before you declare goods.

**Which HS edition?**
HS 2022, with the 2026 EU Combined Nomenclature and the current US HTS. The data is updated when HS 2027 open data is published.

**Does the US duty include Section 301 or reciprocal tariffs?**
No, `generalDuty` is the general (MFN) rate of the HTS line. Additional Chapter 99 duties depend on the origin.

**What should I write in the description?**
What the article is, its material and its use: "Women's jeans, 98% cotton denim" beats "jeans". Brand titles from marketplaces work too.

***

### 🔗 Also available as an API

The same classification, plus code lookup and keyword search, is available as a REST API on RapidAPI: **HS Code Classifier - AI Customs Tariff Lookup**.

***

### 🤖 Use it from an AI agent

Add this actor to **Claude, ChatGPT, Cursor, VS Code** or any MCP client with one URL (sign in with your Apify account):

```
https://mcp.apify.com?tools=helenisapi/hs-code-classifier
```

Your agent then calls it as a tool, with the input described above, and pays per event like a normal run. In code: `ApifyActorsTool("helenisapi/hs-code-classifier")` in LangChain or CrewAI; in **n8n**, **Make** or **Zapier**, use the Apify app and pick this actor.

# Actor input Schema

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

Products to classify, one title or description per item, in any language, e.g. \["Men's T-shirt, 100% cotton, knitted", "Roasted coffee beans, Arabica, 1 kg bag"]. Material, use and how it is made help. Up to 2,000 characters each and 5,000 products per run. Required unless `productUrls` or `datasetId` is set. Each product returns one row with its HS code, confidence and reasoning.

## `productUrls` (type: `array`):

Public product pages to read and classify, one URL per item, e.g. \["https://shop.example.com/products/linen-shirt"]. The page title, product data and description are read. Pages that need JavaScript to show their text cannot be read: put their description in `products` instead. Optional.

## `datasetId` (type: `string`):

ID of an existing Apify dataset whose items are products, e.g. the output of a Shopify or marketplace scraper. Each item's title (title, name...) and description are combined, or the field set in `datasetTextField` is read; an item without text is classified from its url, productUrl or link field. Alternative or addition to `products`.

## `datasetTextField` (type: `string`):

Name of the field holding the product text in the items of `datasetId`, e.g. "bodyHtml". Leave empty to combine the title (title, name, productTitle, productName) and the description (description, body, productDescription, text). Ignored without `datasetId`.

## `country` (type: `string`):

Also return a national tariff line for the best code, at no extra charge. "" (default): none, 6-digit HS only. "US": the 10-digit HTS statistical line with its general (MFN) duty rate. "EU": the 8-digit Combined Nomenclature line.

## `maxResults` (type: `integer`):

Candidate HS codes per product, 1-3 (default 3), best first. The best one fills the main columns; the others go to `alternatives`, and only when they are plausible.

## `maxConcurrency` (type: `integer`):

How many products are classified at the same time, 1-10 (default 5), e.g. 10 for a large catalogue. It changes the speed only, not the results or the price.

## Actor input object example

```json
{
  "products": [
    "Men's short-sleeve crew-neck T-shirt, 100% cotton jersey",
    "Wireless Bluetooth earbuds with charging case",
    "Roasted coffee beans, Arabica, 1 kg bag"
  ],
  "country": "",
  "maxResults": 3,
  "maxConcurrency": 5
}
```

# Actor output Schema

## `products` (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": [
        "Men's short-sleeve crew-neck T-shirt, 100% cotton jersey",
        "Wireless Bluetooth earbuds with charging case",
        "Roasted coffee beans, Arabica, 1 kg bag"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("helenisapi/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": [
        "Men's short-sleeve crew-neck T-shirt, 100% cotton jersey",
        "Wireless Bluetooth earbuds with charging case",
        "Roasted coffee beans, Arabica, 1 kg bag",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("helenisapi/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": [
    "Men'\''s short-sleeve crew-neck T-shirt, 100% cotton jersey",
    "Wireless Bluetooth earbuds with charging case",
    "Roasted coffee beans, Arabica, 1 kg bag"
  ]
}' |
apify call helenisapi/hs-code-classifier --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,helenisapi/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/jufXkp6hdW3l3vmBN/builds/p0z57LhOWRxgXG2fj/openapi.json
