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
Classify a product
POST https://api.border.bot/v1/classify
Requires an access token from an API client (Authorization: Bearer <access_token>).
Find the HS/HTS code for a product shipped to destinationCountry. Give a description, a product page URL, or both. Costs the mode’s credits (GET /v1/classify/modes lists the modes and their prices); a weak answer may escalate to another mode at no extra charge. Failed requests are refunded automatically.
API client scope: classify.
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 |
|---|---|---|---|
description |
string | no | What the product is: type, material/composition, intended use and user. Required unless productUrl or imageUrl is given. |
productUrl |
string | no | Product page URL. border.bot reads the listing (title, brand, materials, price and any stated country of origin) and classifies from it, with your description when you give one. |
imageUrl |
string | no | A product photo, classified with vision (in the modes that read photos: see GET /v1/classify/modes): a public URL, or the picture itself as a data:image/jpeg;base64,… URL (up to 6 MB). When given, the photo is classified instead of the listing URL. |
destinationCountry |
string | yes | Where the parcel is going: selects the tariff (the national one where border.bot has it, else the 6-digit HS). ISO 3166-1 alpha-2, case-insensitive. |
originCountry |
string | no | Where the product was made (context only). ISO 3166-1 alpha-2, case-insensitive. |
mode |
string | no | The classification mode: one of the modes GET /v1/classify/modes lists (each with its price and what it reads). Omitted: the default mode. An unknown or unavailable mode is refused (invalid_input, with details.availableModes). |
title |
string | no | Product title (optional extra context). |
brand |
string | no | Brand (optional extra context). |
sku |
string | no | Your SKU (stored with the usage record). |
price |
number | no | Unit price (optional context). |
currency |
string | no | ISO 4217 currency of price. |
hsCodeHint |
string | no | An HS code you believe is close (2–10 digits) — used as a hint, not trusted blindly. |
Responses#
200: The classification and the credits charged. (ClassifyResponse)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)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/classify \
-H "Authorization: Bearer $BORDERBOT_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"description": "Men'\''s short-sleeve t-shirt, 100% cotton, knitted",
"destinationCountry": "US",
"originCountry": "PT"
}'const response = await fetch('https://api.border.bot/v1/classify', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BORDERBOT_TOKEN}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"description": "Men's short-sleeve t-shirt, 100% cotton, knitted",
"destinationCountry": "US",
"originCountry": "PT"
}),
});
const data = await response.json();import os, uuid
import requests
response = requests.post(
"https://api.border.bot/v1/classify",
headers={"Authorization": f"Bearer {os.environ['BORDERBOT_TOKEN']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"description": "Men's short-sleeve t-shirt, 100% cotton, knitted",
"destinationCountry": "US",
"originCountry": "PT",
},
)
data = response.json()<?php
$ch = curl_init('https://api.border.bot/v1/classify');
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([
'description' => 'Men\'s short-sleeve t-shirt, 100% cotton, knitted',
'destinationCountry' => 'US',
'originCountry' => 'PT',
]),
]);
$data = json_decode(curl_exec($ch), true);Example response (200)#
{
"data": {
"hsCode": "8471300100",
"hsCodeFormatted": "8471.30.01.00",
"nomenclature": "us",
"schedule": "US",
"destinationCountry": "US",
"description": "Portable automatic data processing machines, weighing not more than 10 kg",
"hierarchy": [
{
"level": "chapter",
"code": "84",
"description": "Nuclear reactors, boilers, machinery and mechanical appliances; parts thereof"
},
{
"level": "heading",
"code": "8471",
"description": "Automatic data processing machines and units thereof"
},
{
"level": "subheading",
"code": "847130",
"description": "Portable machines"
},
{
"level": "tariff",
"code": "8471300100",
"description": "Portable automatic data processing machines, weighing not more than 10 kg"
}
],
"confidence": "high",
"score": 0.94,
"probability": 0.94,
"needsReview": false,
"reasoning": "A 14-inch laptop is a portable automatic data processing machine; at 1.4 kg it is under the 10 kg limit of 8471.30.",
"customsDescription": "Laptop computer, 14-inch",
"alternatives": [
{
"hsCode": "8471410150",
"hsCodeFormatted": "8471.41.01.50",
"description": "Other automatic data processing machines comprising in the same housing at least a CPU and an input and output unit",
"score": 0.04,
"confidence": "low"
}
],
"mode": "pro",
"modesRun": [
"pro"
],
"upstreamRequestId": null,
"rulings": [],
"dataSource": {
"version": "HTS 2026 Revision 7",
"importedAt": "2026-10-14T18:04:08.512Z",
"datasets": [
{
"dataset": "US:hs",
"seq": 42,
"releaseId": "01a1502a-2fb3-7e6b-8e4d-a46e75afb07b",
"version": "HTS 2026 Revision 7",
"liveSince": "2026-10-14T18:04:08.512Z"
}
]
},
"engine": "borderbot",
"restrictions": {
"available": true,
"matches": [
{
"id": "restriction_17f4af75ba5554",
"ruleType": "restriction",
"title": "FDA: may be required",
"summary": "FDA data may be required (radiation-emitting electronic products).",
"agency": "FDA",
"flag": "FD1",
"requirement": "may_be_required",
"confidence": "HIGH",
"sourceUrl": "https://www.cbp.gov/document/technical-documentation/ace-appendix-pga",
"sourceRef": "PGA FD1"
}
],
"note": null
},
"filings": [
{
"country": "US",
"agency": "Food and Drug Administration",
"flags": [
{
"flag": "FD1",
"requirement": "may_be_required",
"source": "border",
"code": "8471300100"
}
],
"category": null,
"requirement": "may_be_required",
"rulesLoaded": false
}
]
},
"credits": {
"charged": 2,
"remaining": 98,
"usageId": "usg_01m5dc29tdkdmpffnd43jmg1w5"
},
"replayed": false
}