API Documentation

Execute Command

Run a one-shot shell command as the webspace's unprivileged system user (ws_<slug>). Working directory is ~/. Cgroup limits apply.

Required scope: webspace:manage

Headers

Header Required Value
Authorization Yes Bearer YOUR_API_KEY
Content-Type Yes application/json

Request Body

Parameter Required Description
command Yes Shell command (max 8192 chars).
timeout No Timeout in seconds (1–300, default 30).

Response

{
  "data": {
    "exitCode": 0,
    "stdout": "Linux node-bf015 6.6.20-cloud-amd64 ...\n",
    "stderr": "",
    "durationMs": 142,
    "truncated": false
  }
}

Response Fields

Field Type Description
truncated boolean true if stdout/stderr was capped at 2 MB.

Error Responses

Status Code Description
400 INVALID_COMMAND command is missing or not a string.
400 COMMAND_TOO_LONG Command exceeds 8192 characters.
408 COMMAND_TIMEOUT Command exceeded the requested timeout.
502 SSH_CONN_ERROR Could not connect to the webspace node.

Example

curl -X POST https://hosting.site.quest/api/v1/webspaces/69e80ac1.../exec \
  -H "Authorization: Bearer sq_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "command": "ls -la public_html", "timeout": 10 }'

MCP

This action is also available via the webspace_exec MCP tool.