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

Regulate: find an agency product code

POST https://api.border.bot/v1/regulate

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

The product code the destination’s import agency asks for, in that agency’s coding scheme. Not live yet: no destination has agency codes, so every request answers 422 unsupported_country without a charge. The first will be the US, with FDA’s import product code (e.g. 16AYN07) for foods, drugs, devices, cosmetics and other goods FDA regulates. The answer names the agency and scheme, lists the code’s parts in order, and says whether the agency’s own check accepted it. Costs 1 credit; goods the agency doesn’t regulate are refused (details.reason: "not_regulated", with details.agency) and refunded.

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 yes What the product is, what it is made of, and how it is processed or packed (frozen, smoked, canned…).
destinationCountry string yes Where the goods are imported. Its import agency and coding scheme follow from it (for US, FDA’s import product codes, not live yet: every destination answers 422 unsupported_country for now).
hsCode string no The goods’ tariff code, when known: a hint for the product pick.

Responses#

  • 200: The agency product code and the credits charged. (RegulatorClassifyResponse)
  • 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: No agency product codes for this destination yet (unsupported_country). (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/regulate \
  -H "Authorization: Bearer $BORDERBOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "description": "<string>",
    "destinationCountry": "<string>"
  }'

Example response (200)#

JSON
{
  "data": {
    "agency": "FDA",
    "agencyName": "U.S. Food and Drug Administration",
    "scheme": "us-fda",
    "codeName": "FDA product code",
    "destinationCountry": "string",
    "productCode": "16AYN07",
    "validated": false,
    "checked": false,
    "parts": [
      {
        "level": "industry",
        "label": "Industry",
        "code": "16",
        "description": "Fishery/Seafood Products"
      }
    ],
    "product": {
      "code": "string",
      "description": "string"
    },
    "confidence": 0,
    "reasoning": "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
}