Everstack
API ReferenceSandboxGet Command Status

Get Background Command Status

GET/v1/sandbox/{sandbox_id}/command/status/{cmd_id}
GET/v1/sandbox/{'{sandbox_id}'}/command/status/{'{cmd_id}'}

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Description

Retrieves the current status of a background command that was launched with background: true. Use this endpoint to poll for completion and obtain the exit code once the command finishes.

Path Parameters

ParameterTypeRequiredDescription
sandbox_idstringYesSandbox ID or name
cmd_idstringYesID of the background command to query

Responses

200 Success

PropertyTypeDescription
idstringUnique ID of the background command
sandbox_idstringID of the sandbox the command is running in
commandstringThe shell command that was executed
cwdstringWorking directory the command was run from
runningbooleanWhether the command is currently running
exit_codeinteger | nullExit code of the command. null while still running
started_atstringISO 8601 timestamp when the command started
finished_atstring | nullISO 8601 timestamp when the command finished. null while still running

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

Request

curl -X GET "https://{instance}.{region}.everstack.ai/v1/sandbox/{sandbox_id}/command/status/{cmd_id}" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
const sandboxId = "your-sandbox-id";
const cmdId = "cmd_abc123";
const response = await fetch(
  `https://{instance}.{region}.everstack.ai/v1/sandbox/${sandboxId}/command/status/${cmdId}`,
  {
    method: "GET",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
  }
);
const data = await response.json();
import requests

sandbox_id = "your-sandbox-id"
cmd_id = "cmd_abc123"
response = requests.get(
    f"https://{instance}.{region}.everstack.ai/v1/sandbox/{sandbox_id}/command/status/{cmd_id}",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
)
data = response.json()

Response

{
  "id": "string",
  "sandbox_id": "string",
  "command": "string",
  "cwd": "string",
  "running": true,
  "exit_code": null,
  "started_at": "string",
  "finished_at": null
}
{
  "code": 0,
  "message": "string",
  "details": [
    {
      "@type": "string"
    }
  ]
}