Skip to main content
The Browser API gives you a raw Chrome DevTools Protocol (CDP) connection to Browser Use’s stealth infrastructure. No agent — you write the automation code, we provide the undetectable browser with proxies and CAPTCHA handling. There are two ways to connect:
  • WebSocket URL — single wss:// URL, no SDK needed. Pass config as query params, browser auto-stops on disconnect.
  • SDK — create a browser via the API, get a cdp_url, connect with your framework of choice.

WebSocket URL (no SDK)

Connect to a cloud browser with a single WebSocket URL. All configuration is passed as query parameters — no SDK or REST calls needed.
This is the simplest way to get a CDP connection. Just point Playwright, Puppeteer, or any CDP client at the URL.

Playwright

from playwright.async_api import async_playwright

WSS_URL = "wss://connect.browser-use.com?apiKey=YOUR_API_KEY&proxyCountryCode=us"

async with async_playwright() as p:
    browser = await p.chromium.connect_over_cdp(WSS_URL)
    page = browser.contexts[0].pages[0]
    await page.goto("https://example.com")
    print(await page.title())
    await browser.close()
# Browser is automatically stopped when the WebSocket disconnects

Puppeteer

import puppeteer from "puppeteer-core";

const WSS_URL = "wss://connect.browser-use.com?apiKey=YOUR_API_KEY&proxyCountryCode=us";

const browser = await puppeteer.connect({ browserWSEndpoint: WSS_URL });
const [page] = await browser.pages();
await page.goto("https://example.com");
console.log(await page.title());
await browser.close();
// Browser is automatically stopped when the WebSocket disconnects

Query parameters

ParameterTypeDescription
apiKeystringRequired. Your Browser Use API key.
proxyCountryCodestringProxy country code (e.g. us, de, jp). 195+ countries.
profileIdstringLoad a saved browser profile (cookies, localStorage).
timeoutintSession timeout in minutes. Max: 240 (4 hours).
browserScreenWidthintBrowser width in pixels.
browserScreenHeightintBrowser height in pixels.
customProxy.hoststringCustom proxy host.
customProxy.portintCustom proxy port.
customProxy.usernamestringUsername for the custom proxy.
customProxy.passwordstringPassword for the custom proxy.

How it works

The browser is automatically created when you connect and automatically stopped when the WebSocket disconnects. No need to call any API to start or stop the browser.
CDP discovery endpoints are also exposed over HTTPS for tools that use HTTP auto-discovery — e.g. https://connect.browser-use.com/json/version?apiKey=YOUR_API_KEY.

SDK

Create a browser session

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create(proxy_country_code="us")
print(browser.cdp_url)   # ws://...
print(browser.live_url)  # debug view

Connect with Playwright

from playwright.async_api import async_playwright
from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create()

async with async_playwright() as p:
    b = await p.chromium.connect_over_cdp(browser.cdp_url)
    page = b.contexts[0].pages[0]
    await page.goto("https://example.com")
    print(await page.title())
    await b.close()

await client.browsers.stop(browser.id)

Connect with Puppeteer

import puppeteer from "puppeteer-core";
import { BrowserUse } from "browser-use-sdk";

const client = new BrowserUse();
const browser = await client.browsers.create();

const pw = await puppeteer.connect({ browserWSEndpoint: browser.cdpUrl });
const [page] = await pw.pages();
await page.goto("https://example.com");
console.log(await page.title());
await pw.close();

await client.browsers.stop(browser.id);

Connect with Selenium

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create()

options = Options()
options.debugger_address = browser.cdp_url.replace("ws://", "").replace("/devtools/browser/", "")
driver = webdriver.Chrome(options=options)
driver.get("https://example.com")
print(driver.title)
driver.quit()

await client.browsers.stop(browser.id)

Manage sessions

from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()

# List active sessions
sessions = await client.browsers.list()

# Get a specific session
session = await client.browsers.get(browser_id)

# Stop a session
await client.browsers.stop(browser_id)
Always stop browser sessions when done. Sessions left running will continue to incur charges until the timeout expires.

Parameters

ParameterTypeDescription
profile_idstrLoad a saved browser profile (cookies, localStorage).
proxy_country_codestrProxy country code (e.g. us, de, jp). 195+ countries.
timeoutintSession timeout in minutes. Max: 240 (4 hours).
browser_screen_widthintBrowser width in pixels.
browser_screen_heightintBrowser height in pixels.
custom_proxyCustomProxyBring your own proxy (HTTP or SOCKS5). See Proxies.
See Models & Pricing for browser session and proxy costs.