# US Tariff Revision Diff & HTS Change Monitor (`bahc19/us-hts-tariff-revision-diff`) Actor

Compare two official USITC HTS releases and get only the tariff lines that changed, with old/new field evidence and source revision metadata. Unofficial; verify against official USITC guidance.

- **URL**: https://apify.com/bahc19/us-hts-tariff-revision-diff.md
- **Developed by:** [Benjamin](https://apify.com/bahc19) (community)
- **Categories:** Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

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 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 Tariff Revision Diff & HTS Change Monitor (Unofficial)

Compare two official USITC HTS releases and get only the tariff lines that changed, with old/new field evidence and source revision metadata.

Use it when you already know the HTS codes you care about and need to answer:

- Did any watched code change between two releases?
- Which descriptions, units or published duty-rate fields changed?
- Was a code added or removed?
- What is the current official release identity?

### Modes

| Mode | What it does | Typical cost |
|---|---|---|
| `revisions` | Official release list (name, status, dates) | start fee only |
| `current` | Normalized current-release records (filter by `codePrefixes`) | per emitted record |
| `diff` | Changes between a previous snapshot and the current release | per changed record |
| `watchlist` | Same as diff, filtered to your exact codes | per changed record |

### Snapshot workflow (recommended)

1. Run `mode=current` (optionally with your `codePrefixes`) and note the dataset ID.
2. When a new USITC revision is published (check `mode=revisions`), run `mode=diff`
   with `fromDatasetId` = that dataset ID.
3. Store the new snapshot for next time.

Every diff output record includes the HTS key, change type (`added` / `removed` /
`modified`), the changed fields with exact old/new values, and a `meta` record with
the target release name and the raw SHA256 of the official source payload.

### Example input

```json
{
  "mode": "diff",
  "fromDatasetId": "your-previous-snapshot-dataset",
  "codePrefixes": ["72", "73"],
  "maxChanges": 500
}
```

### Example output record

Real observed change — 2026HTSRev14 → 2026HTSRev15 (official USITC archive):

```json
{
  "key": "99030463",
  "changeType": "modified",
  "changedFields": [
    { "path": "$.general", "old": "The duty provided in the applicable subheading + 10%",
      "new": "The duty provided in the applicable subheading +0%", "kind": "value_changed" },
    { "path": "$.special", "old": "The duty provided in the applicable subheading + 10%",
      "new": "The duty provided in the applicable subheading +0%", "kind": "value_changed" }
  ]
}
```

That transition produced exactly 2 semantic changes (99030306 description edit +
99030463 rate cut to +0%). A large revision looks like this — 2026HTSRev1 →
2026HTSRev2: 295 records changed (176 added, 66 removed, 53 modified).

Mass cross-cutting note changes are grouped into events instead of thousands of
noisy records (observed: 2026HTSRev12 → 2026HTSRev13, 10,502 footnote rows
collapsed into 13 events + 939 semantic changes; 101 new 9903.88.x lines added).

### Spending protection

The Actor always respects your run's max-cost limit:

- Set `maxTotalChargeUsd` in the run configuration (Apify enforces it too).
- The Actor stops charging and stops emitting billable records the moment the
  next event would exceed the limit, then returns a `meta` record with
  `chargedUsd`, `limitUsd` and `limitReached`.
- You never pay for output beyond your limit, and runs end cleanly instead of
  being aborted mid-stream.

### Source and legality

- Data source: official USITC HTS portal — https://hts.usitc.gov (public government data, no auth)
  and the official HTS archive — https://www.usitc.gov/harmonized\_tariff\_information/hts/archive
  (CSV/XLS/JSON historical releases).
- This Actor is **not** a customs classification service and does **not** provide legal advice.
- Always verify decisions against current official USITC/CBP guidance.
- No LLM is used in the data path; every fact is a deterministic transformation of the official payload.

# Actor input Schema

## `mode` (type: `string`):

diff: changes between a previous snapshot and the current release; current: emit normalized current-release records; watchlist: diff filtered to explicit codes; revisions: official release list.

## `fromDatasetId` (type: `string`):

Apify dataset ID of a previous `current` run to diff against (mode=diff/watchlist).

## `fromSnapshotUrl` (type: `string`):

Public URL of a normalized snapshot JSON array (alternative to fromDatasetId).

## `fromSnapshotInline` (type: `object`):

Inline previous snapshot array (small watchlists only). Set via API; not editable in UI.

## `codePrefixes` (type: `array`):

Only report records whose HTS code starts with these prefixes, e.g. \["72", "73"].

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

Exact HTS codes to watch, e.g. \["7201.10.00.00"] (mode=watchlist).

## `maxChanges` (type: `integer`):

Hard cap on charged change records.

## `maxRecords` (type: `integer`):

Hard cap on emitted records in mode=current.

## `explain` (type: `boolean`):

Not implemented in v1; deterministic output always available.

## Actor input object example

```json
{
  "mode": "diff",
  "maxChanges": 500,
  "maxRecords": 1000,
  "explain": false
}
```

# 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("bahc19/us-hts-tariff-revision-diff").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("bahc19/us-hts-tariff-revision-diff").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 bahc19/us-hts-tariff-revision-diff --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bahc19/us-hts-tariff-revision-diff"
        }
    }
}

```

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/kOLoKe8W6bWyq85g6/builds/Hh1BjiMcj7oB6P19V/openapi.json
