# US Census HS10 Trade Flows & Tariff Duties API (`zertax/us-census-hs-trade-tariffs-mcp`) Actor

Extract official US Census monthly HS10 imports, exports, customs value, CIF, and calculated tariff duties by country, port, or state as JSON, CSV, or MCP.

- **URL**: https://apify.com/zertax/us-census-hs-trade-tariffs-mcp.md
- **Developed by:** [Andy Tertzakian](https://apify.com/zertax) (community)
- **Categories:** AI, Business, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 trade flow records extracted

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/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## US Census HS10 Trade Flows & Tariff Duties API

Use this **US Census Trade & Tariff Duties API** to extract official **US Census Bureau International Trade (FT-900)** monthly **imports, exports, customs value (FOB/FAS), CIF, shipping charges, quantities, and calculated tariff duties (`CAL_DUT_MO`)** across **HS2 / HS4 / HS6 / HS10** commodities, partner countries, US customs districts, ports of entry/exit, and US states — formatted as clean JSON, CSV, Excel, or live via **Model Context Protocol (MCP)**.

Unlike static tariff-schedule lookup tools, this Actor queries **actual realized monthly US customs flows and duties collected**, enriched automatically with **Schedule C country names & ISO-2 codes** and **Schedule D district/port names**.

***

### Key Features

- **1-Click Ready + Optional BYOK:** Runs out-of-the-box with a managed Census API key (or supply your own free `censusApiKey` via encrypted BYOK input). Keys are strictly redacted from all logs and output `_source_url` fields.
- **All 6 Official Endpoints (`imports` / `exports` × `hs` / `porths` / `statehs`):**
  - `imports/hs`: Full **HS10** granularity with FOB customs value, CIF, freight/insurance charges, imports for consumption, dutiable value, **calculated tariff duty (`calculated_duty_usd`)**, **effective duty rate (%)**, and transport-mode weights/values.
  - `exports/hs`: Full **HS10** FAS export value, domestic vs. foreign re-export (`DF`), quantities, and vessel/air/containerized splits.
  - `porths` & `statehs`: Port-of-entry/exit and US state trade flows (up to HS6 per Census disclosure rules).
- **Zero Double-Counting:** Pins `SUMMARY_LVL=DET` and the finest non-overlapping `SUMMARY_LVL2` lattice (`HSCYCSDTRP`, `HSDTCYDF`, `HSPTCY`, `HSSTCY`) so overlapping country groups (CGP) and subtotal rows never inflate totals.
- **Auto-Detects Latest FT-900 Month:** Leave `startMonth` blank to automatically skip unpublished `HTTP 204` months and fetch the newest official Census release.
- **Human-Friendly ISO-2 Filtering:** Pass `countries: ["CA", "MX", "CN", "DE"]` (auto-translated to 4-digit Schedule C codes) instead of memorizing Census code books.

***

### Use with AI Agents (Claude Desktop, Cursor, MCP)

```json
{
  "mcpServers": {
    "us-census-trade": {
      "url": "https://mcp.apify.com/?tools=actors,zertax/us-census-hs-trade-tariffs-mcp"
    }
  }
}
```

Example prompts:

- *"Pull the latest monthly US HS10 crude oil imports (`2709`) from Canada and Mexico with customs value, barrels, and calculated tariff duties."*
- *"Show US semiconductor imports (`8542`) by customs district and effective duty rate for the last 3 months."*
- *"Compare Texas (`TX`) LNG / natural gas exports (`2711`) by partner country."*

***

### Example Input

```json
{
  "flow": "imports",
  "geography": "hs",
  "hsPrefix": "2709",
  "commLevel": "HS10",
  "countries": ["CA", "MX"],
  "maxItems": 50
}
```

### Example Output Record

```json
{
  "flow": "imports",
  "geography": "hs",
  "month": "2026-08",
  "commodity_code": "2709001000",
  "commodity_desc": "CRUDE OIL FROM PETROLEUM OR BITUMINOUS MINERALS TESTING UNDER 25 DEGREES API",
  "country_iso2": "CA",
  "country_name": "CANADA",
  "district_code": "39",
  "district_name": "CHICAGO, IL",
  "customs_value_usd": 2418500000.0,
  "cif_value_usd": 2451200000.0,
  "calculated_duty_usd": 4125000.0,
  "effective_duty_rate_pct": 0.17,
  "_source": "us_census_ft900",
  "_schema_version": "1.0.0"
}
```

### Pay-Per-Event Pricing

Predictable event-based billing with automatic tiered discounts (**10% off Bronze**, **25% off Silver**, **40% off Gold+**):

| Event | Free Tier | Gold+ Tier | When Billed |
| --- | :---: | :---: | --- |
| `apify-actor-start` | `$0.005` | `$0.003` | Once per Actor run |
| `trade-query-month` | `$0.01` | `$0.006` | Once per published FT-900 month returned (HTTP 204 unpublished months are free) |
| `trade-record` *(Primary)* | `$0.004` (`$4 / 1,000`) | `$0.0024` (`$2.40 / 1,000`) | Per enriched trade record pushed to Dataset |

### FAQ

**How is `effective_duty_rate_pct` calculated?**\
Dividing official US Census calculated import duties (`CAL_DUT_MO`) by consumption customs value (`CON_VAL_MO`), giving the actual realized tariff burden paid at US borders rather than headline statutory rates.

**Why does leaving `startMonth` blank still work immediately?**\
US Census releases FT-900 data with a ~5-week lag and returns `HTTP 204` for unpublished months. The Actor automatically steps back to the latest published FT-900 release with zero charge for unpublished months.

**Privacy & Telemetry:** This Actor records only anonymous aggregate run metrics (billing event counts, run origin, and a salted one-way user hash — never inputs, credentials, raw user IDs, or extracted data) for reliability and billing analytics.

***

### More Public Regulatory, Trade & ESG Data Actors (MCP-Ready)

Built by [`zertax`](https://apify.com/zertax) — clean-room, serverless, Pay-Per-Event Python Actors with strict Pydantic schemas, UTC provenance, and 1-click Streamable HTTP MCP support:

**Corporate Filings, International Trade & Market Positioning**

- **[SEC EDGAR Exhibit 21 Subsidiaries MCP](https://apify.com/zertax/sec-edgar-exhibit-21-subsidiaries-mcp)** — Form 10-K corporate parent-to-subsidiary trees & jurisdictions (KYB/AML/M\&A)
- **[US Census HS10 Trade Flows & Tariff Duties MCP](https://apify.com/zertax/us-census-hs-trade-tariffs-mcp)** — Monthly US imports/exports, customs value, CIF & calculated tariff duties (`CAL_DUT_MO`)
- **[Canadian SEC 40-F & 6-K Filings (MJDS) MCP](https://apify.com/zertax/canadian-sec-40f-6k-filings-mcp)** — TSX/NYSE interlisted AIF, MD\&A, NI 43-101 & NI 51-101 filings
- **[US CFTC Commitments of Traders (COT) MCP](https://apify.com/zertax/us-cftc-cot-futures-mcp)** — Weekly Disaggregated, TFF Financial & Legacy positioning with computed net exposure

**Voluntary Carbon, ESG & Environmental Compliance**

- **[Verra VCS Carbon Credit Registry MCP](https://apify.com/zertax/verra-carbon-registry-mcp)** — 2026 Platts RaaS projects, VCU issuances, corporate retirements, holdings & cancellations
- **[Gold Standard Impact Registry Carbon Credits MCP](https://apify.com/zertax/gold-standard-carbon-registry-mcp)** — Certified projects, UN SDG impacts, CORSIA & credit batches (Verra-aligned schema)
- **[US EPA & Canada ECCC Facility GHG Emissions MCP](https://apify.com/zertax/epa-eccc-ghgrp-emissions-mcp)** — Unified North American facility CO2e, CO2, CH4 & N2O emissions
- **[US EPA ECHO Environmental Compliance MCP](https://apify.com/zertax/us-epa-echo-enforcement-mcp)** — Clean Air (CAA), Clean Water (CWA/NPDES) & RCRA compliance, violations & penalties

**REST API, Free 2026 Sample CSVs & Multi-Tool MCP**

- **REST JSON API (RapidAPI Hub — Free Basic + Pro/Ultra/Mega plans):** https://rapidapi.com/andy.tertzakian/api/sec-exhibit-21-subsidiaries-us-tariffs-verra-carbon-api
- **Public GitHub Showcase, Python Quickstarts, n8n Workflows & Sample CSVs:** https://github.com/AndyTertzakian/regulatory-tariffs-carbon-mcp
- **Official MCP Registry / Glama Connector:** `io.github.AndyTertzakian/zertax-regulatory-tariffs-carbon-mcp` ([Glama](https://glama.ai/mcp/connectors/io.github.AndyTertzakian/zertax-regulatory-tariffs-carbon-mcp))
- **Free 100-Row 2026 Preview Datasets on Kaggle:** [SEC Exhibit 21](https://www.kaggle.com/datasets/tertzak/sec-exhibit-21-corporate-subsidiaries-2026) · [US Census Tariffs](https://www.kaggle.com/datasets/tertzak/us-census-hs10-tariff-duties-2026) · [Verra VCS Retirements](https://www.kaggle.com/datasets/tertzak/verra-vcs-carbon-credit-retirements-2026) · [Canadian 40-F/6-K](https://www.kaggle.com/datasets/tertzak/canadian-sec-40f-6k-ni-43-101-filings-2026)

# Actor input Schema

## `flow` (type: `string`):

Select US Imports (includes FOB customs value, CIF, shipping charges, dutiable value, and calculated tariff duties) or US Exports (FAS value, domestic vs. re-export split).

## `geography` (type: `string`):

Choose 'hs' for full HS10 detail by Customs District + tariff duties, 'porths' for Port of Entry/Exit (up to HS6), or 'statehs' for US State of Destination/Origin (up to HS6).

## `hsPrefix` (type: `string`):

2- to 10-digit Harmonized System prefix (e.g. '2709' for crude oil, '8542' for semiconductors, '8703' for passenger vehicles, '7601' for unwrought aluminum). Defaults to '2709' for fast sample runs.

## `commLevel` (type: `string`):

Commodity code granularity. Note: quantities, units, and full 10-digit HS10 detail are published on geography='hs' only; 'porths' and 'statehs' stop at HS6 (HS10 auto-adjusts to HS6 on those geographies).

## `startMonth` (type: `string`):

First month to retrieve in YYYY-MM format (e.g. '2025-01'). Leave blank to automatically detect and fetch the latest published US Census FT-900 month.

## `endMonth` (type: `string`):

Last month to retrieve in YYYY-MM format (inclusive, max 24 months per run). Defaults to startMonth when omitted.

## `countries` (type: `array`):

Optional filter by 2-letter ISO codes (e.g. \["CA", "MX", "CN", "DE"]) or 4-digit US Census Schedule C codes (e.g. \["1220", "2010", "5700"]). Leave empty for all partner countries.

## `districts` (type: `array`):

Optional filter by 2-digit Customs District codes when geography='hs' (e.g. \["53" for Houston-Galveston, "39" for Chicago, "27" for Los Angeles]).

## `ports` (type: `array`):

Optional filter by 4-digit Port codes when geography='porths' (e.g. \["5301" for Houston, "2704" for Los Angeles]).

## `states` (type: `array`):

Optional filter by 2-letter US state postal codes when geography='statehs' (e.g. \["TX", "CA", "IL", "MI"]).

## `minValueUsd` (type: `number`):

Optional threshold to exclude tiny shipments (filters on general customs value for imports or FAS value for exports).

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

Maximum number of trade records to output across the run (default 50 keeps AI agent/MCP lookups under 5 seconds; raise up to 5000 for bulk tariff tables).

## `censusApiKey` (type: `string`):

Optional personal US Census API key (free at https://api.census.gov/data/key_signup.html). Leave blank to use the Actor's managed Census key for instant 1-click runs.

## Actor input object example

```json
{
  "flow": "imports",
  "geography": "hs",
  "hsPrefix": "2709",
  "commLevel": "HS10",
  "maxItems": 50
}
```

# Actor output Schema

## `items` (type: `string`):

Direct API link to all validated, Schedule C/D enriched trade flow records.

## `summary` (type: `string`):

Compact JSON summary including months queried, unpublished (HTTP 204) months, record count, and billed events.

# 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 = {
    "hsPrefix": "2709",
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("zertax/us-census-hs-trade-tariffs-mcp").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 = {
    "hsPrefix": "2709",
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("zertax/us-census-hs-trade-tariffs-mcp").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 '{
  "hsPrefix": "2709",
  "maxItems": 50
}' |
apify call zertax/us-census-hs-trade-tariffs-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zertax/us-census-hs-trade-tariffs-mcp"
        }
    }
}
```

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/By7Ca3ezW6kRfrZQV/builds/8JjA0jLmeHBe2jOIl/openapi.json
