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

Classify up to 25 products

POST https://api.border.bot/v1/classify/batch

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

Each item is a classify request, run four at a time and charged as one classification by its own mode; one failing (an unclassifiable description, insufficient credits) never stops the others and is refunded. With an Idempotency-Key, each item replays on its own.

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
items ClassifyRequest[] yes

Responses#

  • 200: One result per item, in order. (ClassifyBatchResponse)
  • 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 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/batch \
  -H "Authorization: Bearer $BORDERBOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "items": [
      {
        "description": "Men'\''s short-sleeve t-shirt, 100% cotton, knitted",
        "destinationCountry": "US"
      },
      {
        "description": "Stainless steel water bottle, 750 ml",
        "destinationCountry": "GB"
      }
    ]
  }'

Example response (200)#

JSON
{
  "data": {
    "results": [
      {
        "index": 0,
        "ok": false,
        "classification": {
          "hsCode": "6109100012",
          "hsCodeFormatted": "6109.10.00.12",
          "nomenclature": "us",
          "destinationCountry": "string",
          "description": "string",
          "englishDescription": "T-shirts, singlets and other vests, knitted: of cotton",
          "hierarchy": [
            {
              "level": "chapter",
              "code": "string",
              "description": "string"
            }
          ],
          "levels": [
            {
              "level": "chapter",
              "code": "610910",
              "description": "Of cotton"
            }
          ],
          "supplementaryUnits": [
            {
              "code": "string",
              "abbreviation": "string",
              "label": "string",
              "unit": "string",
              "direction": "both",
              "origins": [
                "string"
              ]
            }
          ],
          "confidence": "high",
          "score": 0,
          "probability": 0,
          "needsReview": false,
          "reasoning": "string",
          "customsDescription": "string",
          "alternatives": [
            {
              "hsCode": "string",
              "hsCodeFormatted": "string",
              "description": "string",
              "englishDescription": "string",
              "levels": [
                {
                  "level": "chapter",
                  "code": "610910",
                  "description": "Of cotton"
                }
              ],
              "score": 0,
              "confidence": "high",
              "supplementaryUnits": [
                {
                  "code": "string",
                  "abbreviation": "string",
                  "label": "string",
                  "unit": "string",
                  "direction": "both",
                  "origins": [
                    "string"
                  ]
                }
              ],
              "restrictions": {
                "available": false,
                "matches": [
                  {
                    "id": "restriction_0a1b2c3d4e5f60",
                    "ruleType": "prohibition",
                    "title": "FDA: may be required",
                    "summary": "string",
                    "agency": "FDA",
                    "flag": "FD1",
                    "requirement": "required",
                    "confidence": "HIGH",
                    "sourceUrl": "string",
                    "sourceRef": "string"
                  }
                ],
                "note": "string"
              },
              "filings": [
                {
                  "country": "string",
                  "agency": "U.S. Consumer Product Safety Commission",
                  "requirement": "required",
                  "flags": [
                    {
                      "flag": "CP2",
                      "requirement": "required",
                      "source": "agency",
                      "code": "string"
                    }
                  ],
                  "category": "Toys",
                  "rulesLoaded": false
                }
              ]
            }
          ],
          "filings": [
            {
              "country": "string",
              "agency": "U.S. Consumer Product Safety Commission",
              "requirement": "required",
              "flags": [
                {
                  "flag": "CP2",
                  "requirement": "required",
                  "source": "agency",
                  "code": "string"
                }
              ],
              "category": "Toys",
              "rulesLoaded": false
            }
          ],
          "restrictions": {
            "available": false,
            "matches": [
              {
                "id": "restriction_0a1b2c3d4e5f60",
                "ruleType": "prohibition",
                "title": "FDA: may be required",
                "summary": "string",
                "agency": "FDA",
                "flag": "FD1",
                "requirement": "required",
                "confidence": "HIGH",
                "sourceUrl": "string",
                "sourceRef": "string"
              }
            ],
            "note": "string"
          },
          "mode": "pro",
          "modesRun": [
            "string"
          ],
          "upstreamRequestId": "string",
          "schedule": "string",
          "readFromUrl": "string",
          "readFromImage": "string",
          "rulings": [
            {
              "rulingNumber": "string",
              "code": "string",
              "subject": "string",
              "url": "string"
            }
          ],
          "dataSource": {
            "version": "string",
            "importedAt": "string",
            "datasets": [
              {
                "dataset": "US:rates",
                "seq": 0,
                "releaseId": "0199c3a2-7b4e-7d21-9f3a-2c5e8b1d4f60",
                "version": "string",
                "liveSince": "string"
              }
            ]
          },
          "engine": "borderbot",
          "identifiedAs": "string",
          "webSources": [
            {
              "url": "https://www.example.com/products/sn99",
              "title": "Out of Office SN99 sneaker"
            }
          ],
          "materialUncertain": false,
          "valueUncertain": false,
          "setArticles": [
            {
              "description": "stainless steel table knife",
              "quantity": 6,
              "hsCode": "8211914000",
              "hsCodeFormatted": "8211.91.40.00"
            }
          ],
          "product": {
            "url": "string",
            "finalUrl": "string",
            "siteName": "string",
            "title": "string",
            "description": "string",
            "brand": "string",
            "sku": "string",
            "gtin": "string",
            "mpn": "string",
            "category": "string",
            "material": "string",
            "color": "string",
            "price": 0,
            "currency": "string",
            "images": [
              "string"
            ],
            "countryOfOrigin": "string",
            "originEvidence": "string",
            "sources": [
              "json-ld"
            ],
            "summary": "string"
          },
          "origin": {
            "country": "string",
            "confidence": "high",
            "source": "user",
            "evidence": "string",
            "candidates": [
              {
                "country": "string",
                "score": 0
              }
            ],
            "probability": 0,
            "alternates": [
              {
                "country": "string",
                "probability": 0
              }
            ],
            "signals": [
              {
                "kind": "user",
                "country": "string",
                "weight": 0,
                "evidence": "string"
              }
            ],
            "needsReview": false,
            "reviewReason": "string",
            "reviewThreshold": 0,
            "reasoning": "string"
          }
        },
        "error": {
          "code": "string",
          "message": "string"
        }
      }
    ]
  },
  "credits": {
    "charged": 0,
    "remaining": 0
  }
}