DocWorm Browser-as-a-Service
Control anti-detect browsers in the cloud with a simple API
🦊 Camoufox Browser
Firefox-based anti-detect browser with C++ level fingerprint spoofing
💾 Session Persistence
Save and restore cookies, localStorage, and sessionStorage
🌍 Residential Proxies
195+ countries with automatic geo-sync
📺 Real-time Streaming
View and control browsers via WebSocket
Quickstart
Get started in 5 minutes
1. Install SDK
pip install bctrl-browser
2. Create Your First Session
import asyncio
from bctrl_browser import BrowserClient
async def main():
# Initialize client
client = BrowserClient(api_key="your_api_key")
# Create session with US proxy
session = await client.create_session(proxy="us")
# Navigate and interact
await session.goto("https://example.com")
await session.click("#button")
await session.type("#search", "Hello World")
# Take screenshot
screenshot = await session.screenshot()
# Close session
await session.close()
asyncio.run(main())
3. Save and Restore Sessions
# Save session state
state = await session.save_state()
# Later, restore the session
restored = await client.restore_session(state)
# All cookies and state preserved!
Authentication
All API requests require an API key
Get Your API Key
- Sign up at b-ctrl.com
- Navigate to Dashboard → API Keys
- Click "Generate New Key"
- Copy your API key (shown only once)
Using Your API Key
REST API
curl -X POST https://browser.b-ctrl.com/sessions \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"proxy": "us"}'
Python SDK
from bctrl_browser import BrowserClient
client = BrowserClient(api_key="your_api_key")
- Never commit API keys to version control
- Use environment variables
- Rotate keys every 90 days
- Use separate keys for dev/staging/production
Session Management
Save, restore, and manage browser sessions
Creating Sessions
# Basic session
session = await client.create_session()
# With proxy
session = await client.create_session(proxy="us")
# With custom viewport
session = await client.create_session(
viewport={"width": 1920, "height": 1080}
)
Saving Session State
# Perform actions
await session.goto("https://example.com")
await session.click("#login")
# ... login flow ...
# Save state (cookies, localStorage, sessionStorage)
state = await session.save_state()
Restoring Sessions
# Restore from saved state
restored = await client.restore_session(state)
# Session continues where it left off
await restored.goto("https://example.com/dashboard")
# Already logged in!
- Max Duration: 30 minutes of inactivity
- Max Concurrent: 10 sessions per API key
- State Size: 10 MB max
Browser Control
Navigate, click, type, and interact with pages
Navigate
await session.goto("https://example.com")
Click
# By ID
await session.click("#submit-button")
# By class
await session.click(".btn-primary")
# By CSS selector
await session.click("button[type='submit']")
# By coordinates
await session.click(x=100, y=200)
Type
# By ID
await session.type("#email", "user@example.com")
# By name
await session.type("input[name='password']", "mypassword")
# With human-like delay
await session.type("#search", "Hello", delay=50)
Scroll
# Scroll down 500px
await session.scroll(y=500)
# Scroll to element
await session.scroll(selector="#footer")
Screenshot
# Viewport screenshot
screenshot = await session.screenshot()
# Full page screenshot
screenshot = await session.screenshot(full_page=True)
# Save to file
with open("screenshot.png", "wb") as f:
f.write(screenshot)
Execute JavaScript
title = await session.execute("return document.title;")
print(title) # "Example Domain"
Proxy Configuration
Residential proxies in 195+ countries with automatic geo-sync
Quick Start
# Create session with US proxy
session = await client.create_session(proxy="us")
# Browser appears to be in the United States
# - Timezone: America/New_York
# - Locale: en-US
# - Geolocation: US coordinates
Country Codes
| Country | Code | Example |
|---|---|---|
| United States | us | proxy="us" |
| United Kingdom | uk | proxy="uk" |
| Germany | de | proxy="de" |
| France | fr | proxy="fr" |
| Canada | ca | proxy="ca" |
| Australia | au | proxy="au" |
Automatic Geo-Sync
- Timezone: Automatically matches proxy country
- Locale: Browser language matches country
- Geolocation: Returns coordinates in proxy country
- Sticky Sessions: Same IP throughout session
Real-Time Streaming
View and control browsers in real-time via WebSocket
Enable Streaming
session = await client.create_session(stream=True)
# Get frames
async for frame in session.stream():
# frame is base64-encoded JPEG
display_frame(frame)
Embed Stream in Your App
stream_url = session.get_stream_url()
# wss://browser.b-ctrl.com/sessions/sess_abc/stream?token=...
HTML Example
<img id="browser-view" />
<script>
const ws = new WebSocket(streamUrl);
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'frame') {
document.getElementById('browser-view').src =
'data:image/jpeg;base64,' + data.data;
}
};
</script>
Frame Rate
# Low frame rate (saves bandwidth)
session = await client.create_session(stream=True, fps=1)
# High frame rate (smoother)
session = await client.create_session(stream=True, fps=10)
Python SDK
Official Python client library
Installation
pip install bctrl-browser
BrowserClient
from bctrl_browser import BrowserClient
client = BrowserClient(api_key="your_api_key")
Methods
create_session()
session = await client.create_session(
proxy="us",
stream=False,
viewport={"width": 1920, "height": 1080}
)
restore_session()
session = await client.restore_session(state)
BrowserSession Methods
goto(url)- Navigate to URLclick(selector)- Click elementtype(selector, text)- Type textscroll(y=500)- Scroll pagescreenshot()- Capture screenshotexecute(script)- Execute JavaScriptsave_state()- Save session statestream()- Stream framesclose()- Close session
Complete Example
import asyncio
from bctrl_browser import BrowserClient
async def scrape():
client = BrowserClient(api_key="your_key")
session = await client.create_session(proxy="us")
try:
await session.goto("https://example.com")
await session.click("#login")
await session.type("#email", "user@example.com")
await session.type("#password", "pass123")
await session.click("#submit")
# Save authenticated state
state = await session.save_state()
# Take screenshot
screenshot = await session.screenshot()
with open("result.png", "wb") as f:
f.write(screenshot)
finally:
await session.close()
asyncio.run(scrape())
API Reference
Complete REST API documentation
POST /sessions
Create a new browser session
Request
{
"proxy": "us",
"viewport": {
"width": 1920,
"height": 1080
}
}
Response
{
"sessionId": "sess_abc123",
"status": "active",
"createdAt": "2026-02-02T15:00:00Z"
}
POST /sessions/{id}/navigate
Navigate to a URL
Request
{
"url": "https://example.com",
"waitUntil": "load"
}
POST /sessions/{id}/click
Click an element
Request
{
"selector": "#submit-button"
}
Or by coordinates:
{
"x": 100,
"y": 200
}
POST /sessions/{id}/type
Type text into an element
Request
{
"selector": "#email",
"text": "user@example.com",
"delay": 50
}
POST /sessions/{id}/screenshot
Capture a screenshot
Request
{
"fullPage": false,
"type": "png"
}
Response
Binary image data
POST /sessions/{id}/save
Save session state
Response
{
"state": {
"cookies": [...],
"localStorage": {...},
"sessionStorage": {...}
}
}
DELETE /sessions/{id}
Close session
Response
{
"message": "Session closed successfully"
}
Rate Limits
- Concurrent Sessions: 10 per API key
- API Requests: 1000/minute per API key
- Session Duration: 30 minutes max