Customs Duty API

REST API for import duty rates, HS code classification, landed cost calculation, and FTA savings. One API call returns duty + VAT + anti-dumping + documents for any product into any country.

47
Countries
523K+
Tariff codes
60+
FTAs
550K+
Pref. rates
Get API Key →   View Docs

Landed Cost

Duty + VAT/GST + anti-dumping + social welfare surcharge. Handles Brazil's 5-tax sequential stack and India's BCD+SWS+IGST+exemptions.

HS Classification

Describe your product in plain English. AI returns the correct HS code with confidence score. Cache-first, vector-search, Claude fallback.

FTA Savings

60+ trade agreements. Automatically finds preferential rates for your origin-destination pair. Shows the agreement name and saving amount.

Sanctions Check

Every tariff lookup checks SANCTIONS_MEASURE first. Blocked routes return immediately with a clear warning. Never cached.

Pricing

Simple, transparent pricing. No per-transaction fees. No annual contracts.

Free
£0
50 lookups/mo
2 countries
Pro
£14/mo
500 lookups/mo
All 51 countries
Business
£39/mo
2,000 lookups/mo
FTA savings + alerts
Enterprise
£99/mo
Unlimited
ERP integration + API

Quick Start

Get your API key by signing up at customs-compliance.ai/app, then start making requests:

cURL
Python
JavaScript
# Get landed cost for importing smartphones (HS 8517) from China to India
curl -X POST https://epytgmksddhvwziwxhuq.supabase.co/functions/v1/tariff-lookup \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "commodity_code": "85171400",
    "import_country": "IN",
    "export_country": "CN",
    "customs_value": 10000,
    "currency": "USD"
  }'
# Python
import requests

response = requests.post(
    "https://epytgmksddhvwziwxhuq.supabase.co/functions/v1/tariff-lookup",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "commodity_code": "85171400",
        "import_country": "IN",
        "export_country": "CN",
        "customs_value": 10000,
        "currency": "USD"
    }
)
print(response.json())
// JavaScript (Node.js / browser)
const response = await fetch(
  "https://epytgmksddhvwziwxhuq.supabase.co/functions/v1/tariff-lookup",
  {
    method: "POST",
    headers: {
      "X-API-Key": "YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      commodity_code: "85171400",
      import_country: "IN",
      export_country: "CN",
      customs_value: 10000,
      currency: "USD"
    })
  }
);
const data = await response.json();
console.log(data);

Authentication

All requests require an API key in the X-API-Key header:

X-API-Key: ci_live_your_key_here

Get your key by signing up at customs-compliance.ai/app. Free accounts get 50 lookups per month.

1. Tariff Lookup — Landed Cost

Returns the complete landed cost breakdown for any commodity imported into any of 51 countries. Includes customs duty, VAT/GST, anti-dumping duties, exemptions, drawback rates, and required import documents.

POST/functions/v1/tariff-lookup

Request Parameters

ParameterTypeDescription
commodity_codestringRequiredHS code (any length — auto-matched to the country's national format). Accepts 4, 6, 8, or 10 digits.
import_countrystringRequired2-letter ISO code of the importing country (e.g. IN, GB, US, BR)
export_countrystringOptional2-letter ISO code of the exporting country. Required for preferential rates, anti-dumping, and origin-specific measures.
customs_valuenumberOptionalCIF value in the specified currency. Omit for rates-only response (no monetary amounts calculated).
currencystringOptionalCurrency code. Default: USD. Supported: USD, EUR, GBP, INR, ZAR, BRL, CNY, JPY, AED.

Logistics Parameters (Optional)

Include any of these to get a full landed cost with freight, insurance, port handling, and brokerage. When omitted, only border costs (duties + taxes) are returned.

ParameterTypeDescription
incotermstringOptionalIncoterm code: EXW, FOB, CIF, DDP, CFR, DAP, etc. Default: FOB. Determines which logistics costs the buyer bears.
origin_portstringOptionalPort of loading — UN/LOCODE (e.g. CNSHA = Shanghai, INNSA = Nhava Sheva). Gives port-to-port freight rates.
dest_portstringOptionalPort of discharge — UN/LOCODE (e.g. GBFXT = Felixstowe, USLAX = Los Angeles).
container_typestringOptional20FT, 40FT (default), 40HC, LCL, or AIR_KG
transport_modestringOptionalSEA (default), AIR, RAIL, or ROAD
freightnumberOptionalYour actual freight cost in USD. Overrides the benchmark estimate.
insurancenumberOptionalYour actual insurance cost in USD. Overrides the auto-estimate.
goods_categorystringOptionalGENERAL (default), HAZMAT, REEFER, HIGH_VALUE, FRAGILE, PERISHABLE
weight_kgnumberOptionalCargo weight in kg. Used for air freight calculations.
volume_cbmnumberOptionalCargo volume in CBM. Used for LCL calculations.
inland_originnumberOptionalInland transport cost at origin (USD).
inland_destnumberOptionalInland transport cost at destination (USD).

Response — Rates Only

200 OK
{
  "status": "OK",
  "mode": "rates_only",
  "input": {
    "commodity_code": "85171400",
    "import_country_name": "India",
    "export_country_name": "China",
    "commodity_description": "Telephone sets, smartphones",
    "valuation_basis": "CIF"
  },
  "duty": {
    "mfn_rate_pct": 15.0,
    "effective_rate_pct": 15.0,
    "exemption_rate_pct": null,
    "sws_rate_pct": 1.5,
    "pref_rate_pct": null,
    "pref_agreement": null
  },
  "indirect_tax": {
    "taxes": [{
      "tax_type": "GST",
      "rate_pct": 18.0,
      "basis": "CUSTOMS_VALUE_PLUS_DUTY"
    }]
  },
  "trade_remedies": { "measures": [] },
  "drawback": {
    "drawback_rate_pct": 2.5,
    "drawback_cap_amt": 18.50,
    "drawback_cap_currency": "INR"
  },
  "import_conditions": [
    { "document_code": "BOE", "description": "Bill of Entry (ICEGATE)", "mandatory": true },
    { "document_code": "BIS-CRS", "description": "BIS Registration (Compulsory Registration Scheme)", "mandatory": true }
  ],
  "summary": {
    "effective_duty_rate_pct": 15.0,
    "sws_rate_pct": 1.5,
    "vat_rate_pct": 18.0,
    "total_border_rate_pct": 34.5
  }
}

Response — Full Calculation (with customs_value)

200 OK
// When customs_value is provided, summary includes monetary amounts:
"summary": {
  "mode": "full_calculation",
  "customs_value": 10000,
  "duty_amount": 1500.00,
  "sws_amount": 150.00,
  "vat_amount": 2097.00,
  "total_border_cost": 3747.00,
  "total_landed_cost": 13747.00,
  "border_cost_pct": 37.47,
  "currency": "USD"
}

Response — Full Calculation with Logistics

When logistics parameters are included, the response gains a logistics block and additional summary fields:

200 OK
// When incoterm, container_type, or other logistics params are included:
"summary": {
  "customs_value": 10000,
  "duty_amount": 400.00,
  "vat_amount": 0.00,
  "total_border_cost": 400.00,
  "total_landed_cost": 10400.00,
  // Logistics fields (only when logistics params provided):
  "freight_usd": 2500.00,
  "insurance_usd": 50.00,
  "port_handling_usd": 380.00,
  "brokerage_usd": 150.00,
  "logistics_cost_usd": 3130.00,
  "incoterm": "FOB",
  "is_logistics_estimate": true,
  "total_true_landed_cost": 13530.00
},
"logistics": {
  "status": "OK",
  "incoterm": "FOB",
  "buyer_bears": { "freight": true, "insurance": true, "import_duty": true, ... },
  "freight": {
    "amount_usd": 2500.00,
    "source": "FBX_BENCHMARK",
    "container_type": "40FT",
    "transit_days_min": 20,
    "transit_days_max": 25
  },
  "insurance": { "amount_usd": 50.00, "rate_pct": 0.35 },
  "port_handling_dest": { "amount_usd": 380.00 },
  "brokerage": { "amount_usd": 150.00 },
  "documentation": { "amount_usd": 50.00 },
  "total_logistics_usd": 3130.00,
  "cif_value_usd": 12550.00,
  "is_estimate": true,
  "disclaimer": "Freight rates are benchmark estimates..."
}

Key fields for API consumers

summary.total_landed_costBorder costs only (duties + taxes + goods value)
summary.total_true_landed_costFull landed cost including freight, insurance, handling, brokerage
summary.logistics_cost_usdTotal logistics cost (freight + insurance + handling + brokerage + docs)
summary.is_logistics_estimatetrue if benchmark rates were used, false if user provided actual freight/insurance

2. Classify — Product Description to HS Code

Given a product description in plain English, returns the best-matching HS code with confidence score and country-specific MFN rate. Uses a 3-stage pipeline: cache → vector search → Claude AI.

POST/functions/v1/classify

Request Parameters

ParameterTypeDescription
descriptionstringRequiredProduct description in plain English. More detail = better accuracy.
countrystringOptional2-letter ISO code. Default: ZA. Returns the country-specific commodity code and MFN rate.

Response

200 OK
{
  "status": "ok",
  "suggestions": [
    {
      "commodity_code": "20041010",
      "subheading_code": "200410",
      "confidence": 0.94,
      "reasoning": "Frozen potato products, prepared or preserved",
      "mfn_rate": 30.0,
      "source": "VECTOR"
    }
  ]
}

Confirm a Classification

After the user selects the correct code, confirm it to cache for instant future lookups:

{
  "confirm_code": "20041010",
  "description": "Frozen potato chips, pre-cooked, in 25kg bags",
  "country": "IN"
}

3. Enrich PO — Purchase Order Customs Intelligence

Enriches a purchase order (or any list of line items) with full customs intelligence: auto-classifies HS codes, calculates landed costs, checks for trade remedies, lists required documents, and identifies savings opportunities. Optionally includes freight & logistics for true landed cost.

POST/functions/v1/enrich-po

Request Parameters

ParameterTypeDescription
import_countrystringRequired2-letter ISO code of the importing country
export_countrystringOptional2-letter ISO code of the default exporting country (can be overridden per line)
currencystringOptionalCurrency code. Default: USD
linesarrayRequired1-50 line items (see below)
incotermstringOptionalPO-level incoterm (e.g. FOB, CIF). Triggers logistics calculation.
origin_portstringOptionalPort of loading UN/LOCODE
dest_portstringOptionalPort of discharge UN/LOCODE
container_typestringOptional20FT, 40FT, 40HC, LCL, AIR_KG
freightnumberOptionalYour actual total freight cost (USD). Overrides benchmark.
insurancenumberOptionalYour actual insurance cost (USD).

Line Item Fields

FieldTypeDescription
line_idstringRequiredUnique line identifier
descriptionstringRequired*Product description (used for AI HS classification)
hs_codestringOptionalPre-classified HS code. If provided, skips AI classification.
total_valuenumberOptionalLine total value (for duty amount calculation)
supplier_countrystringOptionalOverride export country for this specific line

Response

200 OK
{
  "status": "OK",
  "summary": {
    "total_lines": 3,
    "classified_lines": 3,
    "total_goods_value": 15000,
    "total_duty": 600.00,
    "total_tax": 0.00,
    "total_landed_cost": 15600.00,
    // When logistics params included:
    "freight_usd": 2500.00,
    "insurance_usd": 55.00,
    "logistics_cost_usd": 3185.00,
    "total_true_landed_cost": 18785.00,
    "documents_needed": ["Commercial Invoice", "Bill of Lading", "Certificate of Origin"],
    "sanctions_clear": true
  },
  "lines": [
    {
      "line_id": "1",
      "classification": { "hs_code": "0904120000", "confidence": 0.75, "source": "TEXT_MATCH" },
      "duty": { "mfn_rate_pct": 4.0, "effective_rate_pct": 4.0 },
      "amounts": { "goods_value": 5000, "duty_amount": 200, "total_landed_cost": 5200 },
      "logistics_allocation": { "freight_share": 833, "total_true_landed": 6261 },
      "documents_required": [...],
      "savings_opportunities": [...]
    }
  ],
  "declaration": { // WCO Data Model 3.0 aligned customs declaration JSON }
}

4. Opportunities — Trade Intelligence Feed

Returns personalised trade opportunities based on the tenant's product catalogue, trade routes, and ERP data. Includes FTA savings, duty reductions, new market signals, and competitor disadvantages.

GET/functions/v1/opportunities
200 OK
{
  "opportunities": [
    {
      "type": "NEW_FTA",
      "title": "FTA savings on flat-rolled steel to South Africa",
      "saving_pct": 10.0,
      "commodity_code": "7210",
      "route": "GB → ZA",
      "agreement": "SACU-EPA",
      "ai_insight": "Based on your Xero purchase history, you import £45K/year of steel from UK suppliers..."
    }
  ]
}

4. Alerts — Tariff Change Notifications

Returns active trade alerts: duty increases, new anti-dumping duties, expiring preferences, sanctions changes, and regulatory updates relevant to the tenant's trade profile.

GET/functions/v1/alerts

Error Responses

404 Not Found
{
  "status": "error",
  "error": "Commodity code 99999999 not found for IN"
}
403 Sanctions Block
{
  "status": "BLOCKED",
  "blocked_reason": "SANCTIONS",
  "message": "This trade route is subject to active sanctions. Do not proceed."
}

Supported Countries

51 countries with national tariff data, preferential rates, and import conditions:

Full national tariff data: IN (India), GB (UK), US (USA), CN (China), ZA (South Africa), NA (Namibia), BR (Brazil), MX (Mexico), AU (Australia), AE (UAE), SA (Saudi Arabia), TH (Thailand), PH (Philippines), AR (Argentina), CL (Chile), UY (Uruguay), OM (Oman), MU (Mauritius), AO (Angola), DO (Dominican Republic)

EU Common External Tariff (27 countries): AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE

HS Code Resolution

You don't need the exact national code format. The API accepts any length and resolves to the best match:

InputResolves toExample
4-digit headingFirst leaf commodity851785171400
6-digit subheadingBest national match85051185051110
8-digit codeExact match8505111085051110
10-digit codeTrimmed to match850511100085051110

Rate Limits

PlanLookups/monthRate
Free505 req/min
Pro50030 req/min
Business2,00060 req/min
EnterpriseUnlimited120 req/min

Ready to integrate?

Get your API key in 30 seconds. Free tier includes 50 lookups/month.

Get API Key →