Quickstart
Two minutes, one HTTP call, no SDK.
-
Get your API key
Sign in to app.rayobyte.com, open Browser, then API access. The key starts with
rb_live_and is 72 characters long. Reveal it, copy it, and keep it out of version control.The same page shows your residential proxy string with a sticky session id already appended. Copy that too. You need it for step 2.
-
Create a browser
Terminal window curl -i -G "https://browser.rayobyte.com/connect" \--data-urlencode "os=windows" \-H "x-api-key: rb_live_YOUR_KEY"HTTP/2 200x-session-id: br_3f8a1c9d2e4b5a60content-type: text/plain; charset=utf-8wss://sb-02.browser.rayobyte.com/cdp/br_5d4d8610784e2a91Two ids come back.
x-session-idis the session id. Thebr_value at the end of the CDP URL is a second id for the same session. Close and status accept either one. Reconnecting takes only thex-session-idvalue, so keep that one.Leave the
proxyparameter out and you get400, withPROXY_REQUIREDin theX-Error-Coderesponse header. A proxy is mandatory on every launch. -
Drive it
Each sample closes the session in a
finallyblock, so a script that fails halfway does not leave a browser running.# pip install httpx playwrightimport httpxfrom playwright.sync_api import sync_playwrightAPI = "https://browser.rayobyte.com"KEY = "rb_live_YOUR_KEY"resp = httpx.get(f"{API}/connect",params={"os": "windows", "proxy": PROXY, "vnc": "true"},headers={"x-api-key": KEY},timeout=120,)if resp.status_code != 200:raise SystemExit(f"{resp.status_code}: {resp.text}")cdp_url = resp.text.strip()session_id = resp.headers["x-session-id"]print("Live view:", resp.headers.get("x-vnc-url"))try:with sync_playwright() as p:browser = p.chromium.connect_over_cdp(cdp_url)context = browser.contexts[0]page = context.pages[0] if context.pages else context.new_page()page.goto("https://quotes.toscrape.com/")print(page.title()) # Quotes to Scrapefinally:httpx.post(f"{API}/api/browser/close",json={"browserId": session_id},headers={"x-api-key": KEY},timeout=30,)// npm install playwright// Save as quickstart.mjs and run: node quickstart.mjsimport { chromium } from 'playwright';const API = 'https://browser.rayobyte.com';const KEY = 'rb_live_YOUR_KEY';const url = new URL('/connect', API);url.searchParams.set('os', 'windows');url.searchParams.set('proxy', PROXY);url.searchParams.set('vnc', 'true');const resp = await fetch(url, { headers: { 'x-api-key': KEY } });if (!resp.ok) throw new Error(`${resp.status}: ${await resp.text()}`);const cdpUrl = (await resp.text()).trim();const sessionId = resp.headers.get('x-session-id');console.log('Live view:', resp.headers.get('x-vnc-url'));try {const browser = await chromium.connectOverCDP(cdpUrl);const context = browser.contexts()[0];const page = context.pages()[0] ?? (await context.newPage());await page.goto('https://quotes.toscrape.com/');console.log(await page.title()); // Quotes to Scrapeawait browser.close();} finally {await fetch(`${API}/api/browser/close`, {method: 'POST',headers: { 'x-api-key': KEY, 'content-type': 'application/json' },body: JSON.stringify({ browserId: sessionId }),});}// npm install puppeteer-core// Save as quickstart.mjs and run: node quickstart.mjsimport puppeteer from 'puppeteer-core';const API = 'https://browser.rayobyte.com';const KEY = 'rb_live_YOUR_KEY';const url = new URL('/connect', API);url.searchParams.set('os', 'windows');url.searchParams.set('proxy', PROXY);const resp = await fetch(url, { headers: { 'x-api-key': KEY } });if (!resp.ok) throw new Error(`${resp.status}: ${await resp.text()}`);const cdpUrl = (await resp.text()).trim();const sessionId = resp.headers.get('x-session-id');try {const browser = await puppeteer.connect({ browserWSEndpoint: cdpUrl });const page = (await browser.pages())[0] ?? (await browser.newPage());await page.goto('https://quotes.toscrape.com/');console.log(await page.title()); // Quotes to Scrapeawait browser.disconnect();} finally {await fetch(`${API}/api/browser/close`, {method: 'POST',headers: { 'x-api-key': KEY, 'content-type': 'application/json' },body: JSON.stringify({ browserId: sessionId }),});}Playwright’s
browser.close()and Puppeteer’sdisconnect()only detach your client. The session keeps running until the close call infinally. -
Watch it, if you want
vnc=trueadds anx-vnc-urlheader pointing at a live view of the session. Open it in a tab:x-vnc-url: https://sb-02.browser.rayobyte.com/vnc/vnc.html?path=ws%3Ftoken%3Dbr_5d4d8610784e2a91&autoconnect=true&resize=scaleThe picture is a compressed framebuffer sent over the network, so it stutters. The browser itself is running at full speed and the site it is visiting sees no delay.
-
Close it
Disconnecting your CDP client leaves the browser running. Post the
x-session-idvalue, or the id at the end of the CDP URL, to end the session:Terminal window curl -X POST https://browser.rayobyte.com/api/browser/close \-H "x-api-key: rb_live_YOUR_KEY" \-H "content-type: application/json" \-d '{"browserId": "br_3f8a1c9d2e4b5a60"}'Three things end a session: you close it, its lifetime runs out (
EXPIRED), or the browser dies (DEAD). Nothing else does, so a session you never close runs until its lifetime expires, which defaults to 7,200 seconds, and every one of those seconds counts against your 48 browser hours.
What to read next
Section titled “What to read next”- Connecting: the full parameter table
- Session management: reconnecting, listing and closing
- Limits: what
429and402mean and how to react - Proxy support: the accepted proxy forms
Was this page helpful?
Thanks — that helps us fix it.