Skip to main content
POST
/
v1
/
agents
/
sandboxes
/
{sandbox_id}
/
code
/
run
Run Code
curl --request POST \
  --url https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/code/run \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "timeout": 30
}
'
{
  "logs": {
    "stdout": "<string>",
    "stderr": "<string>"
  },
  "error": "<string>",
  "execution_time_ms": 123
}

Authorizations

Authorization
string
header
required

API key authentication. Get your API key from the Gravix Layer Dashboard.

Path Parameters

sandbox_id
string
required

Sandbox ID

Body

application/json
code
string
required

Code to execute

Example: print('Hello, world!')

timeout
integer
default:30

Execution timeout in seconds (default: 30s)

Response

200 - application/json

Execution result

logs
object
error
string | null
execution_time_ms
integer