Skip to main content

Browser Connection (CDP)

Browser-as-a-Service exposes a WebSocket CDP endpoint. Point Playwright or Puppeteer at it — a browser is provisioned on connect, torn down on disconnect.

wss://browser.omniscrape.io?apikey=YOUR_API_KEY

Authentication​

Your API key is passed as the apikey query parameter (CDP clients connect by URL, so the key travels in the URL rather than a header). Keep the URL secret and build it on your backend.

const wsUrl = `wss://browser.omniscrape.io?apikey=${process.env.OMNISCRAPE_KEY}`;

Query parameters​

ParameterRequiredDefaultDescription
apikeyYes—Your API key.
proxy_countryNoautoISO country code to route through, e.g. us, de, gb.
render_mediaNofalseLoad images/fonts/media. true is billed at the higher rate.
session_idNo—Reuse the same IP across reconnects (sticky).

Lifecycle​

  1. Connect — connectOverCDP(wsUrl) provisions a fresh browser and starts the meter.
  2. Drive — use the full Playwright/Puppeteer API: navigate, click, type, evaluate, screenshot.
  3. Disconnect — browser.close() (or dropping the socket) tears down the browser and finalizes billing.

There are no REST calls to create or delete sessions — the connection is the session.

Example​

import { chromium } from "playwright";

const wsUrl = `wss://browser.omniscrape.io?apikey=${process.env.OMNISCRAPE_KEY}&proxy_country=us`;

const browser = await chromium.connectOverCDP(wsUrl);
try {
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.title());
} finally {
await browser.close(); // always close to stop billing
}

Billing​

Billed by connection time:

ModeRate
Standard (render_media=false)$0.02 / minute
Full media (render_media=true)$0.10 / minute

The meter runs from connect to disconnect. Always close() when done. See Pricing.

Errors​

The WebSocket connection is rejected before upgrade when:

ReasonCause
401Missing or invalid apikey.
402Balance too low, trial expired (TRIAL_EXPIRED), or concurrent browser limit reached for your plan.
429Concurrent browser limit reached for your plan.

Your CDP client surfaces these as a failed connection. Verify the apikey and account balance, then retry.