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

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, or unreadable with 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 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 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"
  }'

Example response (200)#

JSON
{
  "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
}