> ## Content Index
> Fetch the complete content index at: https://roundproxies.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to set up proxies and automate BitBrowser with its API
- URL: https://roundproxies.com/blog/bitbrowser-proxy-automation/
- Published: 2026-11-28T14:17:16.000Z
- Updated: 2026-11-28T14:17:16.000Z
- Description: Set up proxies in BitBrowser and automate profiles via its Local API. Python and Node.js code included.
- Author: Marius Bernard
- Tags: Web Scraping, Browser Automations, Browser Scraping, #dated-6b0ae12b2dcd0f00014ba016

Clicking ten BitBrowser profiles together by hand is fine. At fifty it eats your afternoon.

And it stops working the day a script has to open, use, and close those profiles without you.

This guide shows how to set up proxies and automate BitBrowser from both ends.

You'll fill in the proxy fields in the app, then do the same work through the Local API, including the auth token newer builds ask for.

By the end you'll have Playwright, Puppeteer, and Selenium each driving a real profile with its own proxy.

## How do you set up proxies and automate BitBrowser?

To set up proxies and automate [BitBrowser](https://www.bitbrowser.net/?code=4r1bma), add a custom proxy to each browser profile, then drive the profiles through the Local API on `127.0.0.1:54345`. Check the proxy with `/checkagent`, create the profile with `/browser/update`, open it with `/browser/open`, attach your automation library to the address it returns, and close it with `/browser/close`.

The app and the API write to the same profile list. A profile you build by hand opens fine from a script, and the reverse.

![One Bitbrowser run five steps](https://roundproxies.com/blog/content/images/2026/11/one-bitbrowser.webp)

## Prerequisites

You need the BitBrowser desktop app running, one language runtime, and proxy credentials.

- **BitBrowser**, installed and signed in. The Local API only exists while the app is open.
- **Python 3.9+** with `pip install requests playwright selenium`. Skip `playwright install`: you attach to BitBrowser's own Chromium, not a downloaded one.
- **Node.js 18+** with `npm install puppeteer-core`, only for the Puppeteer section.
- **Proxy details:** host, port, username, password, and protocol. If you're unsure which protocol to ask for, [HTTP vs HTTPS vs SOCKS5 proxies](https://roundproxies.com/blog/http-vs-https-vs-socks5-proxies/) covers the differences.

## Step 1: Set up a proxy in a BitBrowser profile

Open **Browser Profiles**, click **Add**, scroll to the proxy section, pick the **Custom** method, and fill in protocol, host, port, username, and password as separate fields.

The full sequence in the app:

1. **Browser Profiles → Add.** Editing an existing profile works too, but close its window first so the next launch picks up the new proxy.
2. **Proxy method: Custom.** The other methods pull an IP from an extraction URL or reuse a proxy saved in Proxy Management.
3. **Proxy type:** HTTP, HTTPS, SOCKS5, or SSH.
4. **Host and port**, with no `http://` prefix on the host. Username and password go in their own boxes, never pasted as one `user:pass@host` string.
5. **Check Proxy.** Pick an IP lookup channel, run the check, then click **Confirm**.
6. **Open** the profile and load an IP checker to confirm the exit IP.

### Which proxy type should you pick in BitBrowser?

Pick the protocol your provider's gateway speaks; for most residential and ISP proxies that's HTTP or SOCKS5.

| Type   | Use it when                                                     | Watch for                                                          |
| ------ | --------------------------------------------------------------- | ------------------------------------------------------------------ |
| HTTP   | Your provider gives a standard gateway with user:pass auth      | The most common choice; start here                                 |
| HTTPS  | The provider hands you an HTTPS proxy endpoint specifically     | Rarely needed, since site traffic is already TLS inside the tunnel |
| SOCKS5 | The provider offers it and you want protocol-agnostic tunneling | Check the port: SOCKS5 often listens on a different one than HTTP  |
| SSH    | You're tunneling through a server you control                   | One server means one IP, so it doesn't scale to many profiles      |

After **Check Proxy**, read the country and timezone it reports. A US exit IP on a profile whose clock says Berlin is an easy flag for any fingerprinting script.

Then open a leak test inside the profile. A [WebRTC leak](https://roundproxies.com/blog/webrtc-leaks/) can expose your real IP even when the proxy check passed.

### Add many proxies at once with Proxy Management

For more than a handful of proxies, save them once under **Proxy IP → Proxy Management**, then assign them to profiles from that list.

The **Add** drop-down there has **Batch Add**, which takes one proxy per line. You can also import a spreadsheet and run the check on the whole list before any profile touches it.

Saved proxies show up as a choice in each profile's proxy method. That keeps credentials in one place when a provider rotates passwords.

## Step 2: Turn on the BitBrowser Local API and copy the token

The Local API is a small HTTP server inside the running BitBrowser app. Find it under **Settings → Browser Settings → Local API**, where the default address is `http://127.0.0.1:54345`.

Three details trip people up here:

- **The token.** BitBrowser 7.1.5 and later has **Enable Authentication Control**. Turn it on and the app generates an API Token, and every request must then carry it in an `x-api-key` header.
- **Sub-accounts.** A team member's account needs Local API permission from the main account, or calls fail with `success: false`.
- **Format.** Every endpoint takes a POST with a JSON body. Responses carry `success`, plus `data` on success or `msg` on failure.

Every script below goes through one small helper. It adds the token when you've set one and turns a `success: false` into a Python exception you can't miss.

```python
# bitbrowser.py
import os
import requests

API_BASE = os.getenv("BIT_API", "http://127.0.0.1:54345")
API_KEY = os.getenv("BIT_API_KEY")  # only needed with Authentication Control on

session = requests.Session()
if API_KEY:
    session.headers["x-api-key"] = API_KEY

def bit(path, payload=None):
    """POST to the Local API and return `data`, or raise with BitBrowser's msg."""
    resp = session.post(f"{API_BASE}{path}", json=payload or {}, timeout=60)
    resp.raise_for_status()
    body = resp.json()
    if not body.get("success"):
        raise RuntimeError(f"{path} failed: {body.get('msg')}")
    return body.get("data")

```

Keep the token in an environment variable, not in the script. It gives full control over every profile on the machine, so treat it like a password.

## Step 3: Check the proxy through the API first

`/checkagent` tests a proxy without creating anything and reports the exit IP, country, and timezone. Running it first means a dead or mislocated proxy never reaches a profile.

```python
from bitbrowser import bit

proxy = {
    "proxyType": "http",                # noproxy, http, socks5 or ssh
    "host": "gate.your-provider.com",   # no http:// prefix
    "port": "8000",                     # /checkagent wants a string here
    "proxyUserName": "user-country-us",
    "proxyPassword": "secret",
    "checkExists": 1,                   # flag IPs another profile already uses
}

info = bit("/checkagent", proxy)
geo = info.get("data", info)  # the result can sit one level deeper; handle both
print(geo["ip"], geo["countryCode"], geo["timeZone"], "used:", geo.get("used"))

```

`checkExists` is worth leaving on. Two accounts behind the same IP is the classic way profiles get linked, and this flag catches it before you build the second profile.

## Step 4: Create a BitBrowser profile with its proxy from code

`/browser/update` without an `id` creates a new profile, and the proxy fields sit at the top level of the payload next to `name`.

```python
from bitbrowser import bit

def create_profile(name, proxy):
    payload = {
        "name": name,
        "remark": "created by script",
        "proxyMethod": 2,                 # 2 = custom proxy, 3 = extract IP from a URL
        "proxyType": proxy["proxyType"],  # http, https, socks5, ssh or noproxy
        "host": proxy["host"],
        "port": int(proxy["port"]),       # an integer here, unlike /checkagent
        "proxyUserName": proxy["proxyUserName"],
        "proxyPassword": proxy["proxyPassword"],
        "browserFingerPrint": {},         # empty: let BitBrowser generate one
    }
    return bit("/browser/update", payload)["id"]

```

The reference marks more fields as required than this, but BitBrowser's own examples send only these. To pin the fingerprint, put `coreVersion` and `ostype` inside `browserFingerPrint`.

To change an existing profile later, call `/browser/update/partial` with `ids` and only the fields you want changed. Anything you leave out stays as it was.

## Step 5: Open the profile and attach Playwright, Puppeteer, or Selenium

`/browser/open` launches the profile and returns three addresses: `ws`, a CDP WebSocket URL for Playwright and Puppeteer; `http`, a debugger address for Selenium; and `driver`, the path to a matching chromedriver.

The proxy is already baked into the profile. Don't set it again in your automation library, or you'll have two layers fighting over the connection.

### Playwright (Python)

Playwright attaches with `connect_over_cdp` and should reuse the profile's existing context, which holds its cookies and storage.

```python
from playwright.sync_api import sync_playwright
from bitbrowser import bit

PROFILE_ID = "your-profile-id"

opened = bit("/browser/open", {"id": PROFILE_ID})
try:
    with sync_playwright() as p:
        browser = p.chromium.connect_over_cdp(opened["ws"])
        context = browser.contexts[0]  # the profile's own context, cookies included
        page = context.pages[0] if context.pages else context.new_page()
        page.goto("https://httpbin.org/ip")
        print(page.inner_text("body"))  # should print the proxy's exit IP
finally:
    bit("/browser/close", {"id": PROFILE_ID})  # saves the session, frees the window

```

Calling `browser.new_context()` here gives you a blank context without the profile's cookies, which defeats the point of a profile.

For more on how Playwright handles proxies when it launches its own browser, see [Playwright proxy setup](https://roundproxies.com/blog/playwright-proxy/).

### Puppeteer (Node.js)

Puppeteer uses the same `ws` URL through `puppeteer-core`, which skips the bundled Chromium download. The helper mirrors the Python one.

```javascript
// bit-puppeteer.mjs: npm install puppeteer-core (Node 18+ for built-in fetch)
import puppeteer from "puppeteer-core";

const API = process.env.BIT_API ?? "http://127.0.0.1:54345";
const headers = { "Content-Type": "application/json" };
if (process.env.BIT_API_KEY) headers["x-api-key"] = process.env.BIT_API_KEY;

async function bit(path, body = {}) {
  const res = await fetch(API + path, { method: "POST", headers, body: JSON.stringify(body) });
  const json = await res.json();
  if (!json.success) throw new Error(`${path} failed: ${json.msg}`);
  return json.data;
}

```

Then open the profile, connect, and always close it, even when the page throws.

```javascript
const id = process.argv[2]; // node bit-puppeteer.mjs <profile-id>
const { ws } = await bit("/browser/open", { id });
try {
  const browser = await puppeteer.connect({ browserWSEndpoint: ws, defaultViewport: null });
  const page = (await browser.pages())[0] ?? (await browser.newPage());
  await page.goto("https://httpbin.org/ip");
  console.log(await page.evaluate(() => document.body.innerText));
  await browser.disconnect(); // detach; BitBrowser owns the window
} finally {
  await bit("/browser/close", { id });
}

```

`defaultViewport: null` keeps the window size the profile's fingerprint expects. Puppeteer's default 800×600 viewport is a small but real mismatch.

### Selenium (Python)

Selenium attaches through the `http` debugger address and must use the chromedriver BitBrowser hands back in `driver`.

```python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from bitbrowser import bit

PROFILE_ID = "your-profile-id"
opened = bit("/browser/open", {"id": PROFILE_ID})

options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", opened["http"])  # 127.0.0.1:<port>
service = Service(executable_path=opened["driver"])  # matches the profile's core
driver = webdriver.Chrome(service=service, options=options)
try:
    driver.get("https://httpbin.org/ip")
    print(driver.find_element("tag name", "body").text)
finally:
    driver.quit()
    bit("/browser/close", {"id": PROFILE_ID})

```

A system chromedriver usually fails with a version mismatch, because BitBrowser's Chromium core rarely matches whatever Chrome you have installed. The `driver` path avoids that.

## Step 6: Swap proxies across many profiles

`/browser/proxy/update` replaces the proxy on a list of profile IDs in one call. That's how you rotate IPs or move a whole fleet to a new provider without opening a single profile.

```python
from bitbrowser import bit

def swap_proxy(profile_id, host, port, user, password, proxy_type="http"):
    return bit("/browser/proxy/update", {
        "ids": [profile_id],
        "ipCheckService": "ip-api",
        "proxyMethod": 2,
        "proxyType": proxy_type,
        "host": host,
        "port": int(port),
        "proxyUserName": user,
        "proxyPassword": password,
    })

```

The next block pairs each profile with one line from a `host:port:user:pass` file, so no two profiles end up on the same IP.

```python
with open("proxies.txt") as f:
    pairs = [line.strip().split(":") for line in f if line.strip()]

profiles = bit("/browser/list", {"page": 0, "pageSize": 100})["list"]  # max 100 per page

for profile, (host, port, user, pwd) in zip(profiles, pairs):
    swap_proxy(profile["id"], host, port, user, pwd)
    print(f"{profile['name']} -> {host}:{port}")

```

`zip` stops at the shorter list, so extra profiles keep their old proxy instead of silently doubling up.

When you open many profiles in a loop, pass `"queue": True` to `/browser/open` so launches line up instead of colliding.

Rotating gateways and mobile proxies don't need any of this. Put the session ID in the username, or use the profile's refresh URL field if your provider gives you one.

## Can you automate BitBrowser without code?

Yes. BitBrowser has a built-in RPA module that runs block-based workflows inside profiles, with variables and custom JavaScript blocks for the parts the blocks can't do.

Its RPA docs point to Automa's tutorials, so if you've built Automa workflows, the editor will feel familiar. Inside a JavaScript block, `automaRefData('variables', 'browserId')` returns the current profile's ID.

RPA fits fixed click paths you repeat across profiles: log in, check a page, post something. Pick code once you need branching on scraped data, retries, or results written to a database.

## What BitBrowser won't fix for you

BitBrowser isolates fingerprints and routes each profile through its proxy. It doesn't make a bad proxy good or a careless script careful.

- **IP reputation.** A datacenter IP that's already flagged stays flagged inside a perfect profile.
- **Behavior.** Two hundred page loads a minute from one profile looks like a bot whatever the fingerprint says.
- **Shared IPs.** Thirty profiles on one proxy are thirty accounts a site can link in one query.

And sometimes you don't need a browser at all. If a target only checks TLS and headers, a browser-impersonating HTTP client is far lighter.

In Python, primp covers Chrome, Safari, and Firefox profiles, and curl\_cffi gives you a requests-style API. In Go use tls-client; in Node, hellojs.

If you're comparing antidetect browsers, the same open, attach, close pattern carries over. [Web scraping with Gologin](https://roundproxies.com/blog/gologin-proxy-automation/) shows it with Gologin's SDK.

## How I checked this guide

I rewrote this guide in November 2026 against BitBrowser's [Browser Profiles API reference](https://doc.bitbrowser.net/api-docs/browser-profiles). Every endpoint, field name, and allowed value in the code comes from that page.

The auth token details come from [BitBrowser's own MCP setup guide](https://www.bitbrowser.net/news/how-to-connect-bitbrowser-to-mcp), which documents the `x-api-key` header and the 7.1.5 minimum version.

All Python and JavaScript blocks pass a syntax check. Field names the reference leaves vague, like where `/checkagent` nests its result, are handled defensively in the code instead of guessed.

## Troubleshooting

### "Connection refused" on 127.0.0.1:54345

**Why:** The BitBrowser app isn't running, you're signed out, or the Local API port was changed in Settings.

**Fix:** Start the app and sign in, copy the exact URL from **Settings → Browser Settings → Local API**, and export it as `BIT_API`.

### `success: false` with a `msg`

**Why:** A missing or stale token, a sub-account without API permission, or a parameter of the wrong type. `port` is a string for `/checkagent` but an integer for `/browser/update`.

**Fix:** Print `msg` first; it usually names the field. Set `BIT_API_KEY` if Authentication Control is on, and send JSON in the body, never URL parameters or form data.

### Playwright or Puppeteer can't connect to the `ws` URL

**Why:** The URL came from an earlier `/browser/open` call and the profile has since closed, or another script grabbed the same profile.

**Fix:** Call `/browser/open` at the start of every run, give each profile to one script at a time, and close it in a `finally` block.

### The proxy checks out, but the site still blocks you

**Why:** The site's bot protection is reacting to the IP's reputation or to the script's behavior, not to the proxy connection.

**Fix:** Find out what you're up against before you change anything. [antibot-detect](https://github.com/mmewni/antibot-detect) makes one request and names the protection (Cloudflare, DataDome, Akamai and others) with the evidence.

It's passive, so a clean result doesn't prove a site is unprotected: some defenses only show once JavaScript runs.

Once you know the vendor, [how to bypass bot detection](https://roundproxies.com/blog/bypass-bot-detection/) covers what to change.

## FAQ

### Should I set the proxy in BitBrowser or in Playwright?

Set it in BitBrowser. When you attach with `connect_over_cdp`, the browser is already running with the profile's proxy, and Playwright's own proxy option only applies to browsers Playwright launches itself.

### Can BitBrowser profiles run headless?

Yes. Pass `"args": ["--headless"]` to `/browser/open`. Test the target in headed mode first, because some sites treat headless Chromium differently even with a clean fingerprint.

### How do I rotate the IP on a BitBrowser profile?

Change the session ID in a rotating gateway's username, call your provider's refresh URL, or swap the proxy with `/browser/proxy/update`. Then confirm the new exit IP with `/checkagent`.

### Can I call the BitBrowser API from another machine?

Not by default. The Local API listens on 127.0.0.1, which is the safe setup. If a remote script needs it, tunnel the port over SSH and keep Authentication Control switched on.

### How many BitBrowser profiles can I automate at once?

Your RAM and your plan's profile limit set the ceiling, not the API. Each open profile is a full Chromium process, so open them with `"queue": true` and scale up gradually.

## Wrapping up

You set up a proxy in a profile by hand, then did the same through the Local API: check, create, open, attach, close.

The `x-api-key` token and the `finally` that closes each profile are the two lines most scripts are missing.

Start with one profile and the Playwright script. Once that prints the right exit IP, the proxy swap loop scales it to the rest.