Skip to main content
    Ivy Biosciences Docs/Call the platform/API/Reference/Reference/Sandbox/POST /v1/sandbox/{chatId}/exec

    POST /v1/sandbox/{chatId}/exec

    Run a shell command — Runs a shell command in your chat's isolated code sandbox and returns its output.

    Auth: required. Send an ivy_ API key (Authorization: Bearer ivy_… or X-Ivy-Api-Key), a Clerk session JWT (Authorization: Bearer …) or the Clerk __session cookie (browser sessions). See Authentication.

    Runs a shell command in your chat's isolated code sandbox and returns its output. The working directory defaults to /workspace and the timeout defaults to 30 seconds; requested timeouts above 120 seconds are clamped to 120.

    Returns 503 SANDBOX_NOT_READY while the sandbox is still starting; retry after the Retry-After interval.

    Request

    Path parameters

    chatIdstring

    ID of the chat that owns the sandbox

    Request body

    commandstring

    Shell command to run

    timeoutinteger

    Time budget in seconds. Defaults to 30; values above 120 are clamped to 120.

    workdirstring

    Working directory. Defaults to /workspace.

    Responses

    200 OK

    Command finished (a non-zero exitCode is still HTTP 200)

    Response shape:

    stdoutstring
    stderrstring
    exitCodeinteger

    Process exit code; 0 means success

    duration_msinteger

    Run time in milliseconds

    400 Bad Request

    Invalid request

    Response shape: object

    401 Unauthorized

    Authentication required

    Response shape: object

    403 Forbidden

    You do not own this chat, or your key's project scope excludes it

    Response shape: object

    404 Not Found

    Resource not found

    Response shape: object

    429 Too Many Requests

    Rate limit exceeded

    Response shape: object

    502 Bad Gateway

    The sandbox returned a malformed response

    Response shape: object

    503 Service Unavailable

    The sandbox is still starting; retry shortly

    Response shape: object

    504 Gateway Timeout

    The command exceeded its time budget

    Response shape: object

    curl -X POST 'https://ivybiosciences.com/api/v1/sandbox/{chatId}/exec' \
      -H "Authorization: Bearer $IVY_API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
      "command": ""
    }'

    Was this page helpful?

    Loading...