Docs menu
Get started
Using the API
API reference
Classification
Landed cost
Compliance
- POSTRegulate: find an agency product code
- POSTCheck restricted goods
- GETRestricted-goods checks
- GETAgency filing checks
- POSTCheck agency filings (Comply)
- POSTCross: classify, restrict, comply, regulate and calculate in one call
- GETYour restricted-goods rules
- POSTAdd a restricted-goods rule
- DELETERemove a restricted-goods rule
- POSTScreen a person or company
- GETYour screening checks
Reference
Origin
Shipping documents
Bulk
Catalogue
- GETList products
- POSTCreate a product
- GETGet a product
- PATCHUpdate a product
- POSTArchive a product
- GETA product’s history
- GETA product’s codes
- POSTAdd a code
- POSTSuggest codes
- POSTApprove a code
- POSTReject a code
- POSTClassify many products
- GETYour imports
- POSTImport a CSV file
- GETAn import
- GETExport as CSV
- POSTSync records from a source
- GETApproved codes to write back
- GETCatalogue vocabularies
- GETSource kinds
- GETDefault target markets
- POSTSet default target markets
Duty stacking
POST https://api.border.bot/v1/calculate/stacking
Requires an access token from an API client (Authorization: Bearer <access_token>).
Which duty lines apply to a code from an origin on a date, without a shipment: the base duty, then every additional measure (Section 301, 232, reciprocal…), which exemption codes remove which, the measures that depend on metal content or a claim, and the claim codes you could file. Up to 100 lines; free unless your pricing says otherwise. Answers from border.bot’s own data: a destination it doesn’t cover returns 422 unsupported_country.
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 |
|---|---|---|---|
items |
object[] | yes |
Responses#
200: Each line’s stack. (StackingResponse)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: A destination border.bot’s own data doesn’t cover yet (unsupported_country). (Error)429: Rate limited (rate_limited). Retry afterRetry-Afterseconds;RateLimitsays which limit was hit (r=0,tseconds until its window ends) andRateLimit-Policyits 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/stacking \
-H "Authorization: Bearer $BORDERBOT_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"items": [
{
"hsCode": "8479.89.94",
"originCountry": "CN",
"destinationCountry": "US"
}
]
}'const response = await fetch('https://api.border.bot/v1/calculate/stacking', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BORDERBOT_TOKEN}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"items": [
{
"hsCode": "8479.89.94",
"originCountry": "CN",
"destinationCountry": "US"
}
]
}),
});
const data = await response.json();import os, uuid
import requests
response = requests.post(
"https://api.border.bot/v1/calculate/stacking",
headers={"Authorization": f"Bearer {os.environ['BORDERBOT_TOKEN']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"items": [
{
"hsCode": "8479.89.94",
"originCountry": "CN",
"destinationCountry": "US",
},
],
},
)
data = response.json()<?php
$ch = curl_init('https://api.border.bot/v1/calculate/stacking');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('BORDERBOT_TOKEN'),
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'hsCode' => '8479.89.94',
'originCountry' => 'CN',
'destinationCountry' => 'US',
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);Example response (200)#
{
"data": {
"results": [
{
"index": 0,
"ref": "string",
"hsCode": "string",
"hsCodeFormatted": "string",
"originCountry": "string",
"destinationCountry": "string",
"schedule": "string",
"entryDate": "string",
"rateFound": false,
"lines": [
{
"kind": "base",
"type": "string",
"name": "string",
"code": "string",
"rate": "string",
"exemptedBy": "string",
"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"
}
]
},
"legalBasis": "string",
"sourceUrl": "string"
}
],
"conditional": [
{
"name": "string",
"code": "string",
"rate": "string",
"condition": "string"
}
],
"claimable": [
{
"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
}
],
"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"
},
"notes": [
"string"
],
"dataSource": {
"version": "string",
"importedAt": "string",
"datasets": [
{
"dataset": "US:rates",
"seq": 0,
"releaseId": "0199c3a2-7b4e-7d21-9f3a-2c5e8b1d4f60",
"version": "string",
"liveSince": "string"
}
]
}
}
]
},
"credits": {
"charged": 0,
"remaining": 0,
"usageId": "string"
},
"replayed": false
}