Browser lifecycle

Open, attach to, inspect, take over and close profile browsers through the Quin Local API, including session states and Quin Cloud saves.

Local APIApplies to Quin Camoufox 0.7Updated 2 November 2026

A session is Quin's handle on one profile's running browser. The Local API, RPA Plus and the app share one session manager, so a profile is never opened twice: opening a profile whose browser is already open (by you, a task or another script) attaches to it. Every launch goes through Quin's normal path — mode checks, proxy check, pinned runtime, Network Guard and, for Quin Cloud profiles, the lease, download and save on close.

Open a browser

POST /api/v1/browsers/open — scope browser:open.

FieldTypeDefaultNotes
profile_idstringrequiredLocal id or Quin Cloud id (a Cloud profile not on this computer is downloaded first)
start_urlstring–http:/https: or about:blank only
window{width, height}–Viewport in pixels, 200–7680 × 200–4320 (400 invalid_window otherwise)
waitbooltruetrue: answer when the browser is ready. false: answer 202 with a job at once
timeout_sint 5–3600600How long to wait for the browser to be ready
Shell
curl -s -X POST http://127.0.0.1:50380/api/v1/browsers/open \
  -H "Authorization: Bearer $QUIN_API_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: open-AbCd1234-20261102" \
  --data '{"profile_id": "AbCd1234", "start_url": "https://example.com", "timeout_s": 300}'

Response 200 (session object):

JSON
{
  "session_id": "s_3f9c1d2e8a7b6c5d",
  "profile_id": "AbCd1234",
  "local_profile_id": "AbCd1234",
  "cloud_profile_id": null,
  "kind": "local",
  "state": "RUNNING",
  "opened_by": "api",
  "created_at": "2026-11-02T09:12:44",
  "runtime_id": "…",
  "controlled_by": null,
  "automation": {"bridge": "engine", "external_protocols": [],
                 "actions_endpoint": "/api/v1/browsers/s_3f9c1d2e8a7b6c5d/actions"},
  "tabs": 1
}

For a Quin Cloud profile profile_id is the Cloud id and local_profile_id the copy on this computer. With "wait": false the answer is 202 {"job_id": "job_…", "state": "QUEUED"}; follow the job (its result is the session object) — see Jobs.

Send an Idempotency-Key so that a retried open returns the first answer instead of starting again.

When opening fails

HTTPCodeMeaning
409writer_busy, proxy_unreachable, …Quin's specific reason (for example the Cloud profile is open on another computer)
409launch_failedThe browser did not start; details.state and details.cause say more
409cloud_unavailableQuin Cloud is not available for a Cloud profile
504launch_timeoutNot ready within timeout_s
400invalid_profile_id, invalid_windowBad input

Session states

StateMeaning
PREPARINGAccepted, being prepared (Cloud: profile download)
DOWNLOADING_RUNTIME, VERIFYING_RUNTIMEGetting the pinned browser runtime
VALIDATING_PROXYChecking the proxy before launch
ACQUIRING_LEASEQuin Cloud lease for a Cloud profile
STARTINGBrowser process starting
RUNNINGReady; actions accepted
AUTOMATINGReady, and an action or RPA run currently holds control
STOPPINGClosing
SYNCINGCloud profile being saved
CLOSEDLocal profile closed
SYNCEDCloud profile closed and its revision committed by Quin Cloud
RECOVERY_REQUIREDCloud profile needs recovery (for example the lease was lost)
FAILEDLaunch or save failed; see error

CLOSED, SYNCED, RECOVERY_REQUIRED and FAILED are final. States are derived from Quin's own components on every read: RUNNING only when the browser answered, SYNCED only after Quin Cloud committed the revision.

List and inspect

Method & pathScopeAnswer
GET /browsersbrowser:open{"items": [session, …]} — open sessions, including browsers you opened from the Profiles page
GET /browsers/{sid}browser:openOne session; an unknown or long-gone id → 404 session_not_found
GET /browsers/{sid}/tabsbrowser:control{"items": [{"tab": "t1", "url", "title", "active"}]}

Control and takeover

Each session has one control lock. An API action holds it while it runs; an RPA run holds it for the whole run. An action from another holder gets:

JSON
{"error": {"code": "session_busy", "message": "Another automation controls this browser.",
           "details": {"controlled_by": "rpa"}}}

POST /browsers/{sid}/takeover (scope browser:control) cancels the current holder's in-flight action or run and frees the lock:

JSON
{"session_id": "s_3f9c1d2e8a7b6c5d", "previous_holder": "rpa"}

A cancelled RPA run is recorded as cancelled (taken over); a cancelled API action answers 409 taken_over. Your own clicks in the browser are never blocked — it is your browser — but they can make the next action fail.

Close

POST /browsers/{sid}/close — scope browser:close. The body is optional.

FieldDefaultNotes
synctrueFor a Cloud profile, wait until the save is SYNCED
waittruefalse: answer 202 with a job at once
timeout_s900 (5–3600)A Cloud save can be large

Closing first cancels whoever holds control. The answer is the session with its final state: CLOSED for a local profile; SYNCED (or FAILED / RECOVERY_REQUIRED) for a Cloud profile with sync: true. With sync: false the call returns without waiting for the Cloud save; Quin still saves the profile. Not finished in time → 504 close_timeout.

POST /browsers/close-all — scope browser:close, body {"include_user": false, "sync": true} — closes sessions opened by the API or RPA; browsers you opened yourself are closed only with "include_user": true. It answers {"items": [...]} with one result per session.

Close policy for RPA tasks

Tasks started with POST /tasks take a close_policy:

  • close_if_opened_by_task (default) — close and save the browsers the task opened;
  • close_and_sync — close and save; for tasks started through the Local API it closes the same browsers as the default;
  • keep_open — leave browsers open.

A task started through the Local API never closes a browser you opened yourself. When the policy closes a browser, the run shows SAVING until the profile is saved, and a Quin Cloud profile that could not be saved turns a successful run into FAILED with profile_not_saved.

With the SDKs

Python
with client.browsers.open(profile_id="AbCd1234", start_url="https://example.com") as session:
    print(session.state, session.title())
# leaving the block closes the browser; a Cloud profile returns only once SYNCED
TypeScript
await client.browsers.withSession({ profileId: "AbCd1234" }, async (b) => {
  console.log(await b.title());
}); // always closes with sync

A client that is killed while holding a browser leaves the browser open; closing is always explicit.