API Documentation

Complete reference for all Gateway API endpoints.

Authentication

Free Tier (API Key)

Public endpoints use the X-API-Key header.

X-API-Key: tariff_YOUR_API_KEY

Don't have a key? Sign up free to get one instantly.

Gateway Account (Bearer Token)

Enterprise endpoints use Bearer authentication. Get your key from Settings → Integrations in your Gateway account.

Authorization: Bearer gw_your_api_key

Base URL

https://api.gatewaylines.com

Calculate US import duties for any HTS code and country of origin. Returns MFN rates, Section 301, IEEPA, reciprocal tariffs, and AD/CVD.

Request Body

hts_codestringrequiredHTS code (e.g., "8471.30.01")
country_codestringrequiredISO country code (e.g., "CN")
declared_valuenumberDeclared value in USD for duty calculation

Example Request

curl -X POST https://api.gatewaylines.com/api/tariff/public/calculate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: tariff_YOUR_KEY" \
  -d '{"hts_code": "8471.30.01", "country_code": "CN", "declared_value": 10000}'

Example Response

{
  "hts_code": "8471.30.01",
  "description": "Portable digital automatic data processing machines...",
  "country": "China",
  "base_duty_rate": "0%",
  "total_tariff_rate": 145,
  "total_duty": 14500,
  "tariff_breakdown": [
    { "type": "MFN", "rate": 0 },
    { "type": "IEEPA", "rate": 20 },
    { "type": "Reciprocal", "rate": 125 }
  ]
}

Error Codes

400Bad request - missing or invalid parameters
401Unauthorized - invalid or missing API key
403Forbidden - endpoint not available on your plan
404Not found - resource does not exist
429Rate limit exceeded - resets daily at midnight UTC
502Bad gateway - upstream service temporarily unavailable
500Server error - contact [email protected]

Rate Limits

Free Tier

Tariff Calculator5 requests per day
AI HTS Search5 requests per day
Container TrackingMonthly tracking subscription (from $15/mo)
3D Load Planner5 requests per day
Parcel Quotes5 requests per day (US domestic only)

Gateway Account

Shipments, Invoices, DocumentsUnlimited
EDI IntegrationUnlimited
WebhooksUnlimited
Container TrackingAll your shipments

Need higher free tier limits? Contact [email protected]

SDK Examples

JavaScript / Node.js

const res = await fetch('https://api.gatewaylines.com/api/tariff/public/calculate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'tariff_YOUR_KEY'
  },
  body: JSON.stringify({
    hts_code: '8471.30.01',
    country_code: 'CN',
    declared_value: 10000
  })
})
const data = await res.json()
console.log(data.total_duty) // 14500

Python

import requests

res = requests.post(
    'https://api.gatewaylines.com/api/tariff/public/calculate',
    headers={'X-API-Key': 'tariff_YOUR_KEY'},
    json={
        'hts_code': '8471.30.01',
        'country_code': 'CN',
        'declared_value': 10000
    }
)
data = res.json()
print(data['total_duty'])  # 14500

Need Help?

Our team is ready to help you integrate Gateway into your systems.