fetch and has zero runtime dependencies.
Keep your API key in server-side code. The SDK is not designed for use in browser bundles.
Install
adscrawl-js on GitHub
View source, runnable examples, and releases.
Authenticate and make your first request
Create an API key in the dashboard and setADSCRAWL_API_KEY in your server environment. You can also pass the key explicitly to new AdsCrawl({ apiKey: '...' }).
Rendered content and screenshots
html() returns a string for contentMode: 'html' (the default) or 'markdown', and an Article for 'json'. markdown() and article() are conveniences for those modes. screenshot() returns a Uint8Array containing a PNG.
Proxy and fingerprint
Route through a custom proxy or use managedcountryCode routing. Both cannot be combined.
browserscan.png:
Structured extraction
List available templates and their parameters:missingFields.
actions for clicks, input, scrolling, and waits, and waitFor for a visible selector or text. See the API reference for template-specific requirements.
Remote CDP browsers
Connect a Playwright browser over CDP to an AdsCrawl remote session:sessionId, expiresAt, and cdpBaseUrl. It does not contain a WebSocket URL. For Puppeteer, use discovery:
cdp.list() returns { ok, data }. cdp.liveToken(sessionId) returns a single-use live-control URL valid for 30 seconds. Treat all connection URLs as secrets and do not log them.
Persistent cloud browsers
Cloud browser profiles retain their configuration after stop. API-key starts require an explicit, top-level custom proxy on every start, even when a proxy was saved in the profile. SetADSCRAWL_PROXY_SERVER to your HTTP or SOCKS5 proxy URL with an explicit port. If authentication is needed, also set ADSCRAWL_PROXY_USERNAME and ADSCRAWL_PROXY_PASSWORD.
cloudBrowsers.launch({ proxy, tabs?, cookies?, fingerprint? }) creates a persistent profile and starts it in one request. Failed launches can return a profile id in AdsCrawlAPIError.id; inspect and stop that profile. If no id was received, inspect cloudBrowsers.list() before repeating the launch.
cloudBrowsers.list({ page?, pageSize? }) includes pagination and saved/running quotas. A stop response with runtime.status: 'stopping' means shutdown is pending and quota is still reserved. Closing the viewer does not stop billing. The SDK covers API-key endpoints; profile configuration PATCH/DELETE and viewer authentication require a dashboard session.
Configuration, deadlines, and cancellation
ADSCRAWL_API_KEY. The API origin defaults to ADSCRAWL_BASE_URL, then ADSCRAWL_API_URL, then https://api.adscrawl.net. HTTP deadlines cover both the request and reading its response. Ordinary calls default to 90 seconds; cloudBrowsers.launch() defaults to 195 seconds to allow startup and server cleanup. For long tasks, set an HTTP deadline greater than the server task timeout.
Errors
status, stable code, redacted body, traceId, and requestId when available. Network failures use AdsCrawlConnectionError; invalid or empty responses use AdsCrawlResponseError. Caller cancellation preserves the AbortSignal reason. Requests are never automatically retried.