Run a script
Runs JavaScript on the account’s computer with bun, with no agent turn, as the key’s owner (account admins only; team keys cannot). tools.<namespace>.<function>(args) calls the Crevio API and connected integrations, and the script’s last expression is its result. args reach the script as the global args (and process.argv). Files written into the directory named by the global outputDir (20 at most, 50 MB each) come back as artifacts. A call that needs approval does not run: it resolves to {pending: true, draft_id, approval}, the script carries on, and the run lists it in approvals and pending_approval_ids. Approving it (POST /approvals//approve) runs that one frozen call, never the script again. 200 when it finished within wait_seconds, 202 otherwise: poll GET /script_runs/. At most 4 runs in flight per user and 8 per account (429). Needs the scripts scope.
Authorizations
API key in the format: Bearer {api_token}
Headers
Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.
255Body
The JavaScript to run.
100000Values the script reads from the global args.
162000How long the script may run.
1 <= x <= 600Hold the response until the script finishes, up to this many seconds.
0 <= x <= 90Response
The script finished within wait_seconds
queued, in_progress, completed, failed, cancelled, timed_out The script's last expression, as JSON.
What the script printed: its start and end when long, with the cut marked.
Every tool call the script made, in order: {role, status, read_only, error_code, approval_id}. A 202 call did not run and names its approval.
What the script's gated calls froze, as each stands now. Approving one runs that call, never the script again.
Approvals still waiting for a decision: POST /approvals/{id}/approve or /deny.
Files the script wrote to outputDir.

