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

> ## Agent Instructions
> Authenticate REST, SDK, and CLI requests with the `x-api-key` header using the `HYPERBROWSER_API_KEY` environment variable (create keys at https://app.hyperbrowser.ai).
> Always stop browser sessions (`sessions.stop(id)` / `PUT /api/session/{id}/stop`) and sandboxes (`sandboxes.stop(id)` / `PUT /api/sandbox/{id}/stop`) in `try`/`finally` blocks to avoid idle billing.
> Choose the right surface: use Web API (`/api/web/fetch`, `batch-fetch`, `crawl`, `search`) for stateless reading and extraction (prefer it over legacy `/api/scrape`); Browser Sessions (`/api/session`) for interactive, authenticated, or Playwright/Puppeteer workflows; Cloud Agents (`/api/task/*`) for autonomous browser tasks; and Sandboxes (`/api/sandbox`) for isolated Linux or macOS code execution.
> Use `@hyperbrowser/sdk` for Node.js/TypeScript, `hyperbrowser` 1.0+ typed-dict request params for Python (avoid legacy Pydantic request classes), the unified `hx` CLI for terminal workflows, and hosted OAuth MCP at `https://mcp.hyperbrowser.ai/mcp/web` (web tools; use `https://mcp.hyperbrowser.ai/mcp` only when browser, sandbox, admin, and usage tools are needed).

# Runtime Updates & Bulk Control

> Update profile persistence, proxy routing, screen resolution, CAPTCHA solving, and timeout on running sessions

You do not have to stop and recreate a browser session to adjust common runtime settings. Hyperbrowser lets you update profile persistence, proxy routing, viewport dimensions, CAPTCHA solving, and session duration on a live session.

***

## Update a Running Session (`PUT /api/session/{id}/update`)

All live configuration updates share `PUT /api/session/{id}/update` (requires `browser.sessions.update`) and accept a discriminated `{ type, params }` payload.

| Update `type` | Node SDK | Python SDK | What changes |
| - | - | - | - |
| `"profile"` | `sessions.updateProfileParams(id, params)` | `sessions.update_profile_params(id, params)` | Toggle `persistChanges` and `persistNetworkCache` for the attached profile before session close. |
| `"proxy"` | `sessions.updateProxyParams(id, params)` | `sessions.update_proxy_params(id, params)` | Enable or disable proxying, switch `staticIpId`, or change proxy `location` (`country`, `state`, `city`). |
| `"screen"` | `sessions.updateScreenSize(id, params)` | `sessions.update_screen_size(id, params)` | Resize the virtual display (`width`: 500–3840, `height`: 360–2160). |
| `"solveCaptchas"` | `sessions.startCaptchaSolving(id, params)` / `sessions.stopCaptchaSolving(id)` | `sessions.start_captcha_solving(id, params)` / `sessions.stop_captcha_solving(id)` | Turn automatic CAPTCHA solving on or off at runtime (with optional `solverType`). |

### Update Profile Persistence

Decide mid-session whether cookies, storage, and network cache should be saved back to the attached profile when the session stops:

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { Hyperbrowser } from "@hyperbrowser/sdk";

const client = new Hyperbrowser({
  apiKey: process.env.HYPERBROWSER_API_KEY,
});

await client.sessions.updateProfileParams(session.id, {
  persistChanges: true,
  persistNetworkCache: false,
});
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import os
from hyperbrowser import Hyperbrowser

client = Hyperbrowser(api_key=os.environ["HYPERBROWSER_API_KEY"])

client.sessions.update_profile_params(
    session.id,
    {"persist_changes": True, "persist_network_cache": False},
)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X PUT "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/update" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "profile",
    "params": {
      "persistChanges": true,
      "persistNetworkCache": false
    }
  }'
```

### Update Proxy Routing or Static IP

Switch proxy location, bind a static IP, or disable proxying on a running session. When `enabled` is `false`, omit `staticIpId` and `location`.

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// Switch to a US California residential proxy
await client.sessions.updateProxyParams(session.id, {
  enabled: true,
  location: { country: "US", state: "CA" },
});

// Or disable proxy routing
await client.sessions.updateProxyParams(session.id, {
  enabled: false,
});
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Switch to a US California proxy
client.sessions.update_proxy_params(
    session.id,
    {"enabled": True, "location": {"country": "US", "state": "CA"}},
)

# Or disable proxy routing
client.sessions.update_proxy_params(session.id, {"enabled": False})
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X PUT "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/update" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "proxy",
    "params": {
      "enabled": true,
      "location": { "country": "US", "state": "CA" }
    }
  }'
```

### Resize the Viewport (`screen`)

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
await client.sessions.updateScreenSize(session.id, {
  width: 1920,
  height: 1080,
});
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
client.sessions.update_screen_size(
    session.id,
    {"width": 1920, "height": 1080},
)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X PUT "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/update" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "screen",
    "params": { "width": 1920, "height": 1080 }
  }'
```

### Start or Stop Automatic CAPTCHA Solving

Enable automatic solving only around login or checkout pages, then disable it for the rest of the workflow:

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// Turn on automatic CAPTCHA solving (optionally specify solverType)
const started = await client.sessions.startCaptchaSolving(session.id, {
  solverType: "visual",
});

// Later, turn it off
await client.sessions.stopCaptchaSolving(session.id);
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Turn on automatic CAPTCHA solving
started = client.sessions.start_captcha_solving(
    session.id,
    {"solver_type": "visual"},
)

# Later, turn it off
client.sessions.stop_captcha_solving(session.id)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X PUT "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/update" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "solveCaptchas",
    "params": { "enabled": true, "solverType": "visual" }
  }'
```

***

## Extend a Running Session (`PUT /api/session/{id}/extend-session`)

Add additional minutes to a running session's lifetime before its `timeoutMinutes` expires (requires `browser.sessions.update`).

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
await client.sessions.extendSession(session.id, 15);
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
client.sessions.extend_session(session.id, duration_minutes=15)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X PUT "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/extend-session" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "durationMinutes": 15 }'
```


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