API Reference
BotShield provides two SDKs for integrating human presence verification:- Frontend SDK — Drop-in web component for your pages (
cdn.botshield.ai/sdk.js) - Backend SDK — TypeScript/Node.js library for server-side validation (
botshield-sdkon npm)
Get your API keys from the Partner Dashboard → Settings → API & Credentials.
Install
- Frontend (CDN)
- Backend (npm)
The Primary Output: Three Result States
Census’s partner-facing output is three result states:
These are what you build against. In the webhook each maps to its own event: Human Verified →
census.human_verified, MultiPass Active → census.multipass_active, Human Unavailable → census.human_unavailable (covers both denial/error and TTL expiry) — see Webhooks.
Internal verdict + reason (fast-path only)
Under the hood, BotShield computes averdict + reason pair that projects to those three states. This pair is not the partner contract and is never in the webhook. It is surfaced only on the embed component’s botshield:multipass-status event, for clients that want to drive the synchronous fast path without waiting for a fresh challenge:
BotShield has no opinion on which actions require which scope — that is your policy decision. See Human Presence for the full reason enum and the standard/elevated scope canon.
Authentication
All backend SDK calls use your API key in theAuthorization header:
SDK Methods
Core Verification
Create Session
Get a session token to start creating verification requests.
Create Verification Link
Generate a verification request with deep link, web URL, and QR code.
Verify Token
Validate a verification receipt. Returns anonymous claims:
request_id, verified, organization_id, timestamp, nonce.Check Status
Poll verification status. Returns signed token when complete.
Signal Pixel
Store Signal
Store a Signal Pixel bot score server-side. Returns a tamper-proof signal token.
Validate Signal
Validate a signal token to get the real server-side bot score. One-time use.
Partner Config
Get enabled integrations (Turnstile, etc.) for a site key.
Session Management
Revoke Verification
Cancel a pending verification. Use when create-verification-link returns 409.
Revoke Session
Invalidate a session token.
Typical Flow
Webhooks
Verification results are delivered to your callback URL as a signed Svix envelope. Authenticity is the Svix signature, not a token in the body — verify thesvix-id, svix-timestamp, and svix-signature headers with your endpoint signing secret (whsec_...). There is nothing to decode inside the payload.
The payload is anonymous:
census.multipass_active with the same shape. The census.human_unavailable event carries failed_at + reason (denial/error) or expired_at (TTL lapse) instead. event_id is the same req_… value as request_id. No user_email, auth_mode, or botshield_user_id is ever present. Correlate back to your action via request_id and the metadata you supplied when creating the link.
Error Handling
_rateLimit response envelope, and block behavior — see the Rate Limits page.
Next Steps
- Web Component Reference — Frontend SDK details,
BotShield.render()API - Signal Pixel — Passive bot scoring details
- Quick Start — Step-by-step integration walkthrough
- npm package — Backend SDK on npm