Skip to main content
The execute-code tool runs a TypeScript snippet inside an existing browser session, letting you perform custom browser logic without managing your own automation infrastructure.
Code Execution is available from the Growth tier and above.
Create a session with POST /v1/sessions, then call POST /v1/tools/execute-code with sessionId in the query string. The request body code field is an async function body with injected page, browser, context, sessionId, and anchorClient. On success, the API returns output as a JSON string of your return value. See the full API reference for details.

Code example