SSH Execute Command
Execute a one-shot SSH command on a VPS and return stdout, stderr, and exit code.
Request
POST /api/v1/vps/{id}/exec
Required scope: vps:manage
Path Parameters
| Parameter |
Type |
Description |
id |
string |
The VPS ID |
Headers
| Header |
Required |
Value |
Authorization |
Yes |
Bearer YOUR_API_KEY |
Content-Type |
Yes |
application/json |
Request Body
| Field |
Type |
Required |
Description |
command |
string |
Yes |
Shell command to execute (max 8192 characters) |
timeout |
number |
No |
Timeout in seconds (1–300, default 30) |
{
"command": "uptime",
"timeout": 10
}
Response
{
"data": {
"exitCode": 0,
"stdout": " 14:32:01 up 12 days, 3:45, 0 users, load average: 0.00, 0.01, 0.05\n",
"stderr": "",
"durationMs": 142
}
}
Response Fields
| Field |
Type |
Description |
exitCode |
number |
The exit code of the command (0 = success) |
stdout |
string |
Standard output |
stderr |
string |
Standard error output |
durationMs |
number |
Execution time in milliseconds |
Errors
| Status |
Code |
Description |
| 400 |
INVALID_COMMAND |
Command is missing or not a string |
| 400 |
COMMAND_TOO_LONG |
Command exceeds 8192 characters |
| 400 |
INVALID_TIMEOUT |
Timeout is out of range (1–300) |
| 404 |
NOT_FOUND |
VPS not found or not accessible |
| 408 |
COMMAND_TIMEOUT |
Command timed out |
| 502 |
SSH_AUTH_ERROR |
SSH authentication failed |
| 502 |
SSH_CONNECTION_ERROR |
Could not connect to VPS |
Example
curl -X POST "https://site.quest/api/v1/vps/699cdea2ab57a244bb5273fd/exec" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"command": "uptime", "timeout": 10}'
MCP
This action is also available via the exec_command MCP tool.