Type-safe SDK for 150+ API endpoints
Zero dependencies. Auto-retry with exponential backoff. Full IntelliSense for every method and response. Ship in minutes, not hours.
Install
Add the SDK to your project with npm, pnpm, or yarn. Requires Node.js 20+.
npm install @botoi/sdk Quick start
Import the SDK, pass your API key, and make your first call. Three lines to a working screenshot.
import Botoi from '@botoi/sdk';
const botoi = new Botoi({ apiKey: process.env.BOTOI_API_KEY });
const result = await botoi.screenshot.capture({
url: 'https://example.com',
width: 1280,
height: 720,
});
// Returns a Response object for binary data
const buffer = await result.arrayBuffer(); Examples
Five real-world patterns covering binary responses, compliance checks, schema generation, and more.
Screenshot capture
Capture a full-page screenshot as a binary PNG response. Write it to disk or pipe it to S3.
const screenshot = await botoi.screenshot.capture({
url: 'https://github.com',
width: 1280,
height: 720,
});
const buffer = await screenshot.arrayBuffer();
fs.writeFileSync('screenshot.png', Buffer.from(buffer)); PII detection
Scan text for emails, phone numbers, and other personally identifiable information. Build compliance checks into your pipeline.
const pii = await botoi.pii.detect({
text: 'Contact John at john@example.com or 555-0123',
});
console.log(pii.entities);
// [{ type: 'EMAIL', value: 'john@example.com', start: 16, end: 32 },
// { type: 'PHONE', value: '555-0123', start: 36, end: 44 }] JSON to Zod schema
Convert any JSON object into a Zod schema string. Speed up TypeScript validation setup.
const zod = await botoi.schema.jsonToZod({
json: { name: 'Ada', age: 36, admin: true },
});
console.log(zod.schema);
// z.object({ name: z.string(), age: z.number(), admin: z.boolean() }) Tech stack detection
Detect the technologies behind any URL. Identify frameworks, hosting providers, and analytics tools.
const tech = await botoi.techDetect.detect({
url: 'https://stripe.com',
});
console.log(tech.technologies);
// [{ name: 'React', category: 'JavaScript frameworks' },
// { name: 'Next.js', category: 'Web frameworks' },
// { name: 'Vercel', category: 'PaaS' }] QR code generation
Generate SVG QR codes for any URL or text. Returns a binary response you can save or embed.
const qr = await botoi.qr.generate({
text: 'https://botoi.com',
size: 400,
});
const svg = await qr.text();
fs.writeFileSync('qr.svg', svg); Error handling
The SDK exports typed error classes so you can handle rate limits, auth failures, and API errors with precision.
import Botoi, { BotoiError, BotoiRateLimitError } from '@botoi/sdk';
const botoi = new Botoi({ apiKey: process.env.BOTOI_API_KEY });
try {
const result = await botoi.email.validate({ email: 'test@example.com' });
} catch (err) {
if (err instanceof BotoiRateLimitError) {
console.log(`Rate limited. Retry after ${err.retryAfter}s`);
} else if (err instanceof BotoiError) {
console.log(`API error: ${err.message} (code: ${err.code})`);
}
} BotoiError
Base error class. Contains message, code, and status.
BotoiRateLimitError
Thrown on 429 responses. Exposes retryAfter in seconds.
BotoiAuthError
Thrown on 401/403 responses. Check your API key or plan permissions.
Configuration
Customize the SDK behavior with these constructor options. All fields are optional if the BOTOI_API_KEY environment variable is set.
const botoi = new Botoi({
apiKey: process.env.BOTOI_API_KEY,
baseUrl: 'https://api.botoi.com', // default
maxRetries: 3, // default
timeout: 30000, // 30s default
});
// Or use environment variable (auto-detected)
// BOTOI_API_KEY=your_key node app.js
const botoi = new Botoi(); | Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | BOTOI_API_KEY env | Your Botoi API key |
| baseUrl | string | https://api.botoi.com | API base URL |
| maxRetries | number | 3 | Max retry attempts for failed requests |
| timeout | number | 30000 | Request timeout in milliseconds |
Built for production
Everything you need from an API client, nothing you don't.
Zero dependencies
No transitive packages. The SDK uses the built-in fetch API and ships nothing extra.
Full TypeScript types
Every method, parameter, and response is typed. IntelliSense works out of the box with no extra config.
Auto-retry with backoff
Failed requests retry up to 3 times with exponential backoff. Handles 429s, network errors, and 5xx responses.
Binary response handling
Screenshots, QR codes, PDFs, and other binary endpoints return a standard Response object you can stream or buffer.
Related resources
Other ways to use the Botoi API.
REST API
150+ endpoints with interactive docs, code examples in 5 languages, and a free tier with 1,000 requests/day.
MCP server
Connect Claude, Cursor, VS Code, and other AI assistants to 49 developer tools via Model Context Protocol.
SDK guide
Step-by-step tutorial covering installation, authentication, error handling, and 10 real-world code examples.
Frequently asked questions
Do I need an API key to use the SDK?
Which Node.js versions are supported?
fetch API available in Node 18+ but is tested and supported on Node 20+.
Does the SDK work in the browser?
How does auto-retry work?
maxRetries) with exponential backoff.
It retries on network errors, 429 rate limit responses, and 5xx server errors.
Each retry waits progressively longer to avoid hammering the server.
Can I use the SDK with TypeScript?
Start building with the Botoi SDK
Free tier included. No credit card required. Upgrade when you need higher limits.