SDK ReferenceTypeScript SDK

Client

Instantiate and configure the ByteKit TypeScript client.

Client

The ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a client with your API key, then call resource methods.

import { ByteKit } from '@hunt-labs/bytekit-sdk';

const client = new ByteKit({
  apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key
});

Options (ByteKitOptions)

  • apiKey (required) — string
  • baseUrlstring Defaults to https://api.bytekit.com.
  • timeoutMsnumber — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP round-trip made by this SDK. 0 disables the SDK-side timeout. Default 120000.

NOT the same thing as ScrapeOpts.timeout_ms, which is the SERVER-side budget the gateway applies to the scrape itself. Override per call with RequestOptions.requestTimeoutMs.

Resources

The client exposes one property per resource:

  • client.scrape — Fetch a URL as raw HTML, clean markdown, or structured content.
  • client.screenshots — Capture full-page or viewport screenshots.
  • client.bulk — Fan out many URLs in parallel with per-item webhooks.
  • client.fetch — Low-latency raw HTTP fetch with optional conversion.
  • client.monitors — Watch a URL on a schedule and webhook on change.
  • client.sitemap — Discover URLs from a domain's sitemap or by crawling.
  • client.search — Run a web search and return ranked organic results.
  • client.account — Account info and API key management.

Errors

Any non-2xx response throws a ByteKitError carrying the HTTP status and the API code.

import { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';

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