Execute JavaScript code.
POST/code/javascript
This endpoint runs JavaScript code in a Linux sandbox using the Bun JavaScript runtime. You can return data from the code using a top-level return
statement or by setting the global result
variable. Logging something to the console has no effect. To import dependencies, use the require
function. All dependencies will be automatically downloaded and installed for you, with the exception of native system dependencies. There is a time limit of 180s and a memory limit of 512MB applied to your code, which also includes the dependency download process. One execution of this module costs 50 credits.
Request
Header Parameters
The API key that can be retrieved from 0codekit.com.
- application/json
Bodyrequired
The JavaScript code that will be executed.
const _ = require('lodash');
return { data: _.chunk(['a', 'b', 'c', 'd'], 2) };
The system dependencies your JavaScript code requires. These will be installed using apk, the Alpine Package manager.
[]
Responses
- 200
- 400
Success
- application/json
- Schema
Schema
Bad Request
- application/json
- Schema
- Example (auto)
Schema
{
"status": 0,
"errorMessage": "string"
}