border.bot
Esc
  • Loading…
↑ ↓ to move↵ to openEsc to close
Docs menu

Calculate a whole shipment

POST https://api.border.bot/v1/calculate/shipment

Requires an access token from an API client (Authorization: Bearer <access_token>).

Duties, taxes, fees and the landed cost of a cart or order to one destination: up to 50 lines (by their facts, or catalogue products by sku), freight and insurance shared out by value, one de minimis check, and per-entry fees charged once. Costs 1 credit per line. Priced on border.bot’s own data: a destination it doesn’t cover yet returns 422 unsupported_country without charging.

API client scope: calculate.

Headers#

Name Type Required Description
idempotency-key string no Make retries safe: a repeat with the same key returns the original result without charging again (keys are scoped to your workspace).

Request body (JSON)#

Name Type Required Description
destinationCountry string yes Destination: one GET /countries marks landedCost. ISO 3166-1 alpha-2, case-insensitive.
currency string no ISO 4217 currency of value, shippingCost and insuranceCost.
shippingCost number no Shipping cost (affects CIF-based duty/VAT bases).
insuranceCost number no Insurance cost.
transportMode "air" | "sea" | "road" | "rail" no Transport mode (fees such as HMF apply to sea freight).
shippingTerms "EXW" | "FCA" | "FAS" | "FOB" | "CFR" | "CIF" | "CPT" | "CIP" | "DAP" | "DPU" | "DDP" no Incoterm of the price (Incoterms 2020). Under C and D terms (CFR, CIF, CPT, CIP, DAP, DPU, DDP) the price already carries the goods to the destination, so shippingCost isn’t added to the customs value again.
shipmentChannel "courier" | "postal" | "freight" no How the goods travel and clear: courier (an express consignment: DHL, UPS, FedEx…), postal (national post) or freight (cargo on its own entry). Omitted: from transportMode — air is courier, sea, road and rail are freight (sea cargo is never an express consignment, so courier by sea is priced as freight). Affects de minimis and fees (US: the informal-entry MPF, 19 CFR 24.23(b)(2), is charged on freight; express consignments pay the carrier’s per-waybill fee, 24.23(b)(4)). The result’s shipmentChannel says which was used.
entryDate string no Calculate with the rates in force on this date (YYYY-MM-DD). Default: today.
tradeAgreement string no Ignored. Preferential rates are applied automatically from the origin and destination; the agreement used is returned as tradeAgreement.
region string no State, province or territory, where import taxes differ inside the country. A destination that taxes by region answers 400 invalid_input with field: "region" without one.
purpose "sale" | "gift" | "sample" | "return" no Why the goods are sent: some thresholds differ for gifts, samples and returns. Default: sale. A gift is a personal gift, not something bought: a free gift with a purchase is sale (or set giftInConjunctionWithPurchase).
sender "person" | "business" no Who sends the goods: a private person or a business. Gift exemptions are usually for gifts from a person (US: up to $100 per recipient per day, 19 CFR 10.152); a gift from a business qualifies only on the declaration the destination accepts, claimed in claims (US: gift_statement, the parcel clearly marked as a gift with a statement enclosed, 19 CFR 10.153(c)). Left out, a gift exemption limited to some senders is applied and the result is estimated.
giftInConjunctionWithPurchase boolean no The gift is given in conjunction with a purchase (a bonus or free article with an order). It isn’t a gift for customs (US 19 CFR 10.153(a)): gift exemptions don’t apply and the goods are treated as sold.
businessBuyer boolean no The buyer is a business: some taxes are reverse-charged or apply differently.
sellerRegistrations string[] no Tax schemes the seller is registered for (EU_IOSS, GB_VAT, AU_GST, NZ_GST, NO_VOEC…). Taxes the seller collects at checkout are returned with collectedBy: "seller".
preference string no best (default): the lowest preferential rate the origin qualifies for. none: the general rate only. Or a programme code (S for USMCA into the US). Every option is returned in options.
claims string[] no Exemption, relief and quota codes being claimed (US Chapter 99 exclusions such as 9903.88.69; an end-use authorisation such as TARIC document N990; a tariff quota order number such as 050331). Codes you could claim are returned in claims.available.
enforceValidation boolean no Refuse a shipment that matches one of the destination’s reject validation rules (400 invalid_input, details.reason: "validation_failed", refunded) instead of reporting it in validation.
declarationType "full" | "simplified" no The declaration the goods are entered on, when known: full (US formal entry) or simplified (US informal entry). Default: what the destination’s value rules require. A full declaration may always be chosen; a simplified one the value rules out is ignored (see notes). Fees differ by declaration (US MPF, the cotton assessment).
filing object no How the declaration is filed, when known: method electronic or paper, preparedBy declarant or authority (a customs officer). Default: the destination’s usual filing (electronic, by the declarant). The US informal-entry MPF differs by both.
items object[] yes The shipment’s lines (up to 50), each with its code, origin and line value, or a catalogue sku (or productId) and quantity. Freight and insurance are shared out by value.

Responses#

  • 200: The shipment’s landed cost, line by line, and the credits charged. (CalculateShipmentResponse)
  • 400: Invalid input (invalid_input). (Error)
  • 401: Missing, invalid or expired access token, or a revoked or expired API client (unauthorized). (Error)
  • 402: Not enough credits (insufficient_credits). Nothing was charged. (Error)
  • 403: Workspace suspended, action disabled, or the client lacks the scope (org_suspended, action_disabled, forbidden). (Error)
  • 409: A request with this Idempotency-Key is still in progress (conflict). (Error)
  • 422: Destination not covered by border.bot’s own data (unsupported_country). (Error)
  • 429: Rate limited (rate_limited). Retry after Retry-After seconds; RateLimit says which limit was hit (r=0, t seconds until its window ends) and RateLimit-Policy its quota. (Error)
  • 500: Unexpected error (internal). (Error)
  • 502: The engine failed (upstream_error). The credits are refunded automatically. (Error)
  • 504: The engine timed out (upstream_timeout). The credits are refunded automatically. (Error)

Example request#

curl -X POST https://api.border.bot/v1/calculate/shipment \
  -H "Authorization: Bearer $BORDERBOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "destinationCountry": "GB",
    "currency": "USD",
    "shippingCost": 12,
    "items": [
      {
        "hsCode": "6109.10",
        "originCountry": "CN",
        "value": 60,
        "quantity": 3
      },
      {
        "hsCode": "6204.62",
        "originCountry": "BD",
        "value": 45
      }
    ]
  }'

Example response (200)#

JSON
{
  "data": {
    "destinationCountry": "string",
    "currency": "string",
    "exchangeRate": 0,
    "transportMode": "string",
    "shipmentChannel": "string",
    "shippingTerms": "string",
    "deMinimis": {
      "threshold": 0,
      "exempt": false,
      "taxThreshold": 0,
      "taxExempt": false
    },
    "customsValue": 0,
    "lines": [
      {
        "kind": "duty",
        "name": "string",
        "type": "string",
        "code": "string",
        "rate": "string",
        "amount": 0,
        "agreement": "string",
        "category": "customs_processing",
        "publisher": {
          "code": "string",
          "label": "string"
        },
        "collectedBy": "border",
        "estimated": false,
        "exemptedBy": "9903.05.86",
        "legalBasis": "Section 301 (failure to prohibit imports made with forced labour, 60 economies); USTR notice 91 FR 47318 (FR 2026-15181); CBP CSMS 69326983; HTSUS ch. 99 subch. III U.S. note 52",
        "sourceUrl": "https://www.federalregister.gov/d/2026-15181",
        "exemption": {
          "code": "9903.05.86",
          "name": "Products listed in U.S. note 52(b)",
          "application": "automatic",
          "kind": "string",
          "legalBasis": "U.S. note 52(b)",
          "sourceUrl": "https://www.federalregister.gov/d/2026-15181",
          "proof": null,
          "alternatives": [
            {
              "code": "9903.05.86",
              "name": "Products listed in U.S. note 52(b)",
              "application": "automatic",
              "kind": null,
              "legalBasis": "U.S. note 52(b)",
              "sourceUrl": "https://www.federalregister.gov/d/2026-15181"
            }
          ]
        }
      }
    ],
    "totals": {
      "goods": 0,
      "shipping": 0,
      "insurance": 0,
      "duties": 0,
      "fees": 0,
      "taxes": 0,
      "dutiesTaxesFees": 0,
      "landedCost": 0
    },
    "notes": [
      "string"
    ],
    "upstreamRequestId": "string",
    "dataSource": {
      "version": "string",
      "importedAt": "string",
      "datasets": [
        {
          "dataset": "US:rates",
          "seq": 0,
          "releaseId": "0199c3a2-7b4e-7d21-9f3a-2c5e8b1d4f60",
          "version": "string",
          "liveSince": "string"
        }
      ]
    },
    "engine": "borderbot",
    "schedule": "string",
    "region": "string",
    "entryDate": "string",
    "entryType": "formal",
    "declaration": {
      "type": "full",
      "term": "string"
    },
    "filing": {
      "method": "electronic",
      "preparedBy": "declarant"
    },
    "estimated": false,
    "needs": [
      "string"
    ],
    "sources": [
      {
        "label": "string",
        "url": "string"
      }
    ],
    "sellerTaxes": 0,
    "flatDuty": {
      "rate": "string",
      "amount": 0
    },
    "validation": [
      {
        "rule": "string",
        "action": "reject",
        "code": "string",
        "message": "string",
        "itemIndex": 0
      }
    ],
    "catalog": [
      {
        "index": 0,
        "productId": "string",
        "itemId": "string",
        "sku": "string",
        "title": "string",
        "schedule": "string",
        "classificationId": "string",
        "code": "string",
        "filled": [
          "string"
        ]
      }
    ],
    "items": [
      {
        "index": 0,
        "hsCode": "string",
        "hsCodeFormatted": "string",
        "originCountry": "string",
        "customsValue": 0,
        "duty": 0,
        "rateFound": false,
        "tradeAgreement": "string",
        "lines": [
          {
            "kind": "duty",
            "name": "string",
            "type": "string",
            "code": "string",
            "rate": "string",
            "amount": 0,
            "agreement": "string",
            "category": "customs_processing",
            "publisher": {
              "code": "string",
              "label": "string"
            },
            "collectedBy": "border",
            "estimated": false,
            "exemptedBy": "9903.05.86",
            "legalBasis": "Section 301 (failure to prohibit imports made with forced labour, 60 economies); USTR notice 91 FR 47318 (FR 2026-15181); CBP CSMS 69326983; HTSUS ch. 99 subch. III U.S. note 52",
            "sourceUrl": "https://www.federalregister.gov/d/2026-15181",
            "exemption": {
              "code": "9903.05.86",
              "name": "Products listed in U.S. note 52(b)",
              "application": "automatic",
              "kind": "string",
              "legalBasis": "U.S. note 52(b)",
              "sourceUrl": "https://www.federalregister.gov/d/2026-15181",
              "proof": null,
              "alternatives": [
                {
                  "code": "9903.05.86",
                  "name": "Products listed in U.S. note 52(b)",
                  "application": "automatic",
                  "kind": null,
                  "legalBasis": "U.S. note 52(b)",
                  "sourceUrl": "https://www.federalregister.gov/d/2026-15181"
                }
              ]
            }
          }
        ],
        "regulatory": [
          {
            "code": "string",
            "name": "string",
            "description": "string",
            "agency": "string",
            "measureType": "string",
            "condition": "string"
          }
        ],
        "options": [
          {
            "tier": "general",
            "programme": {
              "code": "string",
              "name": "string",
              "agreement": "string",
              "proof": "string"
            },
            "rate": "string",
            "amount": 0,
            "estimated": false,
            "applied": false,
            "condition": {
              "kind": "pharmaceutical",
              "code": "string",
              "label": "string"
            },
            "quota": "string",
            "relief": {
              "code": "string",
              "name": "string",
              "kind": "autonomous_suspension"
            }
          }
        ],
        "claims": {
          "available": [
            {
              "code": "9903.94.06",
              "name": "string",
              "affects": "string",
              "affectsCode": "9903.94.05",
              "kind": "string",
              "legalBasis": "U.S. note 33(h)",
              "sourceUrl": "string",
              "proof": "string",
              "condition": null
            }
          ],
          "applied": [
            {
              "code": "string",
              "name": "string",
              "application": "automatic"
            }
          ]
        },
        "availableExemptions": [
          "string"
        ],
        "contentHints": [
          {
            "code": "9903.82.06",
            "name": "string",
            "fields": [
              "materials[steel].weightKg",
              "materials[steel].origins.melt_pour"
            ],
            "note": "string"
          }
        ],
        "entryCodes": [
          {
            "code": "9903.05.90",
            "role": "exemption",
            "name": "Goods under Section 232 aren’t subject to the forced-labour duties (U.S. note 52(f))",
            "type": "S301_FORCED_LABOUR",
            "lines": [
              "9903.05.31"
            ]
          },
          {
            "code": "9903.94.05",
            "role": "additional",
            "name": "Section 232 automobile parts (25%)",
            "type": "S232_AUTO_PARTS",
            "lines": [
              "9903.94.05"
            ]
          },
          {
            "code": "8471300100",
            "role": "tariff",
            "name": "General rate",
            "type": "CUSTOMS_DUTY",
            "lines": [
              "84713001"
            ]
          }
        ],
        "entryCodeOrder": {
          "label": "string",
          "url": "string"
        }
      }
    ]
  },
  "credits": {
    "charged": 0,
    "remaining": 0,
    "usageId": "string"
  },
  "replayed": false
}