# USITC HTS Tariff Search (`ryanclinton/usitc-hts-tariff-search`) Actor

Search the **US Harmonized Tariff Schedule (HTS)** for import duty rates, tariff classifications, and trade compliance data. Look up tariff rates by product keyword, HTS code, or chapter. Automatically detects **Section 301 (China)** and **Section 232 (steel/aluminum)** additional tariffs.

- **URL**: https://apify.com/ryanclinton/usitc-hts-tariff-search.md
- **Developed by:** [ryan clinton](https://apify.com/ryanclinton) (community)
- **Categories:** Other, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 result returneds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## USITC HTS Tariff Search

Search the **US Harmonized Tariff Schedule (HTS)** for import duty rates, tariff classifications, and trade compliance data. Look up tariff rates by product keyword, HTS code, or chapter. Automatically detects **Section 301 (China)** and **Section 232 (steel/aluminum)** additional tariffs.

No API key required. Just enter a keyword like `coffee` or `lithium battery` and get back structured tariff data with duty rates in seconds.

### Why Use USITC HTS Tariff Search?

The USITC website is designed for browsing one tariff line at a time. Extracting structured data for cost analysis, tariff engineering, or compliance audits means manually navigating a multi-level hierarchy of 99 chapters and thousands of subheadings. This actor handles keyword search, chapter browsing, hierarchical description assembly, HTML stripping, footnote parsing, and Section 301/232 detection — giving you clean JSON with all three duty rate columns and tariff flags.

### Features

- **Product keyword search** — search by product name (e.g., "coffee", "steel pipe", "lithium battery", "solar panel", "semiconductor")
- **HTS code lookup** — look up a specific code or browse all subheadings under a heading (e.g., "7304" returns all seamless steel tube classifications)
- **Chapter browsing** — view all tariff lines within a specific HTS chapter (01–99)
- **Duty rate filtering** — exclude category headers to show only tariff lines with actual rates
- **Section 301 detection** — automatically flags items subject to additional tariffs on Chinese goods (Chapter 99, subheading 9903.88.xx)
- **Section 232 detection** — automatically flags items subject to steel/aluminum tariffs (Chapter 99, subheading 9903.80.xx)
- **Footnote parsing** — extracts and formats Chapter 99 references, statistical notes, and special provisions
- **Hierarchical descriptions** — builds full product descriptions from parent categories for context (instead of just showing "Other")
- **HTML stripping** — cleans raw API descriptions that contain embedded HTML tags
- **Three rate columns** — general (MFN) rate, special program rates (FTA preferences), and Column 2 (non-NTR) rate

### How to Use

1. **Choose your search mode** — enter a product keyword, a specific HTS number, or a chapter number. Only one mode is used per run.

2. **Set filtering options** — enable `dutyRateFilter` (default: true) to show only tariff lines with actual duty rates. Disable it to see the full hierarchy including category headers.

3. **Run and download** — click "Start" and wait for the run to complete (typically 3–15 seconds). Download the structured JSON dataset.

4. **Check tariff flags** — look at `isSection301`, `isSection232`, and `hasAdditionalTariff` fields to quickly identify items subject to extra duties.

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `keyword` | String | No* | — | Product keyword search (e.g., "coffee", "steel pipe") |
| `htsNumber` | String | No* | — | Specific HTS code (e.g., "0901.11.00") or heading (e.g., "7304") |
| `chapter` | String | No* | — | Browse entire HTS chapter by number (01–99) |
| `dutyRateFilter` | Boolean | No | `true` | Only show lines with actual duty rates |
| `includeFootnotes` | Boolean | No | `true` | Include full footnote text in output |
| `maxResults` | Integer | No | `100` | Maximum results to return (1–5,000) |

*Exactly one search mode (keyword, htsNumber, or chapter) is required.

#### Input Examples

**Find tariff rates for solar panels:**

```json
{
    "keyword": "solar panel",
    "maxResults": 50
}
````

**Look up all subheadings under HTS 8541 (semiconductor devices):**

```json
{
    "htsNumber": "8541",
    "dutyRateFilter": false,
    "maxResults": 200
}
```

**Browse Chapter 72 (Iron and Steel):**

```json
{
    "chapter": "72",
    "maxResults": 500
}
```

**Find lithium battery tariff classifications:**

```json
{
    "keyword": "lithium battery",
    "includeFootnotes": true,
    "maxResults": 100
}
```

**Look up a specific tariff line:**

```json
{
    "htsNumber": "0901.11.00",
    "dutyRateFilter": false
}
```

#### Input Tips

- Use `keyword` for product-level searches — it queries the USITC search API which matches against descriptions across all chapters.
- Use `htsNumber` with a 4-digit heading (e.g., "7304") to browse all subheadings under that heading. Use a full 8- or 10-digit code for exact lookup.
- Set `dutyRateFilter: false` when you need the full hierarchical structure including category headings — useful for understanding how a product fits into the classification tree.
- Large chapters (72 Iron/Steel, 84 Machinery, 85 Electrical) can have thousands of tariff lines. Set a high `maxResults` or focus with a keyword or heading number.
- Footnotes contain critical tariff information including Chapter 99 additional duty references. Keep `includeFootnotes: true` (default) for trade compliance work.

### Output

```json
{
    "htsNumber": "8541.40.60",
    "statisticalSuffix": "45",
    "description": "Light-emitting diodes (LEDs), other than laser diodes",
    "fullDescription": "Semiconductor devices > Photosensitive semiconductor devices > Light-emitting diodes (LEDs), other than laser diodes",
    "indent": 2,
    "chapter": "85",
    "heading": "8541",
    "subheading": "8541.40",
    "section": "XVI",
    "generalRate": "Free",
    "specialRate": "Free (A,AU,BH,CL,CO,D,E,IL,JO,KR,MA,OM,P,PA,PE,S,SG)",
    "otherRate": "35%",
    "units": "No.",
    "additionalDuties": "",
    "quotaQuantity": "",
    "effectivePeriod": "",
    "footnotes": [
        {
            "marker": "1/",
            "text": "See subheading 9903.88.03",
            "columns": ["general"],
            "type": "chapter99"
        }
    ],
    "footnotesSummary": "1/ See subheading 9903.88.03",
    "hasAdditionalTariff": true,
    "isSection301": true,
    "isSection232": false
}
```

#### Output Fields

**Classification fields:**

| Field | Type | Description |
|-------|------|-------------|
| `htsNumber` | String | Full HTS number (e.g., "8541.40.60") |
| `statisticalSuffix` | String | Two-digit statistical suffix |
| `chapter` | String | HTS chapter number (01–99) |
| `heading` | String | Four-digit heading (e.g., "8541") |
| `subheading` | String | Six-digit subheading (e.g., "8541.40") |
| `section` | String | HTS section in Roman numerals (I–XXII) |
| `indent` | Integer | Nesting level in the HTS hierarchy (0 = chapter heading) |

**Description fields:**

| Field | Type | Description |
|-------|------|-------------|
| `description` | String | Product description at this level (cleaned of HTML) |
| `fullDescription` | String | Hierarchical breadcrumb from parent categories (e.g., "Semiconductor devices > Photosensitive > LEDs") |

**Rate fields:**

| Field | Type | Description |
|-------|------|-------------|
| `generalRate` | String | Column 1 General (MFN) rate — the rate most importers pay |
| `specialRate` | String | Preferential rates under FTAs. Letters indicate qualifying programs (A=GSP, AU=Australia, KR=Korea, etc.) |
| `otherRate` | String | Column 2 rate for non-NTR countries (Cuba, North Korea, etc.) — typically much higher |
| `units` | String | Unit of quantity (kg, No., doz, m², etc.) |
| `additionalDuties` | String | Additional duty provisions from Chapter 99 |
| `quotaQuantity` | String | Tariff-rate quota quantities if applicable |
| `effectivePeriod` | String | Date range when this rate is effective |

**Footnote fields:**

| Field | Type | Description |
|-------|------|-------------|
| `footnotes[]` | Array | Individual footnotes with marker, text, columns, and type |
| `footnotesSummary` | String | All footnotes concatenated with pipe separators |

**Tariff flag fields:**

| Field | Type | Description |
|-------|------|-------------|
| `hasAdditionalTariff` | Boolean | `true` when any Chapter 99 additional duty applies |
| `isSection301` | Boolean | `true` when subject to Section 301 China tariffs (9903.88.xx) |
| `isSection232` | Boolean | `true` when subject to Section 232 steel/aluminum tariffs (9903.80.xx) |

### Understanding Duty Rates

- **Percentage rates** (e.g., "3.7%") — ad valorem duty based on declared customs value
- **Specific rates** (e.g., "32.8¢/kg") — fixed duty per unit of quantity
- **Compound rates** (e.g., "5.3% + 1.2¢/kg") — combination of ad valorem and specific
- **"Free"** — no duty applies under that column
- **Empty rate** — this line is a statistical breakout or category header, not a dutiable line

#### Special Rate Program Codes

| Code | Program | Code | Program |
|------|---------|------|---------|
| A | GSP (Generalized System of Preferences) | MA | Morocco FTA |
| AU | Australia FTA | OM | Oman FTA |
| BH | Bahrain FTA | P | CAFTA-DR + Peru |
| CL | Chile FTA | PA | Panama FTA |
| CO | Colombia FTA | PE | Peru FTA |
| D | African Growth & Opportunity Act | S | Singapore FTA |
| E | Caribbean Basin Initiative | SG | Singapore FTA |
| IL | Israel FTA | JO | Jordan FTA |
| KR | Korea (KORUS) FTA | — | — |

### Use Cases

- **Customs brokers and compliance officers** classifying imported goods, verifying applicable duty rates, and identifying products subject to additional tariffs under Section 301 or 232
- **Import/export businesses** calculating landed costs by combining duty rates with product values to determine total import costs before placing orders
- **Supply chain managers** evaluating sourcing alternatives across countries by comparing general rates, FTA preferential rates, and additional tariff exposure
- **Trade attorneys** researching tariff classifications for customs disputes, ruling requests, and tariff engineering strategies
- **Policy researchers and economists** tracking tariff rate structures across product categories to model trade policy impacts and analyze tariff escalation patterns
- **Product designers and engineers** exploring tariff engineering opportunities — modifying product specifications to achieve a more favorable HTS classification
- **E-commerce importers** checking duty rates before sourcing products from international suppliers, especially for goods from China that may be subject to Section 301 tariffs

### How to Use the API

#### Python

```python
import requests
import time

run = requests.post(
    "https://api.apify.com/v2/acts/ryanclinton~usitc-hts-tariff-search/runs",
    params={"token": "YOUR_APIFY_TOKEN"},
    json={
        "keyword": "lithium battery",
        "maxResults": 50
    },
    timeout=30,
).json()

run_id = run["data"]["id"]
while True:
    status = requests.get(
        f"https://api.apify.com/v2/actor-runs/{run_id}",
        params={"token": "YOUR_APIFY_TOKEN"},
        timeout=10,
    ).json()
    if status["data"]["status"] in ("SUCCEEDED", "FAILED", "ABORTED"):
        break
    time.sleep(3)

dataset_id = status["data"]["defaultDatasetId"]
items = requests.get(
    f"https://api.apify.com/v2/datasets/{dataset_id}/items",
    params={"token": "YOUR_APIFY_TOKEN"},
    timeout=30,
).json()

for item in items:
    s301 = " [301]" if item["isSection301"] else ""
    print(f"{item['htsNumber']} | {item['generalRate']} | {item['description']}{s301}")
```

#### JavaScript

```javascript
const response = await fetch(
    "https://api.apify.com/v2/acts/ryanclinton~usitc-hts-tariff-search/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN",
    {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
            keyword: "lithium battery",
            maxResults: 50,
        }),
    }
);

const tariffs = await response.json();
tariffs.forEach(t =>
    console.log(`${t.htsNumber} | ${t.generalRate} | ${t.description} ${t.isSection301 ? "[301]" : ""}`)
);
```

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/ryanclinton~usitc-hts-tariff-search/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "keyword": "lithium battery",
    "maxResults": 50
  }'
```

### How It Works

```
Input (keyword, htsNumber, or chapter)
  │
  ▼
┌──────────────────────────────────────────────────┐
│  Step 1: Route Search Mode                       │
│  keyword  → USITC search API (full-text)         │
│  htsNumber → USITC search API (code lookup)      │
│  chapter  → USITC chapter API (all lines)        │
└──────────────────────────────────────────────────┘
  │
  ▼
┌──────────────────────────────────────────────────┐
│  Step 2: Fetch & Parse                           │
│  Retrieve JSON from hts.usitc.gov REST API.      │
│  Strip HTML tags from descriptions.              │
│  Parse indent levels for hierarchy.              │
└──────────────────────────────────────────────────┘
  │
  ▼
┌──────────────────────────────────────────────────┐
│  Step 3: Build Hierarchical Descriptions         │
│  Track parent descriptions at each indent level. │
│  Construct fullDescription breadcrumbs:          │
│  "Chapter heading > Heading > Subheading > Item" │
│  Eliminates ambiguous "Other" descriptions.      │
└──────────────────────────────────────────────────┘
  │
  ▼
┌──────────────────────────────────────────────────┐
│  Step 4: Classify & Map                          │
│  Extract chapter, heading, subheading from code. │
│  Map chapter → HTS section (I–XXII) using        │
│  99-chapter lookup table.                        │
│  Apply dutyRateFilter if enabled.                │
└──────────────────────────────────────────────────┘
  │
  ▼
┌──────────────────────────────────────────────────┐
│  Step 5: Footnote Analysis & Tariff Detection    │
│  Parse footnote markers, text, and columns.      │
│  Detect Section 301: regex 9903.88 / "301"       │
│  Detect Section 232: regex 9903.80 / "232"       │
│  Set hasAdditionalTariff for any Chapter 99 ref. │
└──────────────────────────────────────────────────┘
  │
  ▼
Structured tariff records pushed to dataset
```

#### Data Sources

| Source | API Endpoint | Auth Required |
|--------|-------------|---------------|
| USITC HTS | `https://hts.usitc.gov/reststop/search` | No |
| USITC HTS | `https://hts.usitc.gov/reststop/getChapter` | No |

#### HTS Chapter Quick Reference

| Chapters | Section | Description |
|----------|---------|-------------|
| 01–05 | I–II | Live Animals, Animal Products |
| 06–14 | II–III | Vegetable Products |
| 15 | III | Fats & Oils |
| 16–24 | IV | Food, Beverages, Tobacco |
| 25–27 | V | Mineral Products |
| 28–38 | VI–VII | Chemicals |
| 39–40 | VII | Plastics & Rubber |
| 44–46 | IX | Wood Products |
| 47–49 | X | Paper & Pulp |
| 50–63 | XI | Textiles & Apparel |
| 72–83 | XV | Base Metals (Iron, Steel, Aluminum, Copper) |
| 84 | XVI | Machinery |
| 85 | XVI | Electrical Equipment |
| 86–89 | XVII | Vehicles & Transport |
| 90–92 | XVIII | Instruments |
| 97 | XXI | Works of Art |
| 98–99 | XXII | Special Classifications & Additional Duties |

### How Much Does It Cost?

| Scenario | Results | Est. Time | Est. Cost |
|----------|---------|-----------|-----------|
| Single HTS code lookup | 1–5 | 3 sec | < $0.001 |
| Keyword search (100 results) | 100 | 5 sec | < $0.01 |
| Full chapter browse (500+ results) | 500 | 10 sec | ~$0.01 |

The actor uses 256 MB memory and makes lightweight REST API calls with no browser rendering. The Apify free tier covers thousands of runs per month.

### Tips

- **Use product codes for Section 301 analysis** — search for your product keyword, then check the `isSection301` flag on each result to see which classifications are subject to China tariffs.
- **Browse by chapter for comprehensive coverage** — if you import goods from a specific product category, browse the entire chapter to see all available tariff lines and rate options.
- **Check specialRate for FTA savings** — if you source from a country with a US free trade agreement, the `specialRate` field shows whether preferential rates are available.
- **Disable dutyRateFilter for tariff engineering** — seeing the full hierarchy helps identify where product modifications could shift a classification to a more favorable tariff line.
- **Read footnotes carefully** — Chapter 99 footnotes often contain critical information about additional tariffs, quota requirements, and temporary duty modifications that aren't reflected in the base rate columns.
- **Combine with USITC DataWeb** — this actor covers tariff rates and classifications. For actual import/export volume and value data by HTS code, use USITC's DataWeb tool.

### Limitations

- **Keyword search relevance** — the USITC search API returns results ranked by text relevance. Some results may be tangentially related to your keyword.
- **No import/export volume data** — this actor covers tariff rates and classifications only. Trade volume statistics require USITC DataWeb or Census Bureau data.
- **Large chapters may be truncated** — some chapters (72, 84, 85) have thousands of tariff lines. Set `maxResults` high enough to capture the full chapter.
- **Section 301/232 detection is regex-based** — the actor identifies additional tariffs by matching footnote patterns (9903.88.xx for 301, 9903.80.xx for 232). Unusual footnote formatting may cause false negatives.
- **Rate column format varies** — duty rates appear as percentages, specific rates (cents/kg), compound rates, or "Free". Parsing these into numeric values requires additional processing on your end.
- **No historical rates** — the API returns the currently effective tariff schedule. Historical rate data is not available.
- **Hierarchical descriptions require context** — the `fullDescription` field is constructed from parent indent levels in the API response. For keyword searches that return scattered results, some parent descriptions may be missing.

### Responsible Use

- **All data is public** — the Harmonized Tariff Schedule is published by the US International Trade Commission and is freely available without restrictions.
- **Respect USITC API limits** — the actor makes lightweight requests to the USITC REST API. Avoid launching excessive concurrent runs.
- **Verify for official filings** — this actor provides reference data for research and analysis. For customs entries and official classifications, always consult the official [USITC HTS website](https://hts.usitc.gov/) or a licensed customs broker.

### FAQ

**Is an API key required?**
No. The USITC HTS REST API is free and does not require authentication.

**How current are the tariff rates?**
The USITC updates the HTS regularly to reflect new trade agreements, tariff changes, and product classification decisions. Rates reflect the currently effective schedule.

**Can I find out if my product is subject to Section 301 China tariffs?**
Yes. Search for your product keyword or HTS code and check the `isSection301` boolean flag. The footnotes field will contain the specific Chapter 99 subheading reference.

**What is the difference between General and Special rates?**
The General (MFN) rate applies to imports from most countries with Normal Trade Relations. The Special rate offers lower (often zero) rates for imports from countries with which the US has a free trade agreement (USMCA, KORUS, etc.) or preferential trade programs (GSP, AGOA).

**Can I browse the entire HTS?**
You can browse one chapter at a time using the `chapter` parameter (01–99). Each chapter may contain hundreds to thousands of tariff lines.

**Why do some results show empty rate fields?**
Lines with empty general/special/other rates are category headers or indent-0 descriptions in the HTS hierarchy. They provide context but are not independently dutiable. Set `dutyRateFilter: true` (default) to exclude these.

**How do I find the right HTS code for my product?**
Start with a keyword search using your product name. Review the results and their `fullDescription` fields to identify the best-matching tariff line. For official classification, consult a customs broker or file a binding ruling request with CBP.

### Integrations

- **Apify API** — trigger runs programmatically for automated tariff rate checks in import cost calculators
- **Zapier** — automatically look up tariff rates when new products are added to your inventory management system
- **Make (Integromat)** — build workflows that check Section 301 exposure for new supplier quotes
- **Google Sheets** — export tariff data directly for landed cost analysis spreadsheets
- **Webhooks** — receive tariff data as soon as the run completes for real-time pricing engines
- **Scheduled Runs** — monitor tariff rate changes by running periodic checks on your key HTS codes

### Related Actors

| Actor | What it does | Use with HTS Tariff Search |
|-------|-------------|---------------------------|
| [CBP Customs Rulings](https://apify.com/ryanclinton/cbp-customs-rulings) | CBP classification rulings | Find legally binding rulings on how products are classified under the HTS |
| [UN COMTRADE Trade Data](https://apify.com/ryanclinton/un-comtrade-search) | International trade statistics | Get import/export volumes by HS code to complement tariff rate data |
| [Currency Exchange Rate Tracker](https://apify.com/ryanclinton/exchange-rate-tracker) | Live exchange rates | Calculate landed costs in local currency alongside tariff rates |
| [Senate Lobbying Search](https://apify.com/ryanclinton/senate-lobbying-search) | Federal lobbying filings | Track lobbying activity on tariff and trade policy issues |
| [Federal Register Search](https://apify.com/ryanclinton/federal-register-search) | Federal Register notices | Monitor proposed tariff changes and trade policy announcements |
| [OECD Economic Statistics](https://apify.com/ryanclinton/oecd-statistics-search) | OECD trade data | Broader trade analysis context alongside HTS tariff rates |

# Actor input Schema

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

Search for products by keyword (e.g., 'steel pipe', 'coffee', 'solar panel', 'lithium battery'). Returns all matching HTS classifications with duty rates.

## `htsNumber` (type: `string`):

Look up a specific HTS code (e.g., '0901.11.00', '7304.22', '8541.40'). Supports partial codes — entering '7304' returns all subheadings under that heading.

## `chapter` (type: `string`):

Browse all tariff lines in a specific chapter (01-99). Example: 72 = Iron and Steel, 84 = Machinery, 85 = Electrical Equipment.

## `dutyRateFilter` (type: `boolean`):

Only return tariff lines that have a duty rate (excludes category headers with no rate). Recommended for cleaner results.

## `includeFootnotes` (type: `boolean`):

Include full footnote text (Section 301, 232, safeguard tariffs, etc.). Useful for compliance research.

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

Maximum number of tariff classifications to return.

## Actor input object example

```json
{
  "keyword": "coffee",
  "dutyRateFilter": true,
  "includeFootnotes": true,
  "maxResults": 100
}
```

# 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 = {
    "keyword": "coffee"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ryanclinton/usitc-hts-tariff-search").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 = { "keyword": "coffee" }

# Run the Actor and wait for it to finish
run = client.actor("ryanclinton/usitc-hts-tariff-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keyword": "coffee"
}' |
apify call ryanclinton/usitc-hts-tariff-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/usitc-hts-tariff-search",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USITC HTS Tariff Search",
        "description": "Search the **US Harmonized Tariff Schedule (HTS)** for import duty rates, tariff classifications, and trade compliance data. Look up tariff rates by product keyword, HTS code, or chapter. Automatically detects **Section 301 (China)** and **Section 232 (steel/aluminum)** additional tariffs.",
        "version": "1.0",
        "x-build-id": "kIajrEshsJtmSUf0G"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ryanclinton~usitc-hts-tariff-search/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ryanclinton-usitc-hts-tariff-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/ryanclinton~usitc-hts-tariff-search/runs": {
            "post": {
                "operationId": "runs-sync-ryanclinton-usitc-hts-tariff-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/ryanclinton~usitc-hts-tariff-search/run-sync": {
            "post": {
                "operationId": "run-sync-ryanclinton-usitc-hts-tariff-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "keyword": {
                        "title": "Product Keyword",
                        "type": "string",
                        "description": "Search for products by keyword (e.g., 'steel pipe', 'coffee', 'solar panel', 'lithium battery'). Returns all matching HTS classifications with duty rates."
                    },
                    "htsNumber": {
                        "title": "HTS Number",
                        "type": "string",
                        "description": "Look up a specific HTS code (e.g., '0901.11.00', '7304.22', '8541.40'). Supports partial codes — entering '7304' returns all subheadings under that heading."
                    },
                    "chapter": {
                        "title": "HTS Chapter",
                        "type": "string",
                        "description": "Browse all tariff lines in a specific chapter (01-99). Example: 72 = Iron and Steel, 84 = Machinery, 85 = Electrical Equipment."
                    },
                    "dutyRateFilter": {
                        "title": "Filter by Duty Rate",
                        "type": "boolean",
                        "description": "Only return tariff lines that have a duty rate (excludes category headers with no rate). Recommended for cleaner results.",
                        "default": true
                    },
                    "includeFootnotes": {
                        "title": "Include Footnotes Detail",
                        "type": "boolean",
                        "description": "Include full footnote text (Section 301, 232, safeguard tariffs, etc.). Useful for compliance research.",
                        "default": true
                    },
                    "maxResults": {
                        "title": "Maximum Results",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of tariff classifications to return.",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
