> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Anchor Browser is cloud browser infrastructure for AI agents and automation: browser sessions you control over CDP or REST, natural-language web tasks, versioned automation tasks, managed authentication into third-party web apps (identities with MFA), persistent volumes and profiles, recordings, live view, batch sessions, webhooks, and network options including residential proxies, extra stealth, and captcha solving for sites that block standard browsers. AI agents should start at https://docs.anchorbrowser.io/for-agents, then create an API key at https://app.anchorbrowser.io/api-keys. Read the for-agents page before authentication or API calls.

# Extra Stealth Mode

> Advanced anti-detection and browser fingerprinting protection for automated browsing

Anchor Browser provides built-in stealth capabilities that help avoid detection by anti-bot systems and website fingerprinting. These features enable automated browsing that mimics human behavior and bypasses common detection mechanisms.

Extra Stealth mode is available on the [Growth plan](https://app.anchorbrowser.io/billing).

## What is Extra Stealth Mode?

Extra Stealth Mode leverages a specialized Chrome browser environment that provides:

* 🔒 **Advanced Anti-Detection** - Bypass sophisticated bot detection systems and CAPTCHAs
* 🛡️ **Automation Consistency** - Maintain consistent access without getting blocked
* 👤 **Human-Like Behavior** - Mimic real user patterns to avoid suspicion

> [!NOTE]
>
> Alternative Cloudflare-verified access to webpages is available through our [Cloudflare Web Bot Auth Integration](https://docs.anchorbrowser.io/advanced/cloudflare-web-bot-auth.md).

## Quick start - Enable stealth features

**1. Create a session with extra stealth enabled**

Create a browser session with extra stealth features enabled using the SDK:

> [!WARNING]
>
> Extra stealth mode requires proxy configuration to be active. **If proxy is disabled, extra stealth will be automatically disabled** by the system.
>
> Read more about [Proxy Configuration](https://docs.anchorbrowser.io/advanced/proxy.md)

```JavaScript node.js theme={null}
import { client, Sessions } from "anchorbrowser";

client.setConfig({ auth: () => process.env.ANCHOR_API_KEY })
const session = await Sessions.createSession({
    body: {
        browser: {
            extra_stealth: {
                active: true
            }
        },
        session: {
            proxy: {
                active: true
            }
        }
    }
});

console.log(session);
```

```python python theme={null}
from anchorbrowser import Anchorbrowser
import os

anchorClient = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))
session = anchorClient.sessions.create_session(
    browser={
        "extra_stealth": {
            "active": True
        }
    },
    session={
        "proxy": {
            "active": True
        }
    }
)
print(session)
```

**2. Use the session for automated browsing**

Once your stealth session is created, you can use it for automated browsing that bypasses common detection mechanisms:

```JavaScript node.js theme={null}
import { client, Sessions, agentTask } from "anchorbrowser";

client.setConfig({ auth: () => process.env.ANCHOR_API_KEY })
 
// Create stealth session
const session = await Sessions.createSession({
    body: {
        browser: {
            extra_stealth: {
                active: true
            }
        },
        session: {
            proxy: {
                active: true
            }
        }
    }
 })

// Use the session for automated tasks
const result = await agentTask(
    "Navigate to a website and check if I'm detected as a bot",
    {
        sessionId: session.data.id
    }
);

console.log(result);
```

```python python theme={null}
from anchorbrowser import Anchorbrowser
import os

anchorClient = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

# Create stealth session
session = anchorClient.sessions.create_session(
    browser={
        "extra_stealth": {
            "active": True
        }
    },
    session={
        "proxy": {
            "active": True
        }
    }
)

# Use the session for automated tasks
result = anchorClient.agent.task(
    session_options=session,
    prompt="Navigate to a website and check if I'm detected as a bot"
)

print(result)
```

## Using stealth with tasks

Save stealth settings on the task via `task_default_browser_configuration` — a **one-time setup**. Include `browser.extra_stealth` and an active `session.proxy` (required):

```bash theme={null}
curl -X PATCH "https://api.anchorbrowser.io/v1/tools/{toolId}" \
  -H "anchor-api-key: $ANCHOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task_default_browser_configuration": {
      "browser": { "extra_stealth": { "active": true } },
      "session": { "proxy": { "active": true } }
    }
  }'
```

> [!NOTE]
>
> If you pass a `session_id` to `/run`, that session's config is used instead. See [Run a Task](https://docs.anchorbrowser.io/tasks/run-a-task.md#task-config-vs-session-config).

## Usage with Profiles

Use stealth mode with saved browser profiles for persistent authenticated sessions:

```JavaScript node.js theme={null}
import { client, Sessions } from "anchorbrowser";

client.setConfig({ auth: () => process.env.ANCHOR_API_KEY })
const session = await Sessions.createSession({
    body: {
        browser: {
            extra_stealth: {
                active: true
            },
            profile: {
                name: 'stealth-profile',
                persist: true   // Only on Profile Creation
            }
        },
        session: {
            proxy: {
                active: true
            }
        }
    }
})
console.log(session)

```

```python python theme={null}
from anchorbrowser import Anchorbrowser
import os

anchorClient = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))
session = anchorClient.sessions.create_session(
    browser={
        "extra_stealth": {
            "active": True
        },
        "profile": {
            "name": "stealth-profile",
            "persist": true   # Only on Profile Creation
        }
    },
    session={
        "proxy": {
            "active": True
        }
    }
)
print(session)
```

## Enabling Console Logs

> [!WARNING]
>
> When extra stealth mode is enabled, `page.on('console')` events are **disabled by default** to prevent detection. If you need to capture console output, you must explicitly enable it.

To receive console log events while using extra stealth, enable `console_logs` in your session configuration:

```javascript node.js theme={null}
import { client, Sessions, connectBrowser } from "anchorbrowser";

client.setConfig({ auth: () => process.env.ANCHOR_API_KEY });

const session = await Sessions.createSession({
  body: {
    browser: {
      extra_stealth: { active: true },
      console_logs: { active: true }
    },
    session: {
      proxy: { active: true }
    }
  }
});

// Connect to the browser
const browser = await connectBrowser(session.data.id);
const context = browser.contexts()[0];
const page = context.pages()[0];

// Now page.on('console') will work
page.on('console', (msg) => {
  console.log(`[${msg.type()}] ${msg.text()}`);
});

await page.goto("https://example.com");
```

```python python theme={null}
from anchorbrowser import Anchorbrowser
import os

anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

session = anchor_client.sessions.create_session(
    browser={
        "extra_stealth": {"active": True},
        "console_logs": {"active": True}
    },
    session={
        "proxy": {"active": True}
    }
)

# Connect to the browser
with anchor_client.browser.connect(session.data.id) as browser:
    context = browser.contexts[0]
    page = context.pages[0]

    # Now page.on('console') will work
    def handle_console(msg):
        print(f"[{msg.type}] {msg.text}")

    page.on("console", handle_console)

    page.goto("https://example.com")
```

## Catching Captcha Events

When using stealth mode with captcha solving enabled, you can listen to captcha lifecycle events via CDP (Chrome DevTools Protocol). This allows you to track when captchas are detected, solved, or failed.

```javascript node.js theme={null}
import { client as anchorClient, Sessions, connectBrowser } from "anchorbrowser";

anchorClient.setConfig({ auth: () => process.env.ANCHOR_API_KEY });

// Create a session with extra stealth and captcha solving enabled
const session = await Sessions.createSession({
  body: {
    browser: {
      extra_stealth: { active: true },
      captcha_solver: { active: true }
    },
    session: {
      proxy: { active: true }
    }
  }
});

// Connect to the browser
const browser = await connectBrowser(session.data.id);
const context = browser.contexts()[0];
const page = context.pages()[0];

// Create CDP session and listen to captcha events
const client = await context.newCDPSession(page);

client.on('Captcha.lifecycle', (event) => {
  if (event.name === 'detected') {
    console.log(`${event.captchaType} captcha detected on ${event.url}`);
    if (event.captchaType === 'recaptcha') {
      // 'invisible' (badge, may auto-pass) or 'checkbox'
      console.log(`reCAPTCHA variant: ${event.variant}`);
    }
  }

  if (event.name === 'solved') {
    console.log(`Captcha solved in ${event.timeToSolve}ms`);
    if (event.captchaType === 'recaptcha') {
      console.log(event.puzzle ? 'An image puzzle was solved' : 'Passed without a puzzle');
    }
  }

  if (event.name === 'failed') {
    console.log(`Captcha failed: ${event.error}`);
  }
});

// Navigate to a page with captcha
await page.goto("https://example.com");
```

```python python theme={null}
from anchorbrowser import Anchorbrowser
import os

anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

# Create a session with extra stealth and captcha solving enabled
session = anchor_client.sessions.create_session(
    browser={
        "extra_stealth": {"active": True},
        "captcha_solver": {"active": True}
    },
    session={
        "proxy": {"active": True}
    }
)

# Connect to the browser
with anchor_client.browser.connect(session.data.id) as browser:
    context = browser.contexts[0]
    page = context.pages[0]

    # Create CDP session and listen to captcha events
    client = context.new_cdp_session(page)

    def handle_captcha_event(event):
        if event["name"] == "detected":
            print(f"{event['captchaType']} captcha detected on {event['url']}")
            if event["captchaType"] == "recaptcha":
                # 'invisible' (badge, may auto-pass) or 'checkbox'
                print(f"reCAPTCHA variant: {event['variant']}")

        if event["name"] == "solved":
            print(f"Captcha solved in {event['timeToSolve']}ms")
            if event["captchaType"] == "recaptcha":
                print("An image puzzle was solved" if event["puzzle"] else "Passed without a puzzle")

        if event["name"] == "failed":
            print(f"Captcha failed: {event['error']}")

    client.on("Captcha.lifecycle", handle_captcha_event)

    # Navigate to a page with captcha
    page.goto("https://example.com")
```

### Event Types

Every event carries `captchaType`, `url`, `pageId` and `timestamp`. `captchaType` is one of `cloudflare`, `recaptcha`, `funcaptcha`, `datadome`, `kasada`, `akamai`, `hcaptcha`, `altcha` or `perimeterx` (the HUMAN "Press & Hold" challenge, solved automatically; a `failed` event carries the reason).

| Event Name | Description | Additional Properties |
| - | - | - |
| `detected` | Fired when a captcha is detected on the page | `variant` (reCAPTCHA and PerimeterX) |
| `solved` | Fired when the captcha is successfully solved | `timeToSolve` (in milliseconds), `variant` (reCAPTCHA and PerimeterX), `puzzle` (reCAPTCHA only) |
| `failed` | Fired when captcha solving fails | `error`, `variant` (reCAPTCHA and PerimeterX), `puzzle` (reCAPTCHA only) |

### reCAPTCHA Properties

reCAPTCHA events (`captchaType: 'recaptcha'`) carry two extra properties, so you can tell a widget that may pass silently from one that needs an image puzzle:

| Property | Values | Description |
| - | - | - |
| `variant` | `'invisible'`, `'checkbox'` | The widget kind, taken from the rendered widget's own frame (or its `data-size` markup), so it is available from `detected` onwards. Where a page's markup contradicts how it renders the widget, `solved` / `failed` reflect the rendered widget. `invisible` covers the badge and reCAPTCHA v3, which often pass with no visible challenge. `checkbox` covers the "I'm not a robot" widget (normal and compact sizes). |
| `puzzle` | `true`, `false` | On `solved` and `failed`: whether an image-selection puzzle was shown before the outcome. Both variants can escalate to a puzzle, so `variant` tells you what was rendered and `puzzle` tells you what actually happened. |

### PerimeterX Properties

PerimeterX events (`captchaType: 'perimeterx'`) carry `variant`, which tells you whether the challenge stood between you and the page at all:

| Property | Values | Description |
| - | - | - |
| `variant` | `'block_page'`, `'inline'` | `block_page` is the hosted "Access to this page has been denied" page served in place of the content (HTTP 403); solving it is what gets you the page. `inline` is a Press & Hold widget rendered on a page that already loaded (HTTP 200), typically gating an action such as a search or a login rather than the page itself. The Web Unlocker holds a fetch, and fails it with `422`, only for `block_page`; an `inline` challenge never delays or fails a fetch. |

### DataDome Properties

DataDome (`captchaType: 'datadome'`) serves a slider in place of the page. The slider widget accepts a slide before DataDome has decided whether to honour it, so the browser reports the outcome of the page that follows rather than the widget's own green state:

* `solved` fires once the page served after the accepted slide is not a DataDome block (a few seconds after the widget turns green, so the page you get afterwards is the content, not another challenge).
* A slide the widget refuses ("The position of the slider is not correct") is retried without any event: DataDome serves a fresh slider within a couple of seconds and the retry usually passes.
* `failed` fires only when the challenge is over, with the reason in `error`:

| `error` | Meaning |
| - | - |
| `blocked` | DataDome served its "Access is temporarily restricted" page instead of a slider; the exit IP is blocked for this site. |
| `blocked_after_solve` | The slide was accepted but the page served next was still a DataDome block. A 403 from the site itself, without DataDome's headers or cookie, is not counted as a block. |
| `drag_cap_reached` | Six slides within two minutes did not get through on this page; the browser stops retrying. |
| `fail` | The slide was refused and DataDome did not serve a new slider within 15 seconds. |

## Session warm-up

Some sites show a login or sign-up wall to a browser they have never seen, even with stealth on: they check whether this browser has already run their own scripts once, on the IP it is using now. Turn on `browser.warm_up` and the session loads the site's homepage once before it is handed to you, so your first navigation arrives with a jar those checks accept. On a warmed session, a direct navigation to that site also carries a search-engine referer; see **Entering the site** below. LinkedIn is the site covered today.

> [!WARNING]
>
> A warmed session needs both blockers off: `browser.adblock.active: false` and `browser.popup_blocker.active: false`. They stop the third-party analytics scripts these sites use to recognise a returning browser, so a warm-up under a blocker leaves no trace; the API rejects a `warm_up` request that leaves either one on.

```JavaScript node.js theme={null}
const session = await Sessions.createSession({
    body: {
        browser: {
            warm_up: { active: true },
            adblock: { active: false },
            popup_blocker: { active: false },
            extra_stealth: { active: true }
        },
        session: {
            proxy: { active: true }
        }
    }
});
```

```python python theme={null}
session = anchorClient.sessions.create_session(
    browser={
        "warm_up": {"active": True},
        "adblock": {"active": False},
        "popup_blocker": {"active": False},
        "extra_stealth": {"active": True}
    },
    session={
        "proxy": {"active": True}
    }
)
```

The warm-up runs before the create-session call returns and adds about ten seconds to session creation; that time counts toward the session's duration. It loads the page in the session's first tab, which is left blank afterwards.

> [!NOTE]
>
> **Entering the site.** Some sites, LinkedIn among them, show a public page to a visitor arriving from a search result and wall the same browser on a direct navigation. On a warmed session the browser handles this for you: a direct navigation to the warm-up's site carries a search referer, whether it comes from `page.goto(profileUrl)`, the agent, or a URL typed into the address bar in the live view. Landing still depends on the reputation of the exit IP the session was given, and a new session gets a new exit.

The warm-up also makes one request to `ipinfo.io` through the session's exit to record which IP the session used; it counts as session traffic like the rest of the warm-up.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.