QuickstartBeta

Create a browser key, start a Chrome browser at browsers.openwaf.dev and drive it with curl, Playwright, Puppeteer or the Playwright MCP server.

On this page

This guide creates a browser key, starts a browser, drives it from your code and stops it. It takes about five minutes.

Before you start

  • Access. OpenWAF Browsers must be enabled for your organization. Until it is, the writes answer 403 feature_disabled. See get access.
  • An organization-wide admin to create keys. Reading usage and sessions only needs readonly.
  • Node.js 18 or later for the Playwright, Puppeteer and MCP examples.

1. Create a key

A browser key (bdk_…) authenticates your agent at https://browsers.openwaf.dev. An organization has up to 5 keys. Each key runs up to 2 browsers at the same time. The secret is shown once; afterwards the dashboard and the API only show its prefix (bdk_ and 4 characters).

  1. Open Browsers in the organization menu, then the Keys tab.
  2. Choose Create key and give it a name, for example ci-agent (lowercase letters, digits and hyphens).
  3. Copy the secret now. You will not see it again.

Store the secret where your agent reads its secrets. The examples below read it from OPENWAF_BROWSERS_KEY:

read -rs OPENWAF_BROWSERS_KEY && export OPENWAF_BROWSERS_KEY   # paste bdk_…

2. Start a browser

curl -sS -X POST https://browsers.openwaf.dev/v1/browsers \
  -H "X-API-Key: $OPENWAF_BROWSERS_KEY" -H "Content-Type: application/json" \
  -d '{"metadata": {"task": "quickstart"}}'

Every field of the body is optional. The answer:

{"id": "bs_…", "status": "running",
 "cdpUrl": "wss://browsers.openwaf.dev/cdp/…", "cdpHttpUrl": "https://browsers.openwaf.dev/…",
 "liveUrl": "https://browsers.openwaf.dev/…", "urlsExpireAt": "2026-10-29T11:00:00Z", …}

Open liveUrl in your own browser to watch. cdpUrl and liveUrl carry a token valid for 1 hour; GET /v1/browsers/{id} returns fresh ones.

If every slot of the beta is busy you get 429 with {"code": "capacity_busy"} and Retry-After: 30. If this key already runs 2 browsers you get 429 with {"code": "key_concurrency"}. See errors.

3. Drive it

agent.mjs
import { chromium } from "playwright";

const api = "https://browsers.openwaf.dev/v1/browsers";
const headers = { "X-API-Key": process.env.OPENWAF_BROWSERS_KEY, "Content-Type": "application/json" };

const b = await (await fetch(api, { method: "POST", headers, body: "{}" })).json();
const browser = await chromium.connectOverCDP(b.cdpUrl);
const page = await browser.contexts()[0].newPage();
await page.goto("https://example.com");
console.log(await page.title());
await browser.close(); // disconnects; the browser keeps running until stopped or idle

await fetch(`${api}/${b.id}`, { method: "PATCH", headers, body: JSON.stringify({ action: "stop" }) });

4. Stop the browser

Closing the CDP connection does not stop a browser: it keeps counting browser time until it has had no CDP or live view client for 120 seconds. Stop it when the task is done:

curl -sS -X PATCH "https://browsers.openwaf.dev/v1/browsers/$ID" \
  -H "X-API-Key: $OPENWAF_BROWSERS_KEY" -H "Content-Type: application/json" \
  -d '{"action": "stop"}'

Then list what it left: the recording (if you asked for one) and the downloads, with links that expire.

curl -sS "https://browsers.openwaf.dev/v1/browsers/$ID/files" -H "X-API-Key: $OPENWAF_BROWSERS_KEY"

A member with the tech role or higher can also stop any running browser of the organization: Browsers → Sessions → Stop, openwaf-cloud ctl browsers sessions stop ID --reason "…" or the browser_sessions_stop MCP tool.

Next steps

Last updated:

↑↓ to navigate↵ to openesc to close