Token scopes
A read-only viewer and an interactive viewer can watch the same session at the same time. A live view token only opens the live view: it cannot connect over CDP or call the browser’s APIs.
Enable at session creation
Setsession.scoped_access.active to true when you create a session. The response then carries one URL per scope, each with its own token:
scoped_access_tokens, one per scope, each with its token id.
Embed a live view URL in an iframe the same way as any other live view.
If the session also sets live_view.read_only, no live view can interact: live_view_url is the same read-only URL as live_view_read_only_url, and cdp_url keeps full control.
Mint more tokens
To mint more token URLs for a running session, for example one per end user, callPOST /v1/sessions/{session_id}/tokens. Pass scopes to choose which URLs to mint, or omit it for every URL the session can serve. Every call returns new tokens:
tokens list with one entry per minted token:
scopes is omitted:
- A headful session gets all three URLs.
- A headless session gets only
cdp_url, because live view tokens require a headful browser. - A
live_view.one_time_urlsession gets nolive_view_url.
Restrict tokens to IP addresses
Passallowed_ips to restrict tokens to the client IP addresses you list. A connection from any other address is refused with 403. Each entry is an IPv4 or IPv6 address (203.0.113.7) or a CIDR range (203.0.113.0/24), up to 50 entries.
Set it under session.scoped_access to restrict the tokens returned when the session is created:
allowed_ips when the restriction is applied. The client IP is checked when a connection opens: a connection that is already open stays up. Tokens minted without allowed_ips connect from any address.
For a live view URL, the client is the end user’s browser, so list the addresses your end users connect from.
One-time tokens
Passone_time_use: true to make each token work once, for example a link you send to one end user. It defaults to false.
Set it under session.scoped_access for the tokens returned when the session is created:
one_time_use: true:
cdp_url, the live view stream for a live view URL. The token is removed when that connection opens, and any later connection with it is refused with 404. Reloading a live view page shows that the link is no longer valid.
A connection that is already open stays up, but cannot reconnect if it drops. Requests that are not a WebSocket connection, such as GET /json/version, do not use up the token, and neither does a connection refused by allowed_ips. A used token is no longer listed.
Manage tokens by id
Every token returned inscoped_access_tokens or tokens has an id (tok_...) that is not a secret. When you hand a URL to an end user, keep only the token’s id, mapped to that end user on your side. You don’t need to store the secret to manage the token later.
List a running session’s live tokens with GET /v1/sessions/{session_id}/tokens, or get one with GET /v1/sessions/{session_id}/tokens/{token_id}. Both return only id, scope, created_at, expires_at, allowed_ips and one_time_use, never the secret or URL. Revoked, expired and used one-time tokens are not listed. expires_at is the latest time a token works: every token also stops when its session ends.
To revoke a token, pass its id to DELETE /v1/sessions/{session_id}/tokens/{token_id}. The URL stops opening new connections; a connection that is already open stays until it closes:
DELETE /v1/sessions/{session_id}. This stops the browser and closes every connection to it, whichever token opened it.
Session id access
On a scoped session the session id is no longer a credential on its own: connecting to CDP or the live view with only?sessionId= is refused. Connect with a token (?token=), or with the session id and a token (?sessionId=...&token=...).
Any other session switches to tokens the same way as soon as you mint a token for it. Sessions that never use tokens keep working with the session id alone.
Limitations
- Tokens stop working when the session ends.
scoped_accessrequires a headful cloud browser and cannot be combined withlive_view.one_time_url.- Batch and async session creation do not accept
scoped_access. For those sessions, mint tokens withPOST /v1/sessions/{session_id}/tokensonce the session is running. - Tokens cannot be minted for sessions that run on a connector or a Mac.
allowed_ipsapplies to connections over the public internet. Through an Anchor Dock, it is checked against the Dock’s public address, not the client’s.- The DevTools URLs returned by
GET /v1/sessions/{session_id}/pagesare not IP-restricted, and their tokens have no id: they are not listed and can only be revoked by their secret. - Live view URLs of sessions created with
live_view.read_onlyorlive_view.one_time_urlbut withoutscoped_accesscarry no token id. Usescoped_accessorPOST /v1/sessions/{session_id}/tokensfor tokens you can manage by id. - Revoking a token does not close connections that are already open.

