Client Libraries
BotShield provides official client libraries as an alternative to calling the REST API directly. Each library wraps the same SDK A 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
Error Handling
| Status Code | Error Type |
|---|---|
| 400 | BadRequestError |
| 401 | AuthenticationError |
| 403 | PermissionDeniedError |
| 404 | NotFoundError |
| 422 | UnprocessableEntityError |
| 429 | RateLimitError |
| >=500 | InternalServerError |
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
- GitHub Repository — Source code, issues, and releases
- Full API Reference — Complete method documentation
- npm Package — Latest published version
- Changelog — Release history
REST API vs. Client Library
Both approaches use the same underlying API and provide the same guarantees. Choose what fits your stack:| REST API | Client Library | |
|---|---|---|
| Integration | HTTP calls from any language | Import and call typed methods |
| Type Safety | Manual (parse JSON responses) | Built-in TypeScript types |
| Retries | Implement yourself | Automatic with backoff |
| Error Handling | Parse HTTP status codes | Typed error classes |
| Dependencies | None (just HTTP) | npm package |
Next Steps
- REST API Reference — Direct HTTP endpoint documentation
- Quick Start — Step-by-step integration walkthrough
- SDK Features — What SDK A provides