Skip to main content
POST
code.sandbox.run

Authorizations

Authorization
string
header
required

API key: sk_live_…

Headers

Idempotency-Key
string
required

Required: this capability has an external effect.

Maximum string length: 255
Pramaan-Max-Price-Micro
string

Optional. The most this request may be priced at, in micro-USD (a whole number above 0). It replaces the capability's own price ceiling for this request, lower or higher. Sources that could cost more are left out; when none is left the answer is 400 with the lowest limit that would work.

Pattern: ^[1-9]\d{0,14}$

Body

application/json
ref
string
required

The ref returned by code.sandbox.create.

Pattern: ^(ref_[0-9A-HJKMNP-TV-Z]{26}|rh_[A-Za-z0-9_-]{24,1024})$
code
string
required

Source code to run in the sandbox.

Required string length: 1 - 65536
stdin
string

Text fed to the program's standard input.

Required string length: 1 - 65536
timeLimitSeconds
integer
default:10

Wall-clock cap for this run, 1 to 15 seconds. Default 10. The run is stopped at the cap and returns what it printed so far.

Required range: 1 <= x <= 15

Response

The result

status
enum<string>
required

How the run ended: completed, failed (non-zero exit or crash), timed_out, or compile_error.

Available options:
completed,
failed,
timed_out,
compile_error
stdout
string

What the code wrote to standard output, at most 65,536 characters.

stderr
string

What the code wrote to standard error, including compiler errors; at most 65,536 characters.

exitCode
integer

Process exit code; absent when no process exit was seen.

Required range: -9007199254740991 <= x <= 9007199254740991
signal
string

Signal that ended the process, e.g. SIGKILL.

durationSeconds
number

Wall-clock run time in seconds.

truncated
boolean

Present when stdout or stderr was cut to the cap.