Documentation
Everything you need to get started with the Anti-Detect Browser SDK.
Quick Start
Install the SDK from npm:
npm install anti-detect-browser Basic usage -- launch a browser with a unique fingerprint:
import { AntiDetectBrowser } from 'anti-detect-browser'
// Create an instance with your API key
const ab = new AntiDetectBrowser({
key: 'your-api-key',
})
// Launch returns a standard Playwright Browser + Page
const { browser, page } = await ab.launch({
fingerprint: { tags: ['Windows 10', 'Chrome'] },
profile: 'my-account',
label: 'user@example.com',
})
// Standard Playwright API from here
await page.goto('https://example.com')
await browser.close()
The key design principle: configure your fingerprint with our custom API, then get a standard Playwright Browser and Page instance. Zero learning curve if you already know Playwright.
API Reference
new AntiDetectBrowser(options)
Creates a new Anti-Detect Browser instance.
ab.launch(options): Promise<LaunchResult>
Launches a Chromium browser with the specified fingerprint. Returns a standard Playwright Browser and Page instance.
FingerprintFilter options:
LaunchResult return value:
applyFingerprint(context, options): Promise<void>
Injects a fingerprint into an existing Playwright BrowserContext. Use this when you want to manage the browser lifecycle yourself.
import { chromium } from 'playwright'
import { applyFingerprint } from 'anti-detect-browser'
const browser = await chromium.launch({ headless: false })
const context = await browser.newContext()
// Inject fingerprint without taking over browser lifecycle
await applyFingerprint(context, {
key: 'your-api-key',
fingerprint: { tags: ['Windows 10', 'Chrome'] },
profile: 'reddit-account-01',
})
const page = await context.newPage()
await page.goto('https://example.com') Profile Management
Profiles provide persistent browser sessions. When you specify a profile name in launch(), the SDK creates a dedicated Chromium user data directory that persists between sessions.
What is persisted
Cookies, localStorage, sessionStorage, IndexedDB, service workers, cached resources, autofill data, and browser extensions.
Fingerprint binding
The fingerprint is cached per profile. Launching the same profile again reuses the cached fingerprint without counting against your quota.
Visual identity
Each profile displays a floating label with the account name, sets the window title prefix, and loads a custom Chrome theme extension with the specified color.
// Launch with profile and visual identity
const { browser, page } = await ab.launch({
profile: 'reddit-account-01', // persistent data dir
label: 'billr@outlook.com', // floating label + title
color: '#e74c3c', // theme color
fingerprint: { tags: ['Windows 10', 'Chrome'] },
})
// Second launch reuses cached fingerprint (no API call)
const { browser: b2 } = await ab.launch({
profile: 'reddit-account-01',
}) Live View
Live View lets you watch your running browser instances in real time from the dashboard. This is especially useful when running headless browsers for AI agents — you can see exactly what the browser is doing without being on the same machine.
Enabling Live View
Add liveView: true to your launch options:
const { page } = await ab.launch({
profile: 'my-agent',
headless: true,
liveView: true,
})
// The browser screen is now streaming to your dashboard
await page.goto('https://example.com') Live View Options
Pass an options object instead of true to customize the stream:
const { page } = await ab.launch({
profile: 'my-agent',
liveView: {
quality: 80, // JPEG quality 1-100 (default: 60)
maxWidth: 1920, // Max frame width (default: 1280)
maxHeight: 1080, // Max frame height (default: 720)
everyNthFrame: 1, // Capture every frame (default: 2)
},
}) How It Works
The SDK starts a CDP screencast session that captures the browser viewport as JPEG frames.
Frames are streamed over WebSocket to a Cloudflare Durable Object relay that handles fan-out to viewers.
Open your dashboard to see active sessions and click "Live View" to watch any session in real time.
MCP Server
In MCP server mode, use the start_live_view and stop_live_view tools to control streaming for any session.
MCP Server Mode
The SDK can run as an MCP (Model Context Protocol) server, allowing AI agents to control browser instances through standardized tool calls. Configure it in your MCP client settings:
{
"mcpServers": {
"anti-detect-browser": {
"command": "npx",
"args": ["anti-detect-browser", "--mcp"],
"env": {
"ANTI_DETECT_BROWSER_KEY": "your-api-key"
}
}
}
} Available MCP Tools:
Server API
The SaaS server exposes REST APIs for fingerprint retrieval and account management. The SDK handles these calls automatically, but you can also call them directly.
Profile Endpoints (API Key Auth)
/api/v1/profiles Create a new profile. The server assigns a random fingerprint. Requires API key in Authorization: Bearer <key> header.
Body: name (required), tags (optional string array for fingerprint filtering)
/api/v1/profiles List all profiles for the authenticated user. Returns name, tags, UA, browser version, and creation date.
/api/v1/profiles/:name Get a profile with its full fingerprint data. This is the endpoint the client SDK calls for fingerprint injection.
/api/v1/profiles/:name Delete a profile. Frees up a profile slot for your plan.
Account Endpoints (JWT Auth)
/api/account Returns account info: email, name, plan, profile count, profile limit, and API keys.
/api/profile/usage Returns profile usage stats: plan, profile limit, profile count, remaining slots, and API keys.
Auth Endpoints
/api/auth/email/send Send a verification code to the specified email address.
/api/auth/email/verify Verify the email code and receive a JWT token.
Configuration
The SDK can be configured programmatically or via environment variables.
Environment Variables
Supported Fingerprint Tags
Use these tags in the fingerprint.tags array to filter fingerprints: