Skip to main content
POST
/
v1
/
tools
/
execute-code
Execute Code Snippet
curl --request POST \
  --url https://api.anchorbrowser.io/v1/tools/execute-code \
  --header 'Content-Type: application/json' \
  --header 'anchor-api-key: <api-key>' \
  --data '
{
  "code": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "output": "<string>",
  "error": "<string>",
  "executionResultId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

anchor-api-key
string
header
required

API key passed in the header

Query Parameters

sessionId
string<uuid>
required

Browser session to run the snippet against.

Body

application/json
code
string
required

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

Response

Snippet execution finished.

success
boolean
required
message
string
required
output
string

JSON string of the return value when execution succeeds.

error
string
executionResultId
string<uuid>