Skip to main content
POST
Execute Code Snippet

Authorizations

anchor-api-key
string
header
required

API key for your Anchor Browser account, sent as the anchor-api-key header on every request. Create one at app.anchorbrowser.io (API Access), or obtain one programmatically via the unauthenticated agent-access flow (POST /v1/agent-access).

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>