Multi-Account Browser Python API: REST Quickstart (2026)

7 min read

This tutorial covers the plain-Python layer first: the requests library talking directly to the JustBrowser REST API. No Playwright, no Puppeteer, just HTTP calls that list profiles, start one, hand you a CDP URL and stop it again. Once that layer makes sense, the framework integration is much easier to follow.

By the end you'll have a short script that starts a profile, attaches to it, does a bit of work and shuts it down cleanly. The kind of foundation that doesn't fall over at 2am.

Prerequisites

  • JustBrowser installed and running. The desktop app must be open, because the API lives inside it. Windows x64 and macOS (Apple Silicon) are the supported platforms. There is no Linux build.
  • An active subscription or trial. JustBrowser has one plan, $9.99/month or $99.99/year, with a 7-day free trial (card required). API access comes with a subscription or trial; team seats don't get it.
  • An API token. Generate it on the AI page in the app. It goes in a Bearer header.
  • Python 3 with requests (pip install requests), plus Playwright (pip install playwright) for Step 4.
  • One Chrome profile created in the app. We'll use it for testing.

The four things to know first

The docs spell these out, and every one of them trips people up:

  1. The API is local. It binds to 127.0.0.1:36542 (the port is configurable in the app). There is no hosted API and nothing to call at api.justbrowser.app.
  2. POST /profiles/{id}/start starts headless unless the body says {"headless": false}.
  3. Authentication is a Bearer token from the AI page.
  4. Responses and errors are enveloped. Branch on error.code, never on the message text.

Honest gripe: the headless default is the right call for automation and a nasty surprise for anyone following a tutorial that expects a window. Hence this section.

Step 1: Set up a session

import requests

API_BASE = "http://127.0.0.1:36542/api/v1"
TOKEN = "your-token-from-the-ai-page"

session = requests.Session()
session.headers.update({"Authorization": f"Bearer {TOKEN}"})

A Session keeps the header on every call so you don't repeat it.

Step 2: List your profiles

response = session.get(f"{API_BASE}/profiles")
response.raise_for_status()
body = response.json()
print(body)

Print the raw body the first time. The result sits inside a data envelope, and it's quicker to read the real shape once than to guess field names. Copy the ID of the profile you want.

If this fails with a connection error, the app isn't running or you're on a different port. If it returns an error object, read error.code.

Step 3: Start a profile

PROFILE_ID = "paste-your-profile-id-here"

response = session.post(
    f"{API_BASE}/profiles/{PROFILE_ID}/start",
    json={"headless": False},
)
payload = response.json()

if response.ok:
    cdp_url = payload["data"]["cdp_url"]
    print("Started:", cdp_url)
else:
    print("Failed:", payload["error"]["code"])

The cdp_url looks like ws://127.0.0.1:PORT/devtools/browser/<guid>. That's what Playwright, Puppeteer and Selenium attach to. It only exists while the session runs.

Launching takes a moment, because a full Chromium engine has to come up with the profile's settings and proxy applied.

Step 4: Attach and do something

The REST API manages the lifecycle. To actually drive pages you attach a CDP client. Playwright is the shortest route:

from playwright.sync_api import sync_playwright

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://example.com")
    print(page.title())
    browser.close()  # disconnects only

Two rules matter here.

Use contexts[0], never browser.new_context(). A new context is an incognito one outside your profile, so you'd lose its cookies and storage, which defeats the point.

browser.close() only disconnects. The profile keeps running. Ending the session is a separate API call, which is the next step.

Step 5: Stop the profile

response = session.post(f"{API_BASE}/profiles/{PROFILE_ID}/stop")
print("Stopped" if response.ok else response.json()["error"]["code"])

Browser gone, memory freed. The profile itself persists: cookies, storage, proxy and identity parameters are all still there. Next start gives you a fresh session with the same profile. That split between a stored profile and an ephemeral session is the mental model to keep.

A complete script

import requests
from playwright.sync_api import sync_playwright

API_BASE = "http://127.0.0.1:36542/api/v1"
TOKEN = "your-token-from-the-ai-page"
PROFILE_ID = "paste-your-profile-id-here"

session = requests.Session()
session.headers.update({"Authorization": f"Bearer {TOKEN}"})


def start(profile_id, headless=False):
    r = session.post(
        f"{API_BASE}/profiles/{profile_id}/start",
        json={"headless": headless},
    )
    body = r.json()
    if not r.ok:
        raise RuntimeError(body["error"]["code"])
    return body["data"]["cdp_url"]


def stop(profile_id):
    return session.post(f"{API_BASE}/profiles/{profile_id}/stop").ok


def main():
    cdp_url = start(PROFILE_ID)
    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://example.com")
            print(page.title())
            browser.close()
    finally:
        print("Stopped" if stop(PROFILE_ID) else "Stop failed")


if __name__ == "__main__":
    main()

The try/finally is the part worth copying. If your automation crashes halfway, the profile still gets stopped. Without it you'll leave sessions running all night and wonder where your RAM went.

Common errors

Connection refused

JustBrowser isn't running, or the port was changed in the app. The API only exists while the desktop app is open.

An authentication error

The token is missing or wrong. Copy it again from the AI page. Remember team seats have no API access at all.

The browser opened with no window

You skipped the body, so it started headless. Send {"headless": false}.

The CDP URL stopped working

The session ended, either because you stopped it or it crashed. The URL is per session. Start the profile again for a new one.

Selenium won't attach

Selenium needs a ChromeDriver matching the major version of JustBrowser's Chromium core. Otherwise Selenium Manager fetches a driver for your machine's own Chrome and the attach fails. Pin it to the core's current major rather than a number copied from a blog post, ours included.

Next steps

  • Selenium or Puppeteer. Same cdp_url, different client. See the integration guide.
  • Bulk creation. The API can create up to 100 profiles per call from a naming pattern, and archive restore goes through /profiles/import. There is no CSV importer.
  • Proxies. Each profile has its own proxy. Bring your own or buy a proxy plan in the app; proxies aren't part of the subscription.
  • The full reference. justbrowser.app/docs lists every operation, with an anchor per endpoint and the raw OpenAPI spec at /docs/openapi.json.

Start with requests and three endpoints. Once that feels solid, add the rest.

Frequently Asked Questions

Do I need Playwright or Puppeteer to use the JustBrowser API?

No. The REST API is plain HTTP, so you can list profiles, start them and stop them from any language. Playwright, Puppeteer and Selenium are optional. They connect to the cdp_url the API returns when a profile starts.

What's the difference between a profile ID and the CDP URL?

The profile ID identifies the stored profile: its cookies, storage, proxy and identity parameters. The cdp_url is a live connection to a running browser session. It is only valid while that session runs, so start the profile again to get a fresh one.

Can I run multiple profiles simultaneously from one Python script?

Yes. Each started profile returns its own cdp_url. Your machine's memory is the practical limit, not the API.

Why did my profile start headless?

POST /profiles/{id}/start starts headless unless the body says otherwise. Send {"headless": false} as JSON when you want a visible window.


Try JustBrowser

A multi-account browser for teams, built on a custom Chromium engine with native C++ integration, not an extension, and patched on every upstream Chromium release. 40+ identity parameters, local REST API plus CDP for Playwright, Puppeteer and Selenium. 7-day free trial, card required, then $9.99/month or $99.99/year, unlimited profiles, free team seats.

Get started → · How it differs from Multilogin / GoLogin / AdsPower

Ready to manage multiple accounts?

Seven days free, then $9.99/month — one plan, everything included.

We'd like to use Google Analytics, a Google service, to understand how our website is used, and Google Ads and Microsoft Advertising to measure our ads and show them to people who have visited us. They set cookies in your browser and run only if you click Accept. You can change your choice at any time with Cookie settings. Cookie Policy

Sign-in cookies and the cookie that remembers this choice are always on; the website needs them to work.

Google Analytics, a Google service, helps us understand how our website is used, and Google Ads and Microsoft Advertising measure our ads and show them to people who have visited us. They set the cookies _ga, _ga_TVZHQ99TZW, _gcl_au, _uetsid and _uetvid, and, after a click on one of our ads, _gcl_aw or _uetmsclkid. They are now onoff in this browser. If your browser sends a Global Privacy Control or Do Not Track signal, they stay off. Cookie Policy