# Connect URL

Connecting to a cdpfleet connect URL launches the browser and connects to it in one step, with no launch request first. Use it wherever a tool takes a WebSocket URL: Playwright's `connect()`, Playwright Test's `wsEndpoint`, `connectOverCDP()`, Puppeteer, and AI-agent frameworks that accept a CDP URL. The [launch request](https://cdpfleet.com/docs/quickstart) keeps working as before.

## The URL

```sh
wss://router01.cdpfleet.com/connect/<browser>?<options>        # Playwright protocol (client 1.60; Rebrowser 1.52)
wss://router01.cdpfleet.com/connect/<browser>/cdp?<options>    # CDP — Chrome, Edge, Brave, Opera, Yandex, Chromium
```

-   **API key:** the `x-api-key` header (Playwright and Puppeteer send headers on connect), or `?api_key=` for tools that can't send headers.
-   **Options:** the launch options as query parameters — `headless=new`, `channel=beta`, `profile=shop-login`, `record=false`, `proxy=cdpfleet-resi-country-us`… Anything that isn't a plain string or true/false (objects, lists, `proxy_rules`, Camoufox `config`) goes as one `launch=` parameter: the JSON launch body, base64url-encoded — or in an `x-cdpfleet-launch` header as plain JSON. The [code builder](https://cdpfleet.com/docs/builder)'s **Connect URL** style writes the URL for you.
-   **Proxies in URLs:** URLs end up in logs, so prefer tokens without passwords — `cdpfleet-resi…`, `cdpfleet-plan…`, a saved VPN name — or leave `proxy` out for the free Community proxy.

## Examples

```js
// Playwright (Node.js)
const browser = await chromium.connect('wss://router01.cdpfleet.com/connect/chrome?proxy=cdpfleet-resi-country-us&headless=new', { headers: { 'x-api-key': process.env.CDPFLEET_API_KEY } });

// Playwright Test — playwright.config.ts: every worker gets its own browser
use: { connectOptions: { wsEndpoint: 'wss://router01.cdpfleet.com/connect/chrome?proxy=cdpfleet-resi-country-us&headless=new', headers: { 'x-api-key': process.env.CDPFLEET_API_KEY } } },

// CDP: connectOverCDP (any Playwright version) or Puppeteer
const browser = await chromium.connectOverCDP('wss://router01.cdpfleet.com/connect/chrome/cdp?headless=new', { headers: { 'x-api-key': process.env.CDPFLEET_API_KEY } });
const browser = await puppeteer.connect({ browserWSEndpoint: 'wss://router01.cdpfleet.com/connect/chrome/cdp?headless=new', headers: { 'x-api-key': process.env.CDPFLEET_API_KEY } });
```

Python: `p.chromium.connect(url, headers={"x-api-key": key})`. Java, C# and Go connect the same way with their own `headers` option — the code builder writes all five.

## What happens

-   The connection runs the same launch as `POST /<browser>/session`: same options, limits, billing and errors. The session starts when the browser is ready and ends when the connection closes, unless `keep_alive` is set.
-   **Busy:** if you're at your thread limit (`429 threads_exceeded`) or the fleet is momentarily busy (`503`), the connection waits and retries for up to 60 seconds before giving up — client libraries don't retry these themselves.
-   **Refused:** any other error (bad option, plan limits, no key) refuses the connection with the same status and JSON body as the launch request; libraries show it in the connection error (for example `401 Unauthorized`).
-   The session id comes back in the `x-cdpfleet-session-id` response header; it's also in the dashboard and [`GET /v1/me/threads`](https://cdpfleet.com/docs/api).
-   For live links, `keep_alive` reconnects or anything else that needs the launch response, use the launch request.

---
Source: https://cdpfleet.com/docs/connect · Markdown: https://cdpfleet.com/docs/connect.md · All docs for AI tools: https://cdpfleet.com/llms.txt
