Skip to main content
Base URL: https://api.styne.ai. Every request carries Authorization: Bearer $STYNE_API_KEY.

Quick start

1. Start a session

Every field is optional: timeout in seconds (15 minutes by default) and region: ash (US East, Ashburn; the default). ams is accepted and served in Ashburn for now, see Regions. A browser in ash reports the America/New_York time zone and en-US. An unknown region is refused with 422. Start options set the page size, downloads, recording and your own metadata. The answer:
A session started with viewport or metadata also answers those two fields, on the start and on every later GET /browsers/{id} and GET /browsers. cdp_url carries a token: treat it as a secret and do not put it in a page, a log or a screenshot. The answer carries the API’s own start time in a Server-Timing header (add -D - to the curl call to see it): create;dur=<ms> is the whole start, followed by its phases (claim, node-resume, …), so you can log how long each start took on our side:

2. Connect Playwright and take a screenshot

Python, with cdp_url from the answer above:
Node:

3. Or connect Puppeteer

4. Stop the session

A session that is not stopped expires at expires_at and is then stopped for you. Reading or stopping another account’s session id answers 404.

From TypeScript without a client library

Start options

A value outside these bounds is refused with 422 and a message that names the bound. Two fields take no value and are refused with a 422 that says what to send instead: proxy (send egress and country) and secure (a session is reached only with the token in its cdp_url).

Extensions

Load your own Chrome extensions into a session: upload the extension once, then name it on every start that needs it. The session starts as fast as any other; the extension is unpacked into the running browser and loaded before the start answers, so its content scripts run on the first page you open.

1. Upload the extension

Zip the folder of an unpacked extension (the one you would pick under “Load unpacked” in chrome://extensions): manifest.json at the top of the zip or in its one top folder. Send it as the file part of a form, or as the body:
The answer:
chrome_id is the id the browser gives the extension in every session (chrome-extension://<chrome_id>/); a manifest with a key keeps the id that key gives it. curl --data-binary @my-extension.zip -H "content-type: application/zip" uploads the same zip as the body. On the /v1 API the same routes are /v1/extensions and /v1/extensions/{ext}.

2. Start a session with it

The start answer, GET /browsers/{id} and GET /browsers list what the session loaded:

3. Use it from Playwright

An extension with a content script on <all_urls> that sets document.documentElement.dataset.ext = "ok":

Limits and errors

  • A zip is at most 50 MB and unpacks to at most 200 MB in at most 5,000 entries; an entry may not point outside the extension’s folder. Manifest versions 2 and 3 are accepted.
  • An account keeps at most 100 extensions and 500 MB of zips; a session loads at most 10 (100 MB of zips together).
  • An upload that is not one extension is refused with 422 invalid_extension and the reason (no manifest.json, a manifest that is not JSON, no name or version, an entry outside the folder); a zip over the cap with 413.
  • A start that names an id your account does not have is refused with 422 unknown_extension before any browser starts. If the browser refuses an extension when it loads it (for example a manifest key it does not accept), the start fails with 422 extension_refused and the browser’s own message, and the session is stopped.

In the dashboard

The Browsers page lists the account’s sessions with their state, region and end time. Start a browser starts one and shows its start time (the API’s own time and the time your browser waited). Connect copies the session’s CDP URL once, without showing it. Each session’s page has a live view: its screen, console and network, attached over the session’s CDP URL from your browser next to your own client. Your client keeps driving while you watch, and the console and network lists show what happens while the page is open. Take control hands the page to you (see below). Stop ends the session.

Human takeover

A person can take over a running browser, for a login, a captcha or a payment step, and hand it back to the agent. In the dashboard, Take control on the live view pauses your client’s input, sends your mouse, wheel and keyboard to the page, and Return control gives the browser back. Through the API:
While a person holds control, a client command that clicks, types, scrolls, emulates a device or navigates (Input.*, Emulation.*, Page.navigate, Page.reload, Page.navigateToHistoryEntry) is answered at once with a DevTools error that names Control.heldByHuman, and the browser does not receive it. Reads such as screenshots, Runtime.evaluate and the DOM keep working, so the agent can see what the person does. Control lasts five minutes and a repeated POST renews it; it ends when the person returns it, when it lapses, or when the session ends. Another holder gets 409 while the browser is held. Each takeover is an audit row: the holder, the time control began and the time and reason it ended (returned, expired or browser-ended).

CAPTCHAs

The captcha field of a start says what the session does with a CAPTCHA on a page: With solve the answer is put into the page (the widget’s response field, or the token a reCAPTCHA v3 page asks for) and your code submits the form. Solving is metered per solved challenge, at most 10 attempts per session, failed ones included but not billed. If the solver cannot be reached the session carries on as click, and the start never fails because of it. Any other value is refused with 422.

Sleep, wake, fork and rewind

A browser session is a sandbox with the same id, so the sandbox lifecycle calls take a browser id as it is. Everything in the browser comes along: open tabs, cookies, local and session storage, and the state of each page’s scripts. Log in once, then fork the logged-in browser for parallel work:
A browser is metered per second while it is awake; asleep it accrues no seconds and no charge, and GET /v1/run/usage shows both (used.browser_seconds, and per day running_seconds, paused_seconds, paused_cost_micro). Pause tiers, what a sleeping browser keeps and how it is metered are in Timeouts, pause and resume.

Steps you can verify

An agent can say what it just did and what must be true on the page afterwards. The check runs inside the browser on the live page, so a step is verified only when the page shows it:
The answer holds verified, the result of each check, the page’s address and title, and the state of the whole run (run.verified is true when there are steps and every one passed). Checks: url_matches (a regular expression), selector_exists, text_contains, js_expr (a JavaScript expression that is truthy) and cookie (a cookie name). Each step keeps a screenshot, the page’s HTML and the resources it loaded for seven days: GET /browsers/{id}/steps lists them, GET /browsers/{id}/steps/{n} reads one, and GET /browsers/{id}/steps/{n}/screenshot returns its JPEG. A browser records at most 500 steps. When the browser was started from a profile that signs in with a vault item and a step fails on a page that looks signed out, the answer adds "logged_out": true and relogin, and the profile signs in again on its own.

Browserbase and Steel clients

The Browserbase session API is served under https://api.styne.ai/browserbase and the Steel session API under https://api.styne.ai/steel/v1, both with your Styne API key. Extensions work on both: Browserbase’s POST /v1/extensions (the file form part) and GET|DELETE /v1/extensions/{id} are served under https://api.styne.ai/browserbase, and a session takes extensionId; Steel’s extensionIds takes the ids POST /extensions answers. All of them use the same uploads as Extensions. See Switch from Browserbase and Switch from Steel.

Keep a session through a dropped socket

A CDP socket can close while the browser keeps running: a network change, a proxy on the path, a client restart. The session is not lost. Chrome, its contexts and its pages stay on the server until expires_at, so connect again with the same cdp_url (or read it again with GET https://api.styne.ai/browsers/{id}) and continue from the pages that are open. The SDKs do that for you. run is called again after each reconnect with the attempt number; start it from context.pages, not from a page object you kept. Python (pip install styne-sdk):
AsyncBrowser.with_reconnect is the asyncio form (connect and run are coroutine functions). Node (npm install styne-sdk):
Both retry up to 5 times by default (max_reconnects / maxReconnects) with a growing pause, and raise every other error unchanged. Without an SDK, a reconnect is one GET /browsers/{id} followed by a new CDP connection to the returned cdp_url.

Downloads

A page can download a file, for example an export button. Playwright’s download.saveAs and download.createReadStream do not work over a remote CDP socket, so the browser saves the file in its own VM and you read it through the files API. The simplest way is "downloads": true on the start: every download of the session is saved into /home/browser/Downloads under the name the site gives it, whichever client clicked, with no extra socket. List and read the files:
On the /v1 API the same reads are GET /v1/browsers/{br}/files/list?path=... and GET /v1/browsers/{br}/files?path=.... To choose the folder per download, or to wait for each file, tell the browser where to save from your own socket instead. It works next to any client that drives the session. With the SDKs:
Without an SDK, open a second CDP socket on the same cdp_url, send Browser.setDownloadBehavior with {"behavior": "allow", "downloadPath": "/tmp/downloads", "eventsEnabled": true}, and wait for Browser.downloadProgress with state completed. The file is downloadPath/<suggestedFilename>, where suggestedFilename comes from Browser.downloadWillBegin. Keep that socket open until the download has finished. Read the file with GET https://api.styne.ai/sandboxes/{id}/files?path=/tmp/downloads/<name>, where {id} is the id POST /browsers answered; on the /v1 API a browser br_x keeps its files in the VM vm_x, so read GET https://api.styne.ai/vms/vm_x/files?path=... (the SDKs do this for you). A file the page builds itself can also be read without a download: fetch it in the page and return it from Runtime.evaluate as base64. Uploads go the other way: PUT the file to the same files path, then point setInputFiles at it.

Operations