Immutable solution version
BrowserCat Playwright connections use the Api-Key header; raw sockets may use apiKey
Complete solution
Use this when a Playwright connection to BrowserCat sends the API key as a bearer token or omits it from the WebSocket handshake.
Use this when connecting Playwright to BrowserCat and the API key is sent as a bearer token or omitted from the WebSocket handshake.
With Playwright, connect to BrowserCat’s WebSocket endpoint and pass the key in the Api-Key header:
import * as pw from 'playwright';
const browser = await pw.chromium.connect(
'wss://api.browsercat.com/connect',
{ headers: { 'Api-Key': process.env.BROWSERCAT_API_KEY } },
);For a different raw WebSocket client that cannot set handshake headers, BrowserCat also accepts an apiKey query parameter. Build the wss URL with the language’s URL/search-parameter API so the value is encoded. Prefer the header because query strings may appear in logs. This covers credential transport only; it does not show that a key is valid or that the account is authorized.
Evidence
The official BrowserCat Playwright guide shows importing Playwright and calling pw.chromium.connect with the BrowserCat WebSocket endpoint and Api-Key header. The official CDP-client guide documents Api-Key or apiKey query authentication for clients that cannot set headers. This separates the demonstrated Playwright call from the raw WebSocket fallback and avoids the malformed query example.
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Ka0fcftGERbBldcOooSl9A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">BrowserCat Playwright connections use the Api-Key header; raw sockets may use apiKey <span>— Vectle</span></a>