API

Scoring API reference

HTTP routes, request fields, decision schemas, response envelopes, and body limits.

On this page

Data plane routes

All paths below are relative to https://api.bastionsecurity.io/api/antibot. Requests use JSON. Server endpoints require both X-Site-Key and X-Secret-Key; browser endpoints use X-Site-Key and an allowlisted Origin.

Method / pathAuthenticationBody / result
POST /fingerprintPublic{fingerprint, behavior?} → token and device_id.
POST /collectPublicVerificationRequest → decision. Observes request IP and user agent.
POST /events/batchPublic{events: VerificationRequest[]} → per-item results.
POST /challengePublic{difficulty?} → challenge.
POST /challenge/verifyPublic{challenge_id, nonce} → proof validity.
POST /verifyPrivateVerificationRequest → decision.
POST /verify/fingerprintPrivate{fingerprint, behavior?} → token and device_id.
POST /verify/batchPrivate{events: VerificationRequest[]} → per-item results.
POST /verify/challengePrivate{difficulty?} → challenge.
POST /verify/challenge/verifyPrivate{challenge_id, nonce} → proof validity.
bash
curl -X POST 'https://api.bastionsecurity.io/api/antibot/verify' \
  -H "X-Site-Key: $BASTION_SITE_KEY" \
  -H "X-Secret-Key: $BASTION_SECRET_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
    "idempotency_key":"checkout-order_123-v1",
    "context":{
      "event_type":"checkout",
      "account_id":"customer_123",
      "order_amount":129.00,
      "payment_hash":"pm_provider_identifier"
    }
  }'

This server-only curl example omits browser telemetry for brevity. A production browser integration should forward the complete buildRequest result. A context-only verification has less evidence available.

VerificationRequest fields

FieldTypeMeaning
contextobject · requiredAuthoritative event and account context.
tokenstring · optionalRegistered fingerprint token, site-bound and valid for 10 minutes.
fingerprintobject · optionalDevice evidence collected by the browser SDK.
behaviorobject · optionalInteraction metrics and bounded samples.
environmentobject · optionalBrowser environment, timestamp, and freshness evidence.
headersstring map · optionalSupply only actual observed headers from your trusted server boundary.
usernamestring · optionalDisplay context for the account.
idempotency_keystring · optional1–128 characters: letters, numbers, underscore, period, colon, hyphen. SDKs generate one when absent.
context fieldTypeContract
event_typestring · requiredsignup, login, promo_claim, checkout, or page_view.
account_idstring · requiredNonempty external account identifier; keep stable across events.
emailstring · optionalCustomer email from your trusted account record.
order_amountnumber · optionalFinite nonnegative server-validated amount. Use a consistent currency convention for your site.
payment_hashstring · optionalStable provider payment identifier or hash; never a raw card number.
promo_codestring · optionalPromo identifier, validated by your application.
ip_address / user_agentstring · optionalActual client values observed at a trusted proxy/application boundary.
request_urlstring · optionalAssociated application URL.
login_succeededboolean · optionalOnly after your server validates credentials. Browser claims are stripped.

Response envelope & decision

Successful JSON responses use {success: true, data, timestamp}. SDKs unwrap data. Treat any 2xx response as an HTTP success; Nest POST routes generally return 201. This example is illustrative evidence, not a guaranteed result for the sample request.

decision.json
{
  "success": true,
  "data": {
    "classification": "suspicious",
    "risk_score": 48,
    "risk_level": "medium",
    "action": "review",
    "request_id": "req_example",
    "device_id": "fp_example",
    "signals": [
      {
        "rule": "device_reuse",
        "score": 20,
        "description": "Device fingerprint is shared by multiple accounts."
      }
    ],
    "identity": {
      "cluster_id": "cluster_example",
      "linked_accounts": 3,
      "shared_devices": 1,
      "shared_ips": 1,
      "shared_payments": 0
    },
    "decision_ms": 14.2,
    "timestamp": "2026-10-14T12:00:00.000Z"
  },
  "timestamp": "2026-10-14T12:00:00.000Z"
}
Decision fieldMeaning
classificationhuman, suspicious, or bot.
risk_score / risk_level0–100 score; low <30, medium 30–59, high 60–84, critical 85–100.
actionallow, review, challenge, or block. Enforce this server policy result.
request_id / device_idRecorded decision identifier and device fingerprint identifier.
signalsArray of {rule, score, description}; preserve evidence in your audit trail.
identityOptional linked-account/shared-device/IP/payment counts; plan-gated.
challengeOptional proof-of-work challenge descriptor.
decision_ms / timestampScoring duration and decision time.

Payload limits

LimitValue
Single scoring HTTP body256 KiB.
Batch HTTP body5 MiB; 1–50 events.
Per-event engine input256 KiB.
Behavior samplesAt most 2,048 total; SDK collection is further bounded.
Other management HTTP bodies100 KiB.
Fingerprint token10 minutes; bound to the site.

Malformed JSON returns 400 and oversized bodies return 413. Batch HTTP success does not mean every item was accepted. See the batch and error guides for recovery behavior.