# HS Code Classifier API

> Product description, page or photo to its HS code, with confidence, US HTS duty and EU CN line.

**Every parcel that crosses a border needs an HS code, and a wrong one means delays, fines or the wrong duty.** Send a product **title**, **description**, **page URL** or **photo**, in any language, and get its **6-digit HS code** with up to 3 candidates, a **confidence** score, the **reasoning**, and the official **chapter**, **heading** and **subheading** texts. Add `country=US` for the **10-digit HTS line and its duty rate**, or `country=EU` for the **8-digit Combined Nomenclature line**. About **$0.008 per classification** on PRO: up to **12x cheaper** than other HS code APIs.

- Host: `hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com`
- Base URL: `https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes`
- Auth: headers `X-RapidAPI-Key` and `X-RapidAPI-Host`
- OpenAPI: https://helenis-api.com/docs/hs-codes/openapi.json

## Endpoints

### Classification

Product to HS code with AI, checked against the nomenclature.

#### Classify Product

`POST /v1/hs-codes/classify`

Product description, page or photo to its HS code. Classify a product into its 6-digit HS 2022 code from a description, page `url` or photo `image_url`: up to 3 real codes with confidence, reasoning and official texts; with `country`, the US HTS line (duty rate) or EU CN line. An aid, to confirm with a broker. 10 credits.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `description` | body | `string` | no | What the product is, in any language: a title, a catalogue line or a full description. Required unless `url` or `image_url` is given. | `Men's short-sleeve crew-neck T-shirt, 100% cotton jersey` |
| `material` | body | `string` | no | Material or composition, e.g. '60% cotton, 40% polyester'. | `100% cotton, knitted jersey` |
| `use` | body | `string` | no | Function or intended use, e.g. 'for passenger cars'. |  |
| `url` | body | `string` | no | A product page to read (title, description, specifications). |  |
| `image_url` | body | `string` | no | A photo of the product: PNG, JPEG, WEBP, HEIC, GIF, BMP or TIFF, up to 10 MB. |  |
| `country` | body | `"US" \| "EU"` | no | Also pick the national tariff line: `US` (HTS, 10 digits, with the general duty rate) or `EU` (Combined Nomenclature, 8 digits). | `US` |
| `max_results` | body | `integer` | no | HsCandidate codes to return, best first (1-3). Default `3`. |  |

```bash
curl -X POST "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/classify" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Men'\''s short-sleeve crew-neck T-shirt, 100% cotton jersey",
    "country": "US"
  }'
```

#### Classify Product from Image

`POST /v1/hs-codes/classify/upload`

Uploaded product photo (plus optional text) to its HS code. Same as /classify, for a photo sent as multipart/form-data (field `file`), with the same optional text fields. 10 credits.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `file` | form | `file` | yes | Product photo, up to 10 MB. |  |
| `description` | form | `string` | no | What the product is (optional). |  |
| `material` | form | `string` | no | Material or composition, e.g. '60% cotton, 40% polyester'. |  |
| `use` | form | `string` | no | Function or intended use, e.g. 'for passenger cars'. |  |
| `country` | form | `"US" \| "EU"` | no | Also pick the national tariff line: `US` (HTS, 10 digits, with the general duty rate) or `EU` (Combined Nomenclature, 8 digits). |  |
| `max_results` | form | `integer` | no | Candidate codes to return, best first (1-3). Default `3`. |  |

```bash
curl -X POST "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/classify/upload" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com" \
  -F "file=@./my-file"
```

### Lookup

HS codes, their hierarchy and national lines, and keyword search. No AI.

#### Get HS Code

`GET /v1/hs-codes/code`

An HS code with its hierarchy, children and national lines. Check that an HS 2022 code exists and get its official texts up the hierarchy, the codes under it and, with `country`, the US HTS or EU CN lines. 404 `code_not_found` when it does not exist (not billed). 1 credit.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `code` | query | `string` | yes | 2, 4, 6, 8 or 10 digits; dots and spaces are ignored. | `6109.10` |
| `country` | query | `"US" \| "EU"` | no | Also list the national lines under the code: `US` (HTS with general duty rates) or `EU` (CN). Required for 8 and 10-digit codes. | `US` |

```bash
curl -G "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/code" \
  --data-urlencode "code=6109.10" \
  --data-urlencode "country=US" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com"
```

#### Search HS Codes

`GET /v1/hs-codes/search`

Keywords to matching HS subheadings, no AI. 6-digit subheadings whose official texts match the keywords, ranked by relevance, with their chapter and heading. Instant and deterministic; use /classify when the wording of the product differs from the tariff's. 1 credit.

| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| `q` | query | `string` | yes | Words describing the goods, in English. | `cotton t-shirt` |
| `limit` | query | `integer` | no | Results, 1-25. Default `10`. |  |

```bash
curl -G "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/search" \
  --data-urlencode "q=cotton t-shirt" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com"
```

## Sample call

Classify Product: `POST /v1/hs-codes/classify`.

```bash
curl -X POST "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/classify" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Men'\''s short-sleeve crew-neck T-shirt, 100% cotton jersey",
    "country": "US"
  }'
```

## Response

```json
{
  "product": "A men's short-sleeve crew-neck T-shirt made of 100% cotton jersey knit fabric.",
  "hs_code": "610910",
  "results": [
    {
      "hs_code": "610910",
      "formatted": "6109.10",
      "section": { "code": "XI", "description": "Textiles and textile articles" },
      "chapter": { "code": "61", "description": "Apparel and clothing accessories; knitted or crocheted" },
      "heading": { "code": "6109", "description": "T-shirts, singlets and other vests; knitted or crocheted" },
      "subheading": { "code": "610910", "description": "T-shirts, singlets and other vests; of cotton, knitted or crocheted" },
      "confidence": 1.0,
      "reasoning": "The product is a knitted T-shirt made of cotton, which is specifically provided for in heading 6109 under GIR 1 and 6.",
      "national": {
        "country": "US",
        "code": "6109100012",
        "formatted": "6109.10.00.12",
        "description": "Of cotton › Men's or boys' › Other T-shirts › Men's (338)",
        "general_duty": "16.5%",
        "units": ["doz.", "kg"]
      }
    }
  ],
  "to_confirm": [],
  "inputs": ["description"],
  "edition": "HS 2022",
  "disclaimer": "Classification aid, not a binding ruling: have the code confirmed by a licensed customs broker before you declare goods."
}
```

*From a real response.* When the description leaves room for doubt, you get up to 3 candidates and the facts to check, for example a power bank: `8507.60` (lithium-ion accumulators, 0.95) then `8504.40` (static converters).

## Why developers pick this API

- 💸 **Priced for whole catalogues:** about $0.008 per classification on PRO, where HS code APIs charge $0.03 to $0.10 and Zonos Classify $0.011 to $0.05. Lookups and searches cost a tenth of that, and failed calls use 0 credits.
- ✅ **No invented codes:** a language model alone happily returns codes that do not exist. Here every code is validated against the nomenclature and comes with its official texts.
- 🎯 **Measured, not promised:** 106 of 108 test products classified exactly at 6 digits on the first answer (98%), all 108 within the top 3 (textiles, electronics, food, chemicals, auto parts, toys, marketplace titles, rule-driven cases).
- 🇺🇸🇪🇺 **National codes included:** HTS line with duty rate or CN line in the same call, where others stop at 6 digits.
- 🧾 **Explainable:** the reasoning and the facts to confirm make the answer easy to review by your broker.

## From a product page or a photo

```json
{ "url": "https://www.allbirds.com/products/womens-runner-nz-slip-on-light-grey", "country": "EU" }
```

```json
{ "image_url": "https://example.com/photos/kettle.jpg", "material": "stainless steel" }
```

The page is read like a browser would (title, product data, description); a photo is looked at by a vision model. To send a file, use `/classify/upload` with multipart field `file` and the same optional fields.

## Lookup and search

```bash
curl "https://hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com/v1/hs-codes/code?code=8517.13&country=US" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" -H "X-RapidAPI-Host: hs-code-classifier-ai-customs-tariff-lookup.p.rapidapi.com"
```

```json
{
  "hs_code": "851713",
  "formatted": "8517.13",
  "section": { "code": "XVI", "description": "Machinery and mechanical appliances; electrical equipment; ..." },
  "chapter": { "code": "85", "description": "Electrical machinery and equipment and parts thereof; ..." },
  "heading": { "code": "8517", "description": "Telephone sets, including smartphones and other telephones for cellular/wireless networks; ..." },
  "subheading": { "code": "851713", "description": "Telephone sets; smartphones for cellular or other wireless networks" },
  "level": "subheading",
  "children": [],
  "national": [
    {
      "country": "US",
      "code": "8517130000",
      "formatted": "8517.13.00.00",
      "description": "Telephone sets, including smartphones and other telephones for cellular networks or for other wireless networks › Smartphones",
      "general_duty": "Free",
      "units": ["No."]
    }
  ],
  "edition": "HS 2022"
}
```

*From a real response, section texts shortened.* Give 2, 4, 6, 8 or 10 digits (dots ignored): a chapter lists its headings, a heading its subheadings. `/search?q=lithium ion battery` returns `8507.60`, `8506.50`, `8507.80` ranked by relevance, instantly and without AI.

## Errors

| Status | `code` | Meaning |
|---|---|---|
| 400 | `missing_input` | No description, url or image_url. |
| 400 | `not_classifiable` | Not physical goods (a service, gibberish) or too vague ("parts"). Not billed. |
| 400 | `page_empty` | The page has no readable text without JavaScript: send its description instead. |
| 400 | `unsupported_file` | The image is not PNG, JPEG, WEBP, HEIC, GIF, BMP or TIFF, or is over 10 MB. |
| 400 | `invalid_code` / `country_required` | A code has 2 to 10 digits; 8 and 10-digit codes need `country`. |
| 404 | `code_not_found` | The code is not in the nomenclature. Not billed. |
| 429 | `daily_limit_reached` | Daily safety limit of your plan; resets at 00:00 UTC. |
| 503 | `ai_error` / `source_unavailable` | The AI or the USITC did not answer; retry. Not billed. |

## Honest limits

- **Material and make decide many codes.** "Jeans" alone cannot tell cotton from synthetic: give `material` and `use`, or read `to_confirm`.
- **Sets, parts and multi-function goods** are where classification is hardest; expect a lower confidence and 2-3 candidates.
- **No legal notes:** the WCO Explanatory Notes and binding rulings are not included; the model applies the Interpretative Rules from its training.
- **EU duty rates** (TARIC) are not included, only the CN code.

## Pricing

Classification 10 credits (national line included); code lookup and search 1. Failed calls are never billed.

| Plan | Price | Credits included | Above the quota |
|---|---|---|---|
| BASIC | Free | 20 / day | resets every day |
| PRO | $4.99/month | 6,000 / month | $0.01 per credit |
| ULTRA | $14.99/month | 18,000 / month | $0.01 per credit |
| MEGA | $49.99/month | 60,000 / month | $0.01 per credit |

Apify actor **HS Code Classifier - Bulk Product to HS, HTS & CN Codes**: billed per event; free-plan users get 10 products per run.

| Event | Charged for | Price |
|---|---|---|
| `product-classified` | each product classified | $0.0075 |

## Links

- API reference (HTML): https://helenis-api.com/docs/hs-codes
- OpenAPI: https://helenis-api.com/docs/hs-codes/openapi.json
- Overview and pricing: https://helenis-api.com/apis/hs-codes/
- RapidAPI listing: https://rapidapi.com/helenis-api-helenis-api-business/api/hs-code-classifier-ai-customs-tariff-lookup?utm_source=helenis&utm_medium=site&utm_campaign=hs-codes&utm_content=markdown
- Apify actor: https://apify.com/helenisapi/hs-code-classifier?utm_source=helenis&utm_medium=site&utm_campaign=hs-codes&utm_content=markdown
- MCP server (Apify): https://mcp.apify.com?tools=helenisapi/hs-code-classifier

MCP: Works in Claude, Cursor, VS Code and any MCP client; billed per event through Apify (your Apify token).

## Conventions (every Helenis API)

- Auth: two headers on every call, `X-RapidAPI-Key` (your key) and `X-RapidAPI-Host` (the API's host). One RapidAPI key works for every API you subscribe to.
- Billing in credits: one for a simple call, more for heavier work (a minute of audio, a page read by AI). Each API states its rule.
- Failed calls are never billed: a `4xx` bills zero credits and a `5xx` is never counted.
- Errors share one envelope: `{"error": {"status", "code", "message"}}` with a stable machine-readable `code`.
- `400`: fix the input (validation errors are always 400, never 422); not billed.
- `429`: rate limit; wait for `Retry-After`. `503`: temporary upstream or AI failure (`ai_error`, `upstream_timeout`); retry later, not billed.
- Values the source does not give come back as `null`, never invented.
