# HS Code & Import Duty API: UK Tariff and US HTS Rates (`tudorlane/hs-tariff-code`) Actor

Find HS/commodity codes from a product description and get import duty rates: UK third-country duty, VAT and preferential rate by origin country, plus US HTS general and special rates.

- **URL**: https://apify.com/tudorlane/hs-tariff-code.md
- **Developed by:** [Tudor Lane](https://apify.com/tudorlane) (community)
- **Categories:** Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 tariff lookups

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/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

## HS Code & Import Duty API: UK Tariff and US HTS Rates

**Use when:** a cross-border e-commerce, customs or logistics agent needs a commodity code and import duty for a product: UK 10-digit commodity code with third-country duty, import VAT and the preferential rate for an origin country, plus US HTS general, special and column 2 rates.

**Try this input**

```json
{"requests": [{"q": "ceramic coffee mug", "origin": "CN"}, {"code": "6109100010", "origin": "VN"}, {"q": "lithium ion battery", "markets": ["US"]}]}
```

**Sample output** (one item, shortened)

```json
{"query": "6109100010", "origin": "VN",
 "uk": [{"code": "6109100010", "description": "T-shirts", "declarable": true, "uk_third_country_duty": "12.00%", "uk_vat": "0.00%",
         "uk_preferential": {"rate": "0.00%", "area": "CPTPP All Members", "note": "Needs proof of origin under the trade agreement or scheme."}}],
 "us": [{"hts": "6109.10.00", "description": "Of cotton", "general_rate": "16.5%", "special_rate": "Free (AU,BH,CL,...)", "column2_rate": "90%"}, "..."],
 "best_hs6": "610910", "error": null}
```

Each item is a code (4 to 10 digits) or a text query `q`, with optional `origin` (ISO country), `markets` (`["UK","US"]`) and `limit`. `best_hs6` gives the 6-digit HS code shared by the UK and US results. Up to 500 items per run.

**Pricing:** pay per event, **$0.003 per tariff lookup**. Rows with errors are not charged.

### Limits & failure modes

- Text search maps common product words (mug, laptop, smartphone, battery, t-shirt, shoes, chair and ~120 more, with material hints like ceramic/porcelain/cotton) to HS codes, then falls back to the UK Trade Tariff search. Unusual or vague descriptions can still give a loose match or none: check the description, or look up by code when you have one.
- Indicative only. Binding classification comes from HMRC (Advance Tariff Ruling) or US CBP. Extra duties (anti-dumping, quotas, US Section 301/IEEPA) are not included.
- Sources: UK Trade Tariff API (Open Government Licence v3.0) and USITC HTS (public domain).

Last tested: 29 Oct 2026.

### Use from AI agents (MCP)

- **Apify MCP server:** add `https://mcp.apify.com/?tools=tudorlane/hs-tariff-code` to Claude, Cursor, ChatGPT, VS Code or any MCP client.
- **REST:** `POST https://api.apify.com/v2/acts/tudorlane~hs-tariff-code/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input JSON.

# Actor input Schema

## `requests` (type: `array`):

Each item: {"q": "cotton t-shirt"} or {"code": "6109100010"}, optional "origin": "VN", "markets": \["UK","US"], "limit": 5. Max 500. Errors are not charged.

## Actor input object example

```json
{
  "requests": [
    {
      "q": "cotton t-shirt"
    },
    {
      "code": "6109100010",
      "origin": "VN"
    },
    {
      "q": "lithium ion battery",
      "markets": [
        "US"
      ]
    }
  ]
}
```

# Actor output Schema

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

One item per request.

## `dataset` (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 = {
    "requests": [
        {
            "q": "cotton t-shirt"
        },
        {
            "code": "6109100010",
            "origin": "VN"
        },
        {
            "q": "lithium ion battery",
            "markets": [
                "US"
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tudorlane/hs-tariff-code").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 = { "requests": [
        { "q": "cotton t-shirt" },
        {
            "code": "6109100010",
            "origin": "VN",
        },
        {
            "q": "lithium ion battery",
            "markets": ["US"],
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tudorlane/hs-tariff-code").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 '{
  "requests": [
    {
      "q": "cotton t-shirt"
    },
    {
      "code": "6109100010",
      "origin": "VN"
    },
    {
      "q": "lithium ion battery",
      "markets": [
        "US"
      ]
    }
  ]
}' |
apify call tudorlane/hs-tariff-code --silent --output-dataset

```

## MCP server setup

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

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/4s5GxafJBmazGbBUN/builds/yZ1H4E3PBcqZ7HkPM/openapi.json
