Every account starts on the free plan with 100 checks a month. Paid plans start at $19 a month. Start free
← Blog

A Canada and US duty calculator API in one call

Estimate the duty, tax and fees on a parcel or shipment between Canada and the US with one API call, from official government data, with working examples in curl, JavaScript and Python.

By the Othermile team

A store owner at her laptop beside parcels taped with Othermile tape

If your checkout, marketplace or back office needs to know what a parcel will cost at the Canada and US border, you can ask the Othermile API. One call returns each charge, the total, who pays it, and which version of the official rules it used.

What you send

The country it ships from, the country and province or state it goes to, how it travels, and each item with its tariff code, country of origin, quantity and value. Amounts are in cents.

curl https://app.othermile.com/v1/border/quote \
  -H "authorization: Bearer YOUR_KEY" -H "content-type: application/json" \
  -d '{"from":"US","to":"CA","toRegion":"AB","mode":"mail",
       "items":[{"sku":"TEE","hs":"6109.10","origin":"HN","qty":1,
                 "unitValue":{"value":3500,"currency":"CAD"}}]}'

What you get back

Each charge as a line, and the total:

{
  "lines": [
    { "kind": "duty", "label": "Customs duty (18%)", "amount": { "value": 630, "currency": "CAD" } },
    { "kind": "tax",  "label": "GST (5%)",           "amount": { "value": 207, "currency": "CAD" } },
    { "kind": "fee",  "label": "Postal handling fee", "amount": { "value": 995, "currency": "CAD" } }
  ],
  "total": { "value": 1832, "currency": "CAD" },
  "rulebookVersion": "..."
}

The answer also says who pays under the Incoterm you send (the customer at the door by default), any product that cannot enter, and notes such as a CUSMA claim that would change the result.

In JavaScript

const res = await fetch("https://app.othermile.com/v1/border/quote", {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.OTHERMILE_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({
    from: "US", to: "CA", toRegion: "ON", mode: "courier",
    items: [{ sku: "HOODIE", hs: "6110.20", origin: "CN", qty: 1, unitValue: { value: 18000, currency: "CAD" } }],
  }),
});
const quote = await res.json();
console.log(quote.total);

In Python

import os, requests

quote = requests.post(
    "https://app.othermile.com/v1/border/quote",
    headers={"authorization": f"Bearer {os.environ['OTHERMILE_KEY']}"},
    json={"from": "CA", "to": "US", "mode": "courier",
          "items": [{"sku": "MUG", "hs": "6912.00", "origin": "CN", "qty": 2,
                     "unitValue": {"value": 2200, "currency": "USD"}}]},
).json()
print(quote["total"])

Simpler fields for no code tools

For Zapier, Make or a spreadsheet script there is a version that takes dollars and plain fields: POST /v1/border/estimate. It returns the total, duties, taxes and fees as numbers, and the data source in words.

Getting a key

Create a free account at app.othermile.com, open Developers and create an API key. Every call is in the API reference. Every figure is an estimate from official government data, not customs advice.

This guide explains public rules in plain language for general information. It is not customs, tax or legal advice; the exact tariff code, your paperwork and the carrier decide the final amount.

See what your own orders cost at the border.

Start free

Or try the free checker, or get an email when the rules change