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

Infer or check the origin of up to 50 products

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

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

Each item is inferred, or validated when it has declaredOrigin. Items run four at a time, each charged as one origin call; one failing (bad photo, insufficient credits) never stops the others. With an Idempotency-Key, each item replays on its own.

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
items object[] yes
reviewThreshold number no The review threshold for every item that doesn’t set its own reviewThreshold (see POST /v1/origin).

Responses#

  • 200: One result per item, in order. (OriginBatchResponse)
  • 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/origin/batch \
  -H "Authorization: Bearer $BORDERBOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "items": [
      {
        "title": "Organic cotton tee",
        "brand": "Example"
      },
      {
        "title": "Wireless earbuds",
        "declaredOrigin": "US",
        "gtin": "6901234567892"
      }
    ]
  }'

Example response (200)#

JSON
{
  "data": {
    "results": [
      {
        "index": 0,
        "ok": false,
        "inference": {
          "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"
        },
        "validation": {
          "declared": "string",
          "verdict": "consistent",
          "probabilityOfMisrepresentation": 0,
          "probability": 0,
          "likelyOrigin": "string",
          "alternates": [
            {
              "country": "string",
              "probability": 0
            }
          ],
          "reasons": [
            "string"
          ],
          "signals": [
            {
              "kind": "user",
              "country": "string",
              "weight": 0,
              "evidence": "string"
            }
          ],
          "needsReview": false,
          "reviewReason": "string",
          "reviewThreshold": 0
        },
        "error": {
          "code": "string",
          "message": "string"
        }
      }
    ]
  },
  "credits": {
    "charged": 0,
    "remaining": 0
  }
}