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
Inspect a photo of goods
POST https://api.border.bot/v1/inspect
Requires an access token from an API client (Authorization: Bearer <access_token>).
Customs data for every item in one photo: name, description, an English customs description, quantity, category, materials, the 6-digit HS subheading (checked against the live tariff), country of origin (a “Made in” read off the item, quoted, or an estimate of where it was made, never above 0.6) and an estimated retail price with a range, each item with its box in the photo. The code, origin and value carry a probability (the photo model’s own until Inspect is calibrated), and items below your review threshold have needsReview with the reasons. Codes stay at six digits, the HS subheading every country shares: classify an item (POST /classify) for a destination’s national line. Costs the Inspect price per photo, however many items it finds (GET /pricing), up to your workspace’s item cap (or maxItems); refunded if it fails or the photo shows no product (unreadable). Each inspection is kept as your evidence with the photo’s SHA-256, never the photo (GET /inspect lists them). Limited to 10 a minute per workspace.
API client scope: origin.
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 |
|---|---|---|---|
imageUrl |
string | yes | The photo of the goods: an https link, or a base64 data URL (JPEG, PNG, WebP or GIF, up to 6 MB), the same as Classify’s imageUrl. The photo is never stored: the inspection keeps its SHA-256. |
language |
string | no | The language of each item’s name and description (a BCP 47 tag, default en). customsDescription is always English. |
maxItems |
integer | no | Return at most this many items (at most the workspace’s cap, 25 by default). The price is per photo either way. |
reference |
string | no | Your reference (a parcel or order id), kept with the inspection. |
Responses#
200: The items read off the photo, orunreadablewith the reason (nothing charged). (InspectResponse)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 photo model failed (upstream_error). (Error)504: The engine timed out (upstream_timeout). The credits are refunded automatically. (Error)
Example request#
curl -X POST https://api.border.bot/v1/inspect \
-H "Authorization: Bearer $BORDERBOT_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"imageUrl": "https://shop.example/photos/parcel-0142.jpg"
}'const response = await fetch('https://api.border.bot/v1/inspect', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.BORDERBOT_TOKEN}`,
'Content-Type': 'application/json',
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
"imageUrl": "https://shop.example/photos/parcel-0142.jpg"
}),
});
const data = await response.json();import os, uuid
import requests
response = requests.post(
"https://api.border.bot/v1/inspect",
headers={"Authorization": f"Bearer {os.environ['BORDERBOT_TOKEN']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"imageUrl": "https://shop.example/photos/parcel-0142.jpg",
},
)
data = response.json()<?php
$ch = curl_init('https://api.border.bot/v1/inspect');
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([
'imageUrl' => 'https://shop.example/photos/parcel-0142.jpg',
]),
]);
$data = json_decode(curl_exec($ch), true);Example response (200)#
{
"data": {
"items": [
{
"id": "item-1",
"name": "Crew-neck T-shirt",
"description": "A folded white crew-neck T-shirt in jersey knit",
"customsDescription": "cotton knitted t-shirt",
"quantity": {
"value": 0,
"unit": "piece"
},
"category": "Apparel",
"materials": [
"cotton"
],
"hsCode": {
"code": "610910",
"codeFormatted": "6109.10",
"description": "Of cotton",
"level": "subheading",
"probability": 0
},
"origin": {
"country": "VN",
"probability": 0,
"basis": "label",
"evidence": "Made in Vietnam",
"alternatives": [
{
"country": "string",
"probability": 0
}
]
},
"value": {
"amount": 0,
"low": 0,
"high": 0,
"currency": "USD",
"probability": 0,
"basis": "estimate"
},
"condition": "new",
"detectedText": "string",
"region": {
"x": 0,
"y": 0,
"w": 0,
"h": 0
},
"needsReview": false,
"reviewReasons": [
"string"
]
}
],
"unreadable": "string",
"truncated": false,
"calibrated": false,
"inspectionId": "0199c3a2-7b4e-7d21-9f3a-2c5e8b1d4f60",
"imageSha256": "string"
},
"credits": {
"charged": 0,
"remaining": 0,
"usageId": "string"
},
"replayed": false
}