Skip to main content

Client Libraries

BotShield provides official client libraries as an alternative to calling the REST API directly. Each library wraps the same Census verification operations and provides typed interfaces, automatic retries, and error handling out of the box.
Client libraries require an API key. Request developer access to get started.

Available SDKs

TypeScript / JavaScript

Server-side TypeScript and JavaScript SDK. Works with Node.js, Deno, Bun, Cloudflare Workers, and Vercel Edge Runtime.

More Languages Coming

Additional SDKs (Python, Go, etc.) are planned. Contact us if you have a specific language requirement.

TypeScript / JavaScript

The TypeScript SDK is published on npm and generated with Stainless for full type safety and consistency with the REST API.

Installation

Quick Start

Census is anonymous. You do not pass a user email or auth mode — there is no identity-bearing parameter and none is returned. Correlate results back to your own user via the metadata you supply and the request_id you receive.

Validating a Verification Token

The synchronous verification_token (delivered on your return_url or polled via status) is a PII-free signed receipt. Validate it with verifyToken:

Error Handling

Automatic Retries

The SDK automatically retries failed requests up to 2 times with exponential backoff. Connection errors, timeouts, 429 rate limits, and 5xx server errors are all retried by default.

Supported Runtimes

  • Node.js 20 LTS or later
  • Deno v1.28.0+
  • Bun 1.0+
  • Cloudflare Workers
  • Vercel Edge Runtime

Resources


REST API vs. Client Library

Both approaches use the same underlying API and provide the same guarantees. Choose what fits your stack:
If you’re already using TypeScript/JavaScript on your server, the client library is the fastest path to integration. For other languages or minimal-dependency environments, the REST API works from anywhere.

Next Steps