Skip to main content
POST
Execute browser code
Execute up to 16,000 characters of Node.js, Python or Bash code in an active browser session created with the current API key. Node.js has an existing page object. Execution timeout is 1–30 seconds (default 20); the session lifetime still applies. Check data.execution.success, exit_code, stderr and killed: HTTP success alone does not mean the script succeeded. Closed or expired sessions return 409. No additional credits are charged. Use an Idempotency-Key when code changes remote state.

Authorizations

x-api-key
string
header
required

Headers

Cache-Control
string
Idempotency-Key
string
X-Max-Credits
integer

Optional nonnegative integer cap on the maximum request hold. A live request whose hold exceeds this cap returns 422 CREDIT_BUDGET_EXCEEDED before spending. Metered holds use the requested limit; cache hits and successful idempotent replays cost zero.

Required range: x >= 0

Path Parameters

session_id
string
required

Body

application/json
code
string
required
Required string length: 1 - 16000
language
enum<string>
default:node
Available options:
node,
python,
bash
timeout
integer
default:20
Required range: 1 <= x <= 30

Response

Request completed. Interpret data using the selected resource contract.

success
boolean
required
platform
string
required
endpoint
string
required
credits_used
integer
required
Required range: x >= 0
credits_remaining
integer | null
required
request_id
string
required
cached
boolean
required
data
object
required

The selected operation determines the resource fields in this object. Source data can omit a metric or report it as null.