Automation API
Use the local HTTP API to launch a VirtualBrowser profile, then attach Playwright to its returned CDP port. The existing profile context keeps the environment configuration and proxy. Do not launch a separate Chromium instance.
Pro required
Sign in with active Pro and copy the actual address and api-key from the client API screen. Port 9000 and profile ID 1 below are examples.
Install dependencies
bash
python -m pip install requests playwrightThis attaches to a VirtualBrowser core, so the example does not need playwright install to download another Chromium.
Python example
python
import requests
from playwright.sync_api import sync_playwright
BASE_URL = "http://127.0.0.1:9000" # Replace with the client API address
PROFILE_ID = 1 # Replace with an existing profile ID
session = requests.Session()
session.headers.update({"api-key": "YOUR_API_KEY"})
def call_api(endpoint, body):
response = session.post(
f"{BASE_URL}{endpoint}", json=body, timeout=(5, 60)
)
response.raise_for_status()
payload = response.json()
if not isinstance(payload, dict) or payload.get("success") is not True:
raise RuntimeError(payload)
return payload
launch = call_api("/api/launchBrowser", {"id": PROFILE_ID})
try:
port = launch.get("data", {}).get("debuggingPort")
if not isinstance(port, int) or isinstance(port, bool) or not 0 < port < 65536:
raise RuntimeError(f"Missing or invalid data.debuggingPort: {launch}")
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(f"http://127.0.0.1:{port}")
if not browser.contexts:
raise RuntimeError("No profile context returned by CDP")
context = browser.contexts[0]
page = context.new_page()
page.goto("https://example.com", wait_until="domcontentloaded")
print(page.title())
finally:
try:
print(call_api("/api/stopBrowser", {"id": PROFILE_ID}))
finally:
session.close()Important behavior
- Select an existing profile ID from Get browser list.
- The launch response stores the port at data.debuggingPort, not at the root.
- The finally block stops the profile even if page automation fails.
- After a launch timeout, check the running list before retrying.
- The API service port and the CDP debugging port are different.
- For Node.js and Puppeteer, see Playwright integration.



