Skip to main content
POST
/
javascript
Execute JavaScript
curl --request POST \
  --url https://{deployment}/api/v1/javascript \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data @- <<EOF
{
  "code": "const x = args[0] || 'world'; `hello ${x}`",
  "args": [
    "mmk"
  ],
  "timeout": 5000
}
EOF
{
  "success": true,
  "data": {
    "result": "hello mmk"
  }
}

Authorizations

X-API-KEY
string
header
required

Your deployment's API key (MMK_API_KEY). Routes that accept OAuth2 also allow Authorization: Bearer <token>.

Body

application/json
code
string
required

JavaScript source to run. Max 10 KB.

Maximum string length: 10240
timeout
integer
default:5000

Timeout in milliseconds (max 10000).

Required range: x <= 10000
args
string[]

Values exposed to the script as the args array.

Response

Execution result

success
boolean
data
object