Skip to main content
POST
Run JavaScript code

Description

This endpoint allows you to run JavaScript code in a secure sandbox environment. The code is executed using a secure code interpreter and returns both stdout and stderr logs.

Endpoint

Headers

  • Content-Type: application/json
  • Authorization: Bearer <API_KEY> (required)

Request Body

Responses

Success (200)

Returns the output logs from the executed JavaScript code.
  • Content-Type: application/json
  • X-RateLimit-Limit: The rate limit for the user.
  • X-RateLimit-Remaining: The remaining number of requests for the user.

Bad Request (400)

Returned if the request is missing required parameters.

Internal Server Error (500)

Returned if there’s an error during code execution.

Example Request

Example Response

Notes

  • This endpoint uses 50 credits per request.
  • Code execution timeout is set to 10 seconds
  • The code is executed in a secure sandbox environment
  • When parseJson is true, the system will attempt to parse stdout and stderr as JSON
  • You can install NPM packages by using the commands parameter e.g. npm install axios

Rate Limiting

Rate limit headers (X-RateLimit-Limit and X-RateLimit-Remaining) are included in the response to indicate the user’s current rate limit status.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request payload for sandboxed code execution.

code
string
required

Source code to execute inside the sandbox.

commands
string[]

Shell commands to run before executing the code.

parseJson
boolean

Attempt to parse stdout/stderr as JSON arrays.

requestSource
enum<string>

Optional identifier describing where the API request originated.

Available options:
API,
WEB,
MAKE_DOT_COM,
ZAPIER,
N8N,
PLAYGROUND,
DEFAULT_AUTOMATION,
AGENT_PREVIEW,
AGENT_LIVE,
AUTOPILOT,
STUDIO

Response

Execution results returned.

logs
object
required