Endpoints
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 5 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.