Skip to content

Quickstart

Two minutes, one HTTP call, no SDK.

  1. 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.

  2. Create a browser

    Terminal window
    curl -i -G "https://browser.rayobyte.com/connect" \
    --data-urlencode "os=windows" \
    --data-urlencode "proxy=http://USERNAME:[email protected]:8000" \
    -H "x-api-key: rb_live_YOUR_KEY"
    HTTP/2 200
    x-session-id: br_3f8a1c9d2e4b5a60
    content-type: text/plain; charset=utf-8
    wss://sb-02.browser.rayobyte.com/cdp/br_5d4d8610784e2a91

    Two ids come back. x-session-id is the session id. The br_ 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 the x-session-id value, so keep that one.

    Leave the proxy parameter out and you get 400, with PROXY_REQUIRED in the X-Error-Code response header. A proxy is mandatory on every launch.

  3. Drive it

    Each sample closes the session in a finally block, so a script that fails halfway does not leave a browser running.

    # pip install httpx playwright
    import httpx
    from playwright.sync_api import sync_playwright
    API = "https://browser.rayobyte.com"
    KEY = "rb_live_YOUR_KEY"
    PROXY = "http://USERNAME:[email protected]:8000"
    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 Scrape
    finally:
    httpx.post(
    f"{API}/api/browser/close",
    json={"browserId": session_id},
    headers={"x-api-key": KEY},
    timeout=30,
    )

    Playwright’s browser.close() and Puppeteer’s disconnect() only detach your client. The session keeps running until the close call in finally.

  4. Watch it, if you want

    vnc=true adds an x-vnc-url header 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=scale

    The 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.

  5. Close it

    Disconnecting your CDP client leaves the browser running. Post the x-session-id value, 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.

Was this page helpful?