# US Tariff Scraper - US Import Tariff API, HTS Codes & Duty (`neverempty/us-import-tariff-api`) Actor

Official USITC Harmonized Tariff Schedule lines: duty rates parsed into percent and per-unit amounts, the full description built from the HTS hierarchy, and the trade programs that enter free. Look up by HTS number or keyword. No API key.

- **URL**: https://apify.com/neverempty/us-import-tariff-api.md
- **Developed by:** [NeverEmpty](https://apify.com/neverempty) (community)
- **Categories:** Developer tools, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $11.10 / 1,000 tariff lines

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US Import Tariff API - HTS Codes, Duty Rates & Customs Tariff

The official **US Harmonized Tariff Schedule** (USITC), turned into rows an importer or broker can actually
use: **duty rates parsed into numbers**, the **full product description** rebuilt from the tariff hierarchy,
and the **trade programs that enter free**.

Look up by **HTS number** (4, 6, 8 or 10 digits) or by **keyword**.

- **No API key, no page scraping, no proxy.** US government data, public domain.
- **10-digit lines come back with a rate**, carried down from their 8-digit parent. In the raw data they are blank.
- **Both the parsed values and the original text** are in every row, so nothing is hidden behind a guess.

### What this returns that the raw USITC data does not

| Column | Why it matters |
|---|---|
| `generalRateText` on 10-digit lines | 🔴 **In the raw schedule, 10-digit statistical lines have an empty rate.** Measured on 2026-09-01: in heading 6109 (T-shirts) **all 35** ten-digit lines are blank, in 0901 (coffee) 29 of 31. The rate lives on the 8-digit subheading. This Actor carries it down and records `rateInheritedFrom`, so `6109.10.00.04` comes back with `16.5%` instead of nothing. |
| `fullDescription` | The raw description of `0901.11.00.15` is just `"Certified organic"`. Here it is `Coffee, whether or not roasted... > Coffee, not roasted > Not decaffeinated > Arabica > Certified organic`, rebuilt from the indent levels. |
| `generalAdValoremPercent`, `generalSpecificRates` | `"16.5%"` becomes `16.5`; `"33.9¢/kg + 5.1%"` becomes a 5.1% rate plus a 33.9 US cents per kg amount; `"$1.104/kg"` is kept as dollars. 🔴 **If any part of the text cannot be read, every numeric field stays `null` and the whole text goes to `generalUnparsed`.** Chapter 99 lines read `"The duty provided in the applicable subheading + 25%"`: putting 25 in the percent column would hide the base rate, and `"... +0%"` would read as duty free. Measured on 2026-09-01, 471 of the 628 chapter 99 lines are in that shape. |
| `specialFreePrograms`, `specialClauses` | The special column is written as `Free (A,AU,BH,...)8.8¢/liter(JO)` - clauses with no separator between them, and stray spaces inside the code list. This splits it into clauses and gives you the sorted list of programs that enter duty free, so "is my country free under this line?" is one lookup. |
| `otherRateText`, `otherAdValoremPercent` | Column 2 (non-normal-trade-relations) rates, parsed the same way. |
| `units`, `footnotes`, `quotaQuantity`, `additionalDuties` | Kept as they are. USITC misspells one of these fields in its own JSON (`addiitionalDuties`); both spellings are read. |

### Input

| Field | Type | Default | Meaning |
|---|---|---|---|
| `codes` | array | `["0901"]` | HTS numbers with 4, 6, 8 or 10 digits, dots optional. Each returns the lines under it. |
| `keyword` | string | `""` | Search the schedule, for example `"espresso"`. Each hit is looked up in its own heading so the full description and the inherited rate are right; if the hits span more than 40 headings, the rest keep their own wording and `fullDescription` stays `null` instead of being guessed. |
| `includeHeadings` | boolean | `false` | Off: only 8 and 10 digit lines, the ones that carry a rate. On: also the headings and wording rows. |
| `maxRowsPerCode` | integer | `500` | Upper bound per code so a whole chapter cannot run up a bill. |
| `maxRetries` | integer | `4` | Retries when USITC does not answer. |

### Output

```json
{
  "rowType": "tariff-line",
  "requested": "6109.10.00.04",
  "htsNumber": "6109.10.00.04",
  "fullDescription": "T-shirts, singlets, tank tops and similar garments, knitted or crocheted > Of cotton > Men's or boys' > ...",
  "generalRateText": "16.5%",
  "generalAdValoremPercent": 16.5,
  "generalIsFree": false,
  "rateInheritedFrom": "6109.10.00",
  "specialFreePrograms": ["AU", "BH", "CL", "CO", "IL", "JO", "KR", "MA", "OM", "P", "PA", "PE", "S", "SG"],
  "otherRateText": "90%",
  "otherAdValoremPercent": 90,
  "units": ["doz.", "kg"]
}
```

### What it does when something is wrong

- **A number with no lines under it** → one row saying so, **not charged**, and the run does not fail.
- **USITC answering with its web page instead of data** (its API returns the single-page app for some paths)
  → an error row with the reason. It is never reported as "no tariff lines".
- **One code failing** while the others work → the working rows are delivered and the failure is reported in
  its own row and in `RUN_ISSUES`.
- **A rate written in a form this Actor cannot parse** → the numbers stay `null` and the text is kept in
  `generalUnparsed` / `specialUnparsed`. Nothing is silently rounded to zero or called duty free.
- **The same line asked for twice** (`0901` and `0901.11` in one run) is delivered and charged **once**.
- A run that hits the maximum total charge you set says so in the log and in `RUN_BUDGET_STOP`.
- If nothing at all could be read and something failed, the run **fails** instead of finishing green.

### Measured

Run on 2026-09-01 with 5 codes (two 10-digit lines, a 6-digit subheading, a chapter 99 surcharge line, a
number with no lines) plus the keyword `espresso`: **20 tariff lines + 1 "no lines" row in 3.1 seconds**,
6 headings fetched, **0 rows with an empty duty rate**, 13 rates inherited from an 8-digit parent,
1 rate left unparsed with its text kept, 0 duplicate lines.

The build is covered by 56 automated checks, and 59 deliberate defects were injected one at a time to
confirm those checks actually catch them.

### Billing

Pay per event: one charge per tariff line delivered. The "no lines" row and rows that report a problem are
**not** charged. Headings without a rate are hidden by default, so a lookup of one code costs the lines you
asked about and nothing else.

### Support

Questions and bug reports: use the **Issues** tab on this Actor. Include the input you ran and the run id.

Data source: [USITC Harmonized Tariff Schedule](https://hts.usitc.gov/) — official US government data,
public domain. This Actor is not affiliated with USITC or CBP. Tariff classification is a legal
determination; use this data to prepare and check work, not as a customs ruling.

# Actor input Schema

## `codes` (type: `array`):

HTS numbers with 4, 6, 8 or 10 digits, with or without dots: "0901", "6109.10", "0901.11.00.15". Each one returns the tariff lines under it. If you give values and none of them are usable, the run fails rather than quietly returning a default.

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

Search the tariff schedule for a word, for example "espresso" or "t-shirts". Can be used on its own or together with HTS numbers.

## `includeHeadings` (type: `boolean`):

Off by default: only lines with 8 or 10 digits, which are the ones that carry a duty rate. Turn on to also get the 4 and 6 digit headings and the wording rows above them.

## `maxRowsPerCode` (type: `integer`):

Upper bound per HTS number, so a whole chapter cannot run up a bill. A 4 digit heading usually has 10 to 60 lines.

## `maxRetries` (type: `integer`):

How many times to retry when USITC does not answer. A rejected request is not retried.

## Actor input object example

```json
{
  "codes": [
    "0901"
  ],
  "keyword": "",
  "includeHeadings": false,
  "maxRowsPerCode": 500,
  "maxRetries": 4
}
```

# Actor output Schema

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

One row per HTS tariff line, plus one row per code that could not be read or has no lines.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("neverempty/us-import-tariff-api").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("neverempty/us-import-tariff-api").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 '{}' |
apify call neverempty/us-import-tariff-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,neverempty/us-import-tariff-api"
        }
    }
}

```

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/9QnohOQwBpNepmNmG/builds/gOscoKLwkG6CwwVTL/openapi.json
