Skip to main content
Keep more than one login in the same browser, and reuse a login in a later runtime. A browser starts with one cookie jar. An isolated context is a second jar. Export that jar after a login and import it when you need the session again.

Isolate a session

create_context returns {context_id}. Targets opened with that id live in the isolated jar — their cookies never touch the default session or other contexts. contexts lists every live context with its target_count; the default context always exists and cannot be deleted. proxy attaches a proxy server URL to the context. storage_state seeds the context’s jars from an exported state object.

Reuse a login

export_storage returns the context’s cookies and origin storage in the Playwright-compatible {cookies, origins} shape; import_storage applies a previously exported state. An empty context_id (the default) addresses the default context. This is how sessions persist: export after a login flow, keep the state, and import it into a later runtime — or seed a fresh context with it directly via create_context.
The exported object is JSON-serializable — store it like any other credential: it contains session cookies, so treat it with the same care as the password that produced it.

Endpoints