Execute commands on a VPS via its agent

Run specific commands on your virtual server (VPS) through its agent. This endpoint returns a process ID (pid) used to retrieve the command's result via GET /api/vm/{vmid}/agent/exec.

VPS Services VM

Context

Where to get IDs / values

Workflow links

Produces

Path Parameters

vmid integer · min: 1 required Example: 10000

Unique vmid identifier

Headers

Accept Example
Content-Type Example

Body

required
application/json
command string required · Example: cd /ENBASE_repo && git pull && python migrations/run_migration.py && sudo systemctl res...

Responses

200
data object required
data.command string required · Example: cd /ENBASE_repo && git pull && python migrations/run_migration.py && sudo systemctl res...
data.message string required · Example: Command execution started

Human-readable message.

data.pid integer required · Example: 150476
data.success boolean required · Example: true

True for successful responses.

requestId string required · Example: 2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba

Unique request identifier (UUID).

success boolean required · Example: true

True for successful responses.

timestamp string required · Example: 2026-02-10T00:00:00.000Z

ISO 8601 timestamp (UTC).

400
code string required · Example: BAD_REQUEST

Machine-readable error code.

error string required · Example: Bad Request

HTTP status title (e.g. 'Bad Request').

message string required · Example: This command has been blocked for safety reasons

Human-readable message.

requestId string required · Example: 2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba

Unique request identifier (UUID).

timestamp string required · Example: 2026-02-10T00:00:00.000Z

ISO 8601 timestamp (UTC).

500
code string required · Example: INTERNAL_ERROR

Machine-readable error code.

error string required · Example: Internal Server Error

HTTP status title (e.g. 'Bad Request').

message string required · Example: Failed to execute command - no PID returned

Human-readable message.

requestId string required · Example: 2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba

Unique request identifier (UUID).

timestamp string required · Example: 2026-02-10T00:00:00.000Z

ISO 8601 timestamp (UTC).

POST https://cloud.hostup.se/api/vm/{vmid}/agent/exec
For AI assistants
cURL
curl -X POST "https://cloud.hostup.se/api/vm/10000/agent/exec" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "cd /ENBASE_repo && git pull && python migrations/run_migration.py && sudo systemctl restart enbase"
  }'
Response
{
  "success": true,
  "timestamp": "2026-02-10T00:00:00.000Z",
  "requestId": "2121ae20-bd9d-41e9-aeeb-5dd1dd1a24ba",
  "data": {
    "success": true,
    "pid": 150476,
    "message": "Command execution started",
    "command": "cd /ENBASE_repo && git pull && python migrations/run_migration.py && sudo systemctl restart enbase"
  }
}
Request Body Example 1
{
  "command": "cd /ENBASE_repo && git pull && python migrations/run_migration.py && sudo systemctl restart enbase"
}