# US Import Duty & Tariff Calculator (HTS + Origin) (`tariffsapi/us-import-duty-tariff-calculator`) Actor

Bulk-resolve HTS codes to the real effective US duty rate by country of origin. Stacks MFN base + Section 301, 232 and 122 into one landed rate. A hardened resolver, not a scraper.

- **URL**: https://apify.com/tariffsapi/us-import-duty-tariff-calculator.md
- **Developed by:** [TariffsAPI](https://apify.com/tariffsapi) (community)
- **Categories:** Developer tools, E-commerce, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## 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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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

## US Import Duty & Tariff Calculator (HTS + Origin)

Get the **real effective US import duty rate** for any HTS code and country of origin, in bulk. This Actor stacks the base MFN rate and every applicable Chapter 99 additional measure, Section 301, Section 232, Section 122, and IEEPA reciprocal, into one landed duty rate per line.

Most tariff tools on the market scrape the USITC schedule and hand you the base rate plus a "Section 301: yes/no" flag, leaving you to work out the actual number. This one **resolves the effective rate** by origin: which measures apply to *your* country, which are exempted or suppressed, and what they add up to. It is a hardened tariff resolver behind an API, not a page scraper.

### Why this is different

A raw HTS scrape tells you `8542.31.00.40` has a Column 1 rate of Free. It will not tell you that, from China, that same code carries a Section 301 List measure and a stacked additional duty, or that the Section 122 surcharge is exempted for a Section 232-covered sector. The gap between the base rate and the *effective* rate is where import costs actually live, and it is exactly what this Actor computes.

- **Correct stacking, by origin.** MFN base + 301 + 232 + 122 + IEEPA, with the country-specific Chapter 99 codes, resolved for the origin you enter, not just flagged.
- **Exemptions and suppression handled.** Annex II carve-outs, USMCA carve-outs, Section 232 stacking rules, and country-scope mismatches are applied, so a measure that does not apply to your origin is not charged.
- **Honest about hard rates.** Formula, specific, compound and reference rates (a jewel count, a metal-content charge, a "see U.S. note" pointer) are flagged, never silently coerced to 0%. A null rate means "not a plain percentage," not "duty-free."
- **Non-NTR origins.** Cuba, North Korea, Russia and Belarus resolve at the Column 2 statutory rate, with Section 122 still stacking on top.
- **Confidence and warnings** on every line, so you know when to double-check.

### What you get per line

One dataset item per (HTS code, origin) pair:

**Identity**
- `hts`, `origin`, `as_of`, `resolved_hts`, `match_type`

**The headline number**
- `total_effective_ad_valorem_rate_percent`, the base plus all applicable additional measures, as a whole-number percent
- `effective_rate_is_complete`, true when that number is a complete, known figure

**The breakdown**
- `base_ad_valorem_rate_percent`, `base_rate_type`, `base_column` (general / special / column2), `base_agreement`, `base_raw_rate`
- `additional_ad_valorem_rate_percent`, the sum of applicable Chapter 99 measures
- `section_301_rate_percent`, `section_232_rate_percent`, `section_122_rate_percent`, `ieepa_rate_percent`, broken out for spreadsheets
- `applied_measures[]`, each with `program`, `program_detail`, `rate_percent`, `chapter_99_code`, `country_specific_chapter_99_code`

**Compliance signals**
- `suppressed_measures_count`, `inapplicable_measures_count`
- `confidence_score`, `warnings[]`, `notice`
- `details_url`, a deep link to the full audit trail (every suppressed measure, exempting Chapter 99 code, and source authority) on the Tariffs API dashboard

**On a miss**
- `error` (e.g. `HTS code not found`) and `suggested_codes[]`, real sibling codes sharing the 6-digit heading, so a typo self-corrects

### Example input

Price two codes against two origins (a four-line origin comparison):

```json
{
  "htsCodes": ["8473.30.11.80", "8542.31.00.40"],
  "origins": ["CN", "VN"],
  "maxResults": 500
}
````

Or price a real product catalog where each SKU has its own origin:

```json
{
  "pairs": [
    { "hts": "8473.30.11.80", "origin": "VN" },
    { "hts": "7318.15.80.65", "origin": "CN" },
    { "hts": "9503.00.00.90", "origin": "RU" }
  ]
}
```

`asOf` (YYYY-MM-DD) resolves rates for a specific date; leave blank for today. `includeInapplicableMeasures` also surfaces measures that matched the HTS but do not apply to the origin, useful for what-if sourcing.

### Example output

```json
{
  "hts": "8542.31.00.40",
  "origin": "CN",
  "as_of": "2026-07-16",
  "resolved_hts": "8542.31.00",
  "match_type": "EXACT",
  "total_effective_ad_valorem_rate_percent": 25,
  "base_rate_type": "ad_valorem",
  "base_ad_valorem_rate_percent": 0,
  "base_column": "general",
  "additional_ad_valorem_rate_percent": 25,
  "section_301_rate_percent": 25,
  "section_232_rate_percent": null,
  "section_122_rate_percent": null,
  "ieepa_rate_percent": null,
  "effective_rate_is_complete": true,
  "applied_measures": [
    {
      "program": "section_301",
      "program_detail": "section_301_lists_1_4a",
      "rate_percent": 25,
      "chapter_99_code": "9903.88.03",
      "country_specific_chapter_99_code": "9903.88.03"
    }
  ],
  "suppressed_measures_count": 0,
  "confidence_score": 1,
  "warnings": [],
  "details_url": "https://tariffsapi.com/lookup?hts=8542.31.00.40&origin=CN"
}
```

### Use cases

- **Landed-cost modeling** for a product catalog across candidate sourcing countries
- **Customs-broker and importer** duty verification before an entry is filed
- **Trade-compliance audits** across a full SKU list, with a confidence score to triage
- **Sourcing / what-if analysis**: same HTS, many origins, one comparison table

### Pricing

Pay per result: **$5.00 per 1,000 resolved lines**. You only pay for lines actually written to your dataset, including error lines that return `suggested_codes`. New Apify accounts get free monthly platform credits to trial it.

### Notes

Data is resolved by [Tariffs API](https://tariffsapi.com) against USITC HTSUS, USTR Section 301 notices, CBP CSMS messages, and Federal Register proclamations, refreshed on a rolling schedule. **This Actor returns the effective rate and the applied measures; the full compliance audit trail, every suppressed measure with its exempting Chapter 99 code, the source authority per measure, historical time-travel, the AI explanation, and change-alert monitoring, lives on the [Tariffs API dashboard](https://tariffsapi.com).** Follow the `details_url` on any line.

This resolution is **advisory only**. It is not a customs ruling and does not classify products into HTS codes; you bring the code, we report the rate. For a binding classification, consult a licensed customs broker or CBP.

### Setup

This Actor calls the Tariffs API on your behalf using a single account key. Set `TARIFFS_API_KEY` as a secret environment variable; the key must be on a **Growth or Pro** plan (batch access). Get one at [tariffsapi.com](https://tariffsapi.com), 14-day free trial, no card required.

# Actor input Schema

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

The HTS codes to price, 6, 8 or 10-digit form, dotted or undotted (e.g. 8473.30.11.80). Each code is resolved against every origin below. Ignored if you supply explicit Pairs instead.

## `origins` (type: `array`):

ISO-2 country codes of origin (e.g. CN, VN, DE). Every HTS code above is priced against each of these, so you get an origin-by-origin comparison. Ignored if you supply explicit Pairs.

## `pairs` (type: `array`):

Exact pairs to resolve, e.g. \[{"hts":"8473.30.11.80","origin":"VN"},{"hts":"8542.31.00.40","origin":"CN"}]. Use this to price a real product catalog where each SKU has its own origin. When present, it overrides HTS codes x Origins.

## `asOf` (type: `string`):

Resolve rates as of this date (YYYY-MM-DD). Leave blank for today. Tariff regimes have effective and sunset dates, so a date far in the future can cross a sunset; use today's or a near-term date.

## `includeInapplicableMeasures` (type: `boolean`):

Also surface measures that matched the HTS but do NOT apply to the origin (e.g. a China-only Section 301 line on a Vietnam call), tagged as inapplicable. Useful for what-if sourcing analysis.

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

Stops once this many (HTS, origin) lines are resolved. Hard cap 20,000.

## Actor input object example

```json
{
  "htsCodes": [
    "8473.30.11.80",
    "8542.31.00.40"
  ],
  "origins": [
    "CN",
    "VN"
  ],
  "includeInapplicableMeasures": false,
  "maxResults": 500
}
```

# Actor output Schema

## `duties` (type: `string`):

One item per (HTS, origin) pair with the effective stacked duty rate, written to the run's dataset.

# 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": [
        "8473.30.11.80",
        "8542.31.00.40"
    ],
    "origins": [
        "CN",
        "VN"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tariffsapi/us-import-duty-tariff-calculator").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": [
        "8473.30.11.80",
        "8542.31.00.40",
    ],
    "origins": [
        "CN",
        "VN",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("tariffsapi/us-import-duty-tariff-calculator").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 '{
  "htsCodes": [
    "8473.30.11.80",
    "8542.31.00.40"
  ],
  "origins": [
    "CN",
    "VN"
  ]
}' |
apify call tariffsapi/us-import-duty-tariff-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=tariffsapi/us-import-duty-tariff-calculator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "US Import Duty & Tariff Calculator (HTS + Origin)",
        "description": "Bulk-resolve HTS codes to the real effective US duty rate by country of origin. Stacks MFN base + Section 301, 232 and 122 into one landed rate. A hardened resolver, not a scraper.",
        "version": "0.1",
        "x-build-id": "HAtUXK7Gjy6b9KVwv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tariffsapi~us-import-duty-tariff-calculator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tariffsapi-us-import-duty-tariff-calculator",
                "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/tariffsapi~us-import-duty-tariff-calculator/runs": {
            "post": {
                "operationId": "runs-sync-tariffsapi-us-import-duty-tariff-calculator",
                "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/tariffsapi~us-import-duty-tariff-calculator/run-sync": {
            "post": {
                "operationId": "run-sync-tariffsapi-us-import-duty-tariff-calculator",
                "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": {
                    "htsCodes": {
                        "title": "HTS codes",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "The HTS codes to price, 6, 8 or 10-digit form, dotted or undotted (e.g. 8473.30.11.80). Each code is resolved against every origin below. Ignored if you supply explicit Pairs instead.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "origins": {
                        "title": "Countries of origin",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "ISO-2 country codes of origin (e.g. CN, VN, DE). Every HTS code above is priced against each of these, so you get an origin-by-origin comparison. Ignored if you supply explicit Pairs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "pairs": {
                        "title": "Explicit HTS + origin pairs (advanced)",
                        "type": "array",
                        "description": "Exact pairs to resolve, e.g. [{\"hts\":\"8473.30.11.80\",\"origin\":\"VN\"},{\"hts\":\"8542.31.00.40\",\"origin\":\"CN\"}]. Use this to price a real product catalog where each SKU has its own origin. When present, it overrides HTS codes x Origins."
                    },
                    "asOf": {
                        "title": "As-of date",
                        "type": "string",
                        "description": "Resolve rates as of this date (YYYY-MM-DD). Leave blank for today. Tariff regimes have effective and sunset dates, so a date far in the future can cross a sunset; use today's or a near-term date."
                    },
                    "includeInapplicableMeasures": {
                        "title": "Include inapplicable measures",
                        "type": "boolean",
                        "description": "Also surface measures that matched the HTS but do NOT apply to the origin (e.g. a China-only Section 301 line on a Vietnam call), tagged as inapplicable. Useful for what-if sourcing analysis.",
                        "default": false
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Stops once this many (HTS, origin) lines are resolved. Hard cap 20,000.",
                        "default": 500
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
