PLATINUM DOCS

Browsers

Headless Chromium you drive with Playwright over a CDP URL, with a profile that keeps its logins.

Last updated

A browser is a headless Chromium that runs in its own isolated sandbox and keeps its profile on disk. You connect with Playwright, or any Chrome DevTools Protocol (CDP) client, through a private URL. Use browsers to give agents and scripts a real browser that stays signed in between runs.

Manage browsers with the calls below or in the Browsers tab of the dashboard. If every /v1/browsers call returns 404 not_found, Browsers are not enabled for your organization or deployment.

Quickstart

Install the SDK and Playwright.

npm install @platinum-dev/sdk playwright
pip install platinum-sdk playwright

Create a browser, connect, load a page, and clean up. create returns when the browser is ready to accept connections.

import { Platinum } from "@platinum-dev/sdk";
import { chromium } from "playwright";

const client = new Platinum({ url: process.env.PT_API_URL, token: process.env.PT_TOKEN });
const browser = await client.browsers.create({ name: "quickstart" });

const pw = await chromium.connectOverCDP(browser.cdp_url);
const context = pw.contexts()[0] ?? (await pw.newContext());
const page = await context.newPage();
await page.goto("https://example.com");
console.log(await page.title());
await pw.close();

await client.browsers.delete(browser.id);
import os
from platinum import Platinum
from playwright.sync_api import sync_playwright

client = Platinum(token=os.environ["PT_TOKEN"], api_url=os.environ["PT_API_URL"])
browser = client.browsers.create(name="quickstart")

with sync_playwright() as p:
    pw = p.chromium.connect_over_cdp(browser["cdp_url"])
    context = pw.contexts[0] if pw.contexts else pw.new_context()
    page = context.new_page()
    page.goto("https://example.com")
    print(page.title())
    pw.close()

client.browsers.delete(browser["id"])

pw.close() only disconnects Playwright. The browser keeps running, and keeps being billed, until you pause or delete it.

Create a browser

The response is the browser plus a ready cdp_url and its cdp_url_expires_at.

const browser = await client.browsers.create({
  name: "checkout-bot",
  idle_timeout_minutes: 15,
  idempotencyKey: "checkout-bot-2026-11-11",
});
browser = client.browsers.create(
    name="checkout-bot",
    idle_timeout_minutes=15,
    idempotency_key="checkout-bot-2026-11-11",
)
# Prints only the CDP URL, so you can pipe it.
pt browser create --name checkout-bot --idle-timeout 15
curl -X POST "$PT_API_URL/v1/browsers" -H "Authorization: Bearer $PT_TOKEN" \
  -H "Idempotency-Key: checkout-bot-2026-11-11" \
  -H "Content-Type: application/json" \
  -d '{"name": "checkout-bot", "idle_timeout_minutes": 15}'
OptionMeaning
nameOptional label, 1 to 64 characters.
idle_timeout_minutesPause after this many idle minutes. 0 (the default) never pauses. At most 43200.
regionOptional region to run in.
profile_idA saved profile to start from, already signed in.
Idempotency-Key header8 to 255 characters. A retry with the same key returns the same browser with a fresh CDP URL. The CLI has no flag for it.

Connect

Pass the CDP URL to Playwright's connectOverCDP. No other setup is needed.

const pw = await chromium.connectOverCDP(browser.cdp_url);
const context = pw.contexts()[0] ?? (await pw.newContext());
pw = p.chromium.connect_over_cdp(browser["cdp_url"])
context = pw.contexts[0] if pw.contexts else pw.new_context()

Reuse the first context to see the cookies and storage already in the profile. A new context starts empty.

Drive a browser from an AI agent

The MCP server has browser tools. An agent can create a browser, open pages, read them, click, type, and take screenshots without writing CDP or Playwright code. The server keeps the CDP URL to itself and never puts it in a tool result.

List and get browsers

list returns one page as { rows, total, has_more }. Neither list nor get returns a CDP URL.

const { rows, total } = await client.browsers.list({ limit: 20 });
const one = await client.browsers.get(browser.id);
console.log(total, one.status);
result = client.browsers.list(limit=20)
one = client.browsers.get(browser["id"])
print(result["total"], one["status"])
pt browser list
pt browser get brw_01...
curl "$PT_API_URL/v1/browsers?limit=20" -H "Authorization: Bearer $PT_TOKEN"
curl "$PT_API_URL/v1/browsers/$BROWSER_ID" -H "Authorization: Bearer $PT_TOKEN"

get checks that the browser answers right now. list does not, so a browser that get reports as unresponsive can show as running in list.

Browser statuses

StatusMeaning
startingBeing created.
runningReady for connections.
unresponsiveRunning but not answering. It restarts on its own within about a minute.
pausingPause in progress.
pausedPaused. Only its disk is billed.
resumingResume in progress, or waking after a connection.
failedCould not start. See last_error.
deletedDeleted.

last_error is set when the status is failed or unresponsive.

When a browser runs out of memory

A browser whose Chromium exits restarts it within a few seconds; one that stops answering is restarted within about a minute. Open tabs are lost. The profile on disk is kept. While it restarts, get shows unresponsive, and cdp-url returns 503 browser_not_ready with a Retry-After header. Reconnect when the status is running again.

Pause and resume

Pause a browser you are not using. Pausing closes every open CDP connection. resume returns once the browser is ready, with a fresh cdp_url.

await client.browsers.pause(browser.id);
const resumed = await client.browsers.resume(browser.id);
const pw2 = await chromium.connectOverCDP(resumed.cdp_url);
client.browsers.pause(browser["id"])
resumed = client.browsers.resume(browser["id"])
pw2 = p.chromium.connect_over_cdp(resumed["cdp_url"])
pt browser pause brw_01...
pt browser resume brw_01...
curl -X POST "$PT_API_URL/v1/browsers/$BROWSER_ID/pause" -H "Authorization: Bearer $PT_TOKEN"
curl -X POST "$PT_API_URL/v1/browsers/$BROWSER_ID/resume" -H "Authorization: Bearer $PT_TOKEN"

You can also skip resume. Connecting with a valid CDP URL wakes a paused browser.

Set an idle timeout

By default a browser never pauses by itself. Set idle_timeout_minutes to pause it after that many idle minutes.

Warning

the idle timer counts new connections and HTTP requests. Traffic on a CDP connection that is already open does not count. A script that works over one long connection still gets paused when the timer runs out. Reconnect with a CDP URL to wake the browser.

What a pause keeps

The profile on disk always survives a pause. Anything the browser wrote to it before the pause is there after the resume.

Memory may not survive. Plan for these to be lost:

  • open pages and tabs
  • session cookies not yet written to the profile
  • live network connections
  • logins that depend on any of the above

Write your code to reconnect, and to sign in again when a login is gone. To keep a login reliably, save it to a profile.

Get a fresh CDP URL

A CDP URL expires: after that it opens no new connection, while a connection already open with it stays open. Mint a new one with cdp-url. This works while the browser is paused.

const { cdp_url, expires_at } = await client.browsers.cdpUrl(browser.id, { ttlSeconds: 600 });
r = client.browsers.cdp_url(browser["id"], ttl_seconds=600)
print(r["cdp_url"], r["expires_at"])
pt browser cdp-url brw_01... --ttl 600
curl -X POST "$PT_API_URL/v1/browsers/$BROWSER_ID/cdp-url" \
  -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" \
  -d '{"ttl_seconds": 600}'

ttl_seconds accepts 60 to 86400. The default is 3600, which is also the lifetime of the URL that create and resume return.

Rotate CDP URLs

Rotating invalidates every earlier CDP URL for the browser and returns a new one. The browser must be running.

const fresh = await client.browsers.cdpUrl(browser.id, { rotate: true });
fresh = client.browsers.cdp_url(browser["id"], rotate=True)
pt browser cdp-url brw_01... --rotate
curl -X POST "$PT_API_URL/v1/browsers/$BROWSER_ID/cdp-url" \
  -H "Authorization: Bearer $PT_TOKEN" -H "Content-Type: application/json" \
  -d '{"rotate": true}'

Delete a browser

Deleting a browser deletes its disk and the profile on it, permanently. It never deletes a saved profile. To keep the browser's logins, save them to a profile first.

await client.browsers.delete(browser.id);
client.browsers.delete(browser["id"])
pt browser rm brw_01...
curl -X DELETE "$PT_API_URL/v1/browsers/$BROWSER_ID" -H "Authorization: Bearer $PT_TOKEN"

Saved profiles

A saved profile stores a browser's login state under a name. Sign in once, save the profile, and start later browsers already signed in.

A profile holds the browser's cookies, including httpOnly and session cookies, and the localStorage of each site. It uses Playwright's storageState format. A file Playwright wrote uploads as is, and a downloaded state works with browser.newContext({ storageState }).

Save a login to a profile

Create an empty profile, sign in through a running browser, then save the browser into the profile.

const profile = await client.browsers.profiles.create("work");
// ... sign in through the browser's CDP URL ...
const saved = await client.browsers.saveProfile(browser.id, profile.id);
console.log(saved.cookie_count, saved.origins);
profile = client.browsers.profiles.create("work")
# ... sign in through the browser's CDP URL ...
saved = client.browsers.save_profile(browser["id"], profile["id"])
print(saved["cookie_count"], saved["origins"])
pt browser profile create work
pt browser save-profile brw_01... bpf_01...
curl -X POST "$PT_API_URL/v1/browsers/profiles" -H "Authorization: Bearer $PT_TOKEN" \
  -H "Content-Type: application/json" -d '{"name": "work"}'
curl -X POST "$PT_API_URL/v1/browsers/$BROWSER_ID/save-profile" -H "Authorization: Bearer $PT_TOKEN" \
  -H "Content-Type: application/json" -d '{"profile_id": "'$PROFILE_ID'"}'

Saving needs a running browser and replaces what the profile held. The response shows the cookie count and origins, never the values.

Start a browser from a profile

Pass profile_id to create. The state is loaded before create returns, so the first page you open is signed in.

const signedIn = await client.browsers.create({ profile_id: profile.id });
signed_in = client.browsers.create(profile_id=profile["id"])
pt browser create --browser-profile bpf_01...
curl -X POST "$PT_API_URL/v1/browsers" -H "Authorization: Bearer $PT_TOKEN" \
  -H "Content-Type: application/json" -d '{"profile_id": "'$PROFILE_ID'"}'

An unknown profile fails with 404 before any browser is made. If the state cannot be loaded, the create fails with browser_profile_load_failed and no browser is left behind. The state is loaded once at start. Later changes made by sites stay in that browser only.

Upload or download a profile

import { readFile } from "node:fs/promises";

await client.browsers.profiles.upload(profile.id, JSON.parse(await readFile("state.json", "utf8")));
const state = await client.browsers.profiles.download(profile.id);
import json

with open("state.json") as f:
    client.browsers.profiles.upload(profile["id"], json.load(f))
state = client.browsers.profiles.download(profile["id"])
pt browser profile upload bpf_01... state.json
pt browser profile download bpf_01... state.json
curl -X PUT "$PT_API_URL/v1/browsers/profiles/$PROFILE_ID/state" -H "Authorization: Bearer $PT_TOKEN" \
  -H "Content-Type: application/json" --data-binary @state.json
curl "$PT_API_URL/v1/browsers/profiles/$PROFILE_ID/state" -H "Authorization: Bearer $PT_TOKEN" -o state.json

Downloading needs an API key with browsers:write. The CLI writes the file with mode 0600.

Manage profiles

List, get, and delete profiles with profiles.list, profiles.get, and profiles.delete (pt browser profile list | get | rm). Reads show the name, cookie count, origins, size, and saved_at, never the values. Deleting a profile does not change browsers already started from it.

A profile holdsA profile does not hold
Cookies, including httpOnly and session cookiesPartitioned cookies
localStorage for each site that has anysessionStorage, IndexedDB, service workers, cache, history

Security

A CDP URL gives full control of the browser, including its cookies and signed-in sessions. Treat it like a password and keep it out of logs and source control.

  • Mint short-lived URLs with ttl_seconds.
  • Rotate to cut off every URL you handed out earlier, and every connection already open with one (closed with code 1008).
  • Revoking an API key stops it from minting new URLs. URLs it already minted keep working until they expire or you rotate.
  • A browser is never reachable without a valid URL.

A saved profile is a credential too. Its session cookies can sign in without a password or a second factor.

  • Profiles are stored encrypted.
  • Every save, upload, and download is recorded in the audit log.
  • A browsers:read key sees profile metadata only. Downloading the state needs browsers:write.
  • Keep downloaded state files out of source control.

Errors

Errors use the standard { error, code } shape.

Quota and credit errors are the same as for sandboxes.

Limits

LimitValue
Size of a browser2 vCPU, 2048 MB memory, 10 GB disk
Chromium per browserOne, with one profile. Create more browsers to work in parallel.
CDP URL lifetime60 to 86400 seconds, default 3600
Idle timeout0 (never) to 43200 minutes
Saved profile size4 MiB of state JSON
Page size for list1 to 200, default 50

A browser is billed as a sandbox of its size. See billing.