Skip to content
Start here

Get a browser session ID.

browser_rendering.devtools.browser.create(BrowserCreateParams**kwargs) -> BrowserCreateResponse
POST/accounts/{account_id}/browser-rendering/devtools/browser

Get a browser session ID.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Browser Rendering Write
ParametersExpand Collapse
account_id: str

Account ID.

keep_alive: Optional[float]

Keep-alive time in milliseconds.

maximum1200000
minimum10000
lab: Optional[bool]

Use experimental browser.

recording: Optional[bool]
targets: Optional[bool]

Include browser targets in response.

ReturnsExpand Collapse
class BrowserCreateResponse:
session_id: str

Browser session ID.

web_socket_debugger_url: Optional[str]

WebSocket URL for the session.

Get a browser session ID.

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
browser = client.browser_rendering.devtools.browser.create(
    account_id="account_id",
)
print(browser.session_id)
{
  "sessionId": "sessionId",
  "webSocketDebuggerUrl": "webSocketDebuggerUrl"
}
Returns Examples
{
  "sessionId": "sessionId",
  "webSocketDebuggerUrl": "webSocketDebuggerUrl"
}