# USITC HTS Tariff Lookup (`downright_blessing/usitc-hts-tariff-lookup`) Actor

Look up Harmonized Tariff Schedule (HTS) codes, product descriptions and duty rates from the official USITC HTS reststop API. Search by HTS number and/or keyword; returns structured JSON with general/special/other rates and a link to the public schedule.

- **URL**: https://apify.com/downright\_blessing/usitc-hts-tariff-lookup.md
- **Developed by:** [Joao Pedro Rosado](https://apify.com/downright_blessing) (community)
- **Categories:** Other, Developer tools, E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 hts tariff rows

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

## USITC HTS Tariff Lookup

Look up **US Harmonized Tariff Schedule (HTS)** codes, product descriptions and **duty rates** from the official **USITC HTS reststop** API. Search by HTS number and/or keyword; get structured JSON with general / special / other rates plus a link to the public schedule.

No API key. Public US government tariff data used by importers, customs brokers, logistics and trade-compliance teams.

**Official UI:** [hts.usitc.gov](https://hts.usitc.gov/)\
**REST endpoint used:** `GET https://hts.usitc.gov/reststop/search?keyword=…`\
**Releases:** `GET https://hts.usitc.gov/reststop/releaseList`

***

### What it does

1. Accepts a list of **HTS codes** (`8471.30.01.00`, `6109.10`, …) and/or a free-text **keyword** (`aluminum wire`, `coffee`).
2. Calls the official USITC reststop `search` endpoint for each query (optional throttle + optional release pin).
3. Writes one Dataset row per HTS line: `code`, `description`, `general` / `special` / `other` duty fields, units, footnotes, and a deep link to the public UI.

#### Notes

- Partial codes work (prefix match) — e.g. `8471.30` returns portable ADP machines and related lines.
- Keyword search is description-based; results can include heading/subheading rows without a full 10-digit code.
- Duty fields mirror the API: `general` (Column 1), `special` (preferential), `other` (Column 2), plus `additionalDuties` / `quotaQuantity` when present.
- Schedule release defaults to the **current** entry from `releaseList` (e.g. `2026HTSRev19`); override with `release` if you need a pinned revision.

### Who it's for

- Importers and customs brokers classifying goods into the US HTS
- Logistics / landed-cost tools that need current duty rates as JSON
- Trade compliance and Section 301 / preferential-rate research pipelines
- Agents and ETL jobs that need **official** USITC HTS data (not scraped HTML)

### Input summary

| Field | Required | Description |
|---|---|---|
| `htsCodes` | no\* | List of HTS numbers (full or partial), with or without dots |
| `keyword` | no\* | Free-text description search |
| `maxItems` | no | Hard Dataset cap (default 50, max 5000) |
| `requestDelayMs` | no | Delay between reststop calls in ms (default 150) |
| `release` | no | Optional USITC release name (empty = current) |

\*Provide at least one of `htsCodes` or `keyword`.

### Output fields

One Dataset row per HTS line:

`code`, `description`, `general`, `special`, `other`, `additionalDuties`, `quotaQuantity`, `units`, `indent`, `statisticalSuffix`, `footnotes`, `link`, `release`, `matchType`, `query`, `sourceUrl`, `raw`, `scrapedAt`.

### Pricing

**Pay-per-event** suggested for the Store:

- **Actor start** (`apify-actor-start`): about **$0.04** / run
- **Dataset item** (`apify-default-dataset-item`): about **$0.002–0.004** / HTS row (suggest **$0.003**)

Use `maxItems` as the spend cap. See Store pricing panel once published.

### Quick start (Apify Console)

1. Open the Actor → **Start**.
2. Paste HTS codes and/or a keyword.
3. Set `maxItems` / `requestDelayMs` if needed.
4. Run → export Dataset JSON/CSV.

```json
{
  "htsCodes": ["8471.30.01.00", "6109.10.00"],
  "keyword": "aluminum wire",
  "maxItems": 50,
  "requestDelayMs": 150
}
```

#### Local smoke

```bash
npm run local
## or: APIFY_LOCAL=1 node src/main.js
```

Writes `storage/datasets/default/000000001.json` and `storage/key_value_stores/default/OUTPUT.json`.

### Legal / data source

Data comes from the official **United States International Trade Commission (USITC)** Harmonized Tariff Schedule reststop API (`hts.usitc.gov/reststop`). Results reflect the published schedule at query time and are **not** legal advice, a binding customs ruling, or a substitute for CBP classification. Respect fair-use request rates. See [hts.usitc.gov](https://hts.usitc.gov/) and [USITC Open Data](https://www.usitc.gov/data/index.htm) for terms and release notes.

***

### Português (resumo)

Consulta códigos **HTS dos EUA**, descrições e **alíquotas** (general / special / other) pela API oficial **USITC reststop**. Aceita lista de códigos e/ou palavra-chave. Sem API key. Ideal para importadores, despachantes, landed cost e compliance. **Pay-per-event** sugerido: ~US$0,04 por execução + ~US$0,002–0,004 por item. Fonte legal = HTS oficial da USITC.

# Actor input Schema

## `htsCodes` (type: `array`):

List of Harmonized Tariff Schedule numbers to look up (full or partial), e.g. 8471.30.01.00, 6109.10, 0901.11. Digits with or without dots are accepted.

## `keyword` (type: `string`):

Optional free-text search against HTS descriptions (e.g. aluminum wire, portable computer, coffee). Combined with htsCodes when both are set; duplicates are deduped by code.

## `maxItems` (type: `integer`):

Hard Dataset row cap across all lookups and keyword hits.

## `requestDelayMs` (type: `integer`):

Throttle between reststop requests. Default 150.

## `release` (type: `string`):

Optional USITC release id (e.g. 2026HTSRev19). Leave empty to use the current published schedule.

## Actor input object example

```json
{
  "htsCodes": [
    "8471.30.01.00",
    "6109.10.00.15"
  ],
  "keyword": "aluminum wire",
  "maxItems": 50,
  "requestDelayMs": 150,
  "release": ""
}
```

# Actor output Schema

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

Default dataset items: code, description, duty rates, units, link.

# 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 = {
    "htsCodes": [
        "8471.30.01.00",
        "6109.10.00.15"
    ],
    "keyword": "aluminum wire"
};

// Run the Actor and wait for it to finish
const run = await client.actor("downright_blessing/usitc-hts-tariff-lookup").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 = {
    "htsCodes": [
        "8471.30.01.00",
        "6109.10.00.15",
    ],
    "keyword": "aluminum wire",
}

# Run the Actor and wait for it to finish
run = client.actor("downright_blessing/usitc-hts-tariff-lookup").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 '{
  "htsCodes": [
    "8471.30.01.00",
    "6109.10.00.15"
  ],
  "keyword": "aluminum wire"
}' |
apify call downright_blessing/usitc-hts-tariff-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,downright_blessing/usitc-hts-tariff-lookup"
        }
    }
}
```

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/FoLb6du5vUGDMnU2H/builds/QsHUH2EQnlPC1ZIdB/openapi.json
