Tools

Execute Code Snippet

Changed on

Run a TypeScript snippet in the sandbox against the browser session (query sessionId required).

post/v1/tools/execute-code

Request

  • Base URL
    https://api.anchorbrowser.io
  • Auth
    API key in header anchor-api-key

Query parameters

sessionIdstring uuid required

Browser session to run the snippet against.

Request body

codestring required

TypeScript snippet (async function body) with injected page, browser, context, sessionId, anchorClient.

Response

Snippet execution finished.

successboolean required
messagestring required
outputstring

JSON string of the return value when execution succeeds.

errorstring
executionResultIdstring uuid

Changes