Conway

Execution

Execute commands and code in sandboxes.

Run Command

POST /v1/sandboxes/:id/exec

Execute a shell command in a sandbox.

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe sandbox ID

Request Body

ParameterTypeRequiredDescription
commandstringYesThe shell command to execute

Example

curl -X POST https://api.conway.tech/v1/sandboxes/sbx_abc123/exec \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "ls -l /home/ubuntu"
  }'
const response = await fetch(
  "https://api.conway.tech/v1/sandboxes/sbx_abc123/exec",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer your-api-key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      command: "ls -l /home/ubuntu",
    }),
  }
);

Response

{
  "stdout": "total 0\n",
  "stderr": "",
  "exitCode": 0
}

Run Code

POST /v1/sandboxes/:id/code

Execute a block of code in a sandbox.

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe sandbox ID

Request Body

ParameterTypeRequiredDescription
codestringYesThe code to execute
languagestringNoLanguage of the code (e.g., python, javascript). Defaults to the sandbox's runtime language.

Example

curl -X POST https://api.conway.tech/v1/sandboxes/sbx_abc123/code \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(\"Hello from Conway!\")"
  }'
const response = await fetch(
  "https://api.conway.tech/v1/sandboxes/sbx_abc123/code",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer your-api-key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      code: 'print("Hello from Conway!")',
    }),
  }
);

Response

{
  "result": "Hello from Conway!\n",
  "exitCode": 0
}