DEV Community

Archie Kane
Archie Kane

Posted on

Free API: Look Up Any US Tariff Rate in Seconds

Tariff data is a surprisingly painful problem for developers.

The official source — the USITC Harmonized Tariff Schedule — is a 3,500-page PDF. The API alternatives are either expensive, incomplete, or don't include the Section 301 China surcharges that have fundamentally changed import costs since 2018.

So I built one: the US Tariff Rates API at ustariffrates.com/dev.

Here's what it covers and how to use it.


What the API does

  • HTS code search — full-text search across 35,571 codes
  • Tariff details — MFN rate + Section 301 (China) + Section 232 (steel/aluminum) + AD/CVD + FTA rates, all in one response
  • Landed cost calculator — duties + Merchandise Processing Fee + Harbor Maintenance Fee
  • AI classification — describe a product in plain English, get the HTS code

Free tier: 100 calls/month. No credit card required.


Getting Started

Get a free API key at ustariffrates.com/pricing — instant, no approval needed.

Base URL: https://ustariffrates.com/api
Auth: X-API-Key header


Example 1: Search for an HTS Code

Say you're importing stainless steel cookware. Start with a search:

curl "https://ustariffrates.com/api/hts/search?q=stainless+steel+cookware" \
  -H "X-API-Key: YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "results": [
    {
      "hts_code": "7323.93.00",
      "description": "Table, kitchen or other household articles of stainless steel",
      "chapter": 73,
      "heading": "7323",
      "unit": "No."
    }
  ],
  "total": 12,
  "page": 1,
  "per_page": 20
}
Enter fullscreen mode Exit fullscreen mode

Example 2: Get Full Tariff Details

Once you have the code, pull the full tariff breakdown:

curl "https://ustariffrates.com/api/hts/7323.93.00" \
  -H "X-API-Key: YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "hts_code": "7323.93.00",
  "description": "Table, kitchen or other household articles of stainless steel",
  "mfn_rate": "2%",
  "section_301": {
    "applies": true,
    "rate": "25%",
    "list": "List 3"
  },
  "section_232": {
    "applies": false,
    "rate": null
  },
  "fta_rates": {
    "USMCA": "Free",
    "Korea": "Free",
    "Singapore": "Free"
  }
}
Enter fullscreen mode Exit fullscreen mode

So for stainless steel cookware from China: 2% MFN + 25% Section 301 = 27% effective rate. From Mexico with USMCA: Free. That's a massive sourcing decision hiding in the data.


Example 3: Calculate Landed Cost

import requests

API_KEY = "your_api_key"

response = requests.post(
    "https://ustariffrates.com/api/duty/calculate",
    headers={"X-API-Key": API_KEY},
    json={
        "hts_code": "7323.93.00",
        "country_of_origin": "CN",
        "customs_value_usd": 50000,
        "freight_usd": 2500,
        "shipment_mode": "ocean"
    }
)

result = response.json()
print(f"Total duty:        ${result['total_duty']:>10,.2f}")
print(f"MPF:               ${result['mpf']:>10,.2f}")
print(f"HMF:               ${result['hmf']:>10,.2f}")
print(f"Total landed cost: ${result['total_landed_cost']:>10,.2f}")
Enter fullscreen mode Exit fullscreen mode

Output:

Total duty:        $ 13,500.00
MPF:               $    485.00
HMF:               $     62.50
Total landed cost: $ 66,547.50
Enter fullscreen mode Exit fullscreen mode

That $50K shipment actually costs $66.5K to get through US customs from China. From Vietnam (no Section 301): ~$53.5K. The API makes these comparisons trivial to automate.


Example 4: AI HTS Classification

Not sure what code to use? Describe the product:

const res = await fetch("https://ustariffrates.com/api/classify", {
  method: "POST",
  headers: {
    "X-API-Key": "your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    description: "USB-C charging cable, 6ft braided nylon, 100W power delivery, laptop compatible",
    country_of_origin: "CN",
    include_duty: true,
  }),
});

const result = await res.json();
console.log(`HTS: ${result.hts_code}`);
console.log(`Confidence: ${(result.confidence * 100).toFixed(0)}%`);
console.log(`Description: ${result.description}`);
console.log(`MFN rate: ${result.mfn_rate}`);
console.log(`Section 301: ${result.section_301_rate}`);
Enter fullscreen mode Exit fullscreen mode

Output:

HTS: 8544.42.90
Confidence: 88%
Description: Electric conductors for a voltage ≤ 1,000V, fitted with connectors
MFN rate: Free
Section 301: 25%
Enter fullscreen mode Exit fullscreen mode

Pricing

Tier Price Calls/month
Free $0 100
Basic $29/mo 1,000
Pro $99/mo 10,000
Enterprise $499/mo Unlimited

Resources


Why this matters right now

US tariff policy has changed dramatically since 2018. Section 301 alone can add 7.5% to 145% on Chinese imports. Section 232 adds 25% on steel and 10% on aluminum globally. New reciprocal tariffs are being announced frequently.

Most existing tools don't have this data in a clean, queryable form. Building it into your application (or even just using it for internal calculations) can be the difference between accurate landed cost models and expensive surprises at the port.

Questions? Drop them below or reach out at ops@rawket.io.

Top comments (0)