Client Libraries

TypeScript SDK

Type-safe Bytekit client for Node.js and modern JavaScript runtimes.

The official TypeScript SDK is a thin, type-safe wrapper over the Bytekit REST API. It works in Node.js and any runtime with a global fetch (Bun, Deno, Cloudflare Workers, modern browsers).

Install

npm install @rapidcrawl/sdk

Initialize

import { RapidCrawl } from '@rapidcrawl/sdk';

const client = new RapidCrawl({
  apiKey: process.env.RAPIDCRAWL_API_KEY!, // sk_live_… or sk_test_…
});

By default the client targets production (https://api.bytekit.com). Point it at staging by passing baseUrl:

const client = new RapidCrawl({
  apiKey: process.env.RAPIDCRAWL_API_KEY!,
  baseUrl: 'https://api-stg.bytekit.com',
});

Your first scrape

const result = await client.scrape.create({
  url: 'https://example.com',
  formats: ['markdown'],
});

console.log(result);

Capture a screenshot

const shot = await client.screenshots.create({
  url: 'https://example.com',
  full_page: true,
});

console.log(shot);

Handle errors

Any 4xx/5xx response throws a RapidCrawlError carrying the HTTP status and the API error.code:

import { RapidCrawl, RapidCrawlError } from '@rapidcrawl/sdk';

try {
  await client.scrape.create({ url: 'https://example.com' });
} catch (err) {
  if (err instanceof RapidCrawlError) {
    console.error(`${err.status} ${err.code}: ${err.message}`);
  } else {
    throw err;
  }
}

Async scrapes

Pass async: true to enqueue the job and poll by ID:

const queued = await client.scrape.create({ url: 'https://example.com', async: true });
// later — poll with the returned sc_… id
const final = await client.scrape.get('sc_...');

What's available

The client exposes one resource per capability: scrape, screenshots, recordings, bulk, fetch, monitors, sitemap, and account (each with create / get / list methods as applicable, plus nested resources like scrape.bulk and monitors.captures).

See the TypeScript SDK Reference for every method and option.

Next steps