TypeScript SDK
The TypeScript SDK provides a fully typed client for every webclaw endpoint. Zero runtime dependencies -- uses native fetch. Ships ESM + CJS via tsup.
Installation
Note
Requires Node.js 18+ (for native
fetch). Also works in Bun and Deno.Configuration
Create a client by passing a config object. Only apiKey is required.
Options
| Property | Type | Default | Description |
|---|---|---|---|
apiKey | string | -- | Your webclaw API key (starts with wc_). |
baseUrl | string | https://api.webclaw.io | Override for self-hosted instances. |
timeout | number | 30000 | Request timeout in milliseconds. |
Scrape
Crawl
Returns a CrawlJob handle that you can poll or wait on.
Tip
You can also poll manually with
job.getStatus() if you want custom retry logic.Map
Batch
Extract
LLM-powered structured extraction. Pass a JSON schema or a plain-text prompt.
Summarize
Brand
Error handling
All errors extend WebclawError. Use instanceof for specific cases.
| Class | HTTP status | Properties |
|---|---|---|
AuthenticationError | 401 | message |
NotFoundError | 404 | message |
RateLimitError | 429 | message, retryAfter |
TimeoutError | -- | message, timeout |
TypeScript types
All request and response interfaces are exported from the package root.