Installation
Requires Node.js 20 LTS+ (also supports Deno v1.28+, Bun 1.0+, and
Cloudflare Workers). Never hardcode your API key — use environment variables.
Setup
Initialize the client with your API key:TypeScript
Quick Start
Extract content from a URL in one call:TypeScript
TypeScript Types
The SDK ships full TypeScript definitions for all request parameters and responses, with IDE autocompletion:TypeScript
Core Methods
Extract
Get clean HTML, markdown, or structured data from any URL. Supports JavaScript rendering, stealth mode, browser actions, and more.TypeScript
Search
Perform real-time web searches and get structured results:TypeScript
Map
Discover all URLs within a domain or sitemap:TypeScript
Crawl
Recursively crawl and extract an entire website at scale:TypeScript
Agents
Run pre-built agents for structured data from popular platforms:TypeScript
Error Handling
The SDK throws typedAPIError subclasses for failed requests:
TypeScript
| Error Class | HTTP Status | When it occurs |
|---|---|---|
BadRequestError | 400 | Invalid request parameters |
AuthenticationError | 401 | Invalid or missing API key |
PermissionDeniedError | 403 | Insufficient account permissions |
NotFoundError | 404 | Resource not found |
RateLimitError | 429 | Request rate exceeded |
InternalServerError | 500+ | Server-side error |
Configuration
Timeouts & Retries
The SDK retries automatically on connection errors and server failures. Defaults: 2 retries, 3-minute timeout.TypeScript
Logging
Control log verbosity via environment variable:TypeScript
Advanced
Raw Response Access
Access HTTP headers and status alongside the parsed response:TypeScript
Custom Fetch / Proxy
Provide a custom fetch implementation or configure proxies for Node.js, Bun, and Deno:TypeScript
MCP Server
The SDK includes a built-in MCP Server for AI assistant integrations, enabling API exploration and request testing directly from tools like Claude.Next Steps
API Reference
Full REST API documentation for all endpoints
Extract
Rendering, formats, stealth mode, and more
Search
Real-time web search with structured results
Agents
Pre-built extraction agents for popular platforms