Skip to Content
homemade
Dashboard

Run a command

POST
/api/vms/{vmId}/exec

Runs one command in a running VM as its user, with /bin/sh -lc, and answers its exit code and output. It opens no terminal. Use ?stream=1 for commands that run longer than about 90 seconds.

Authorization

apiKey
headerAuthorizationBearer <hmk_…>

An API key from the dashboard or homemade api-key create.

Path Parameters

vmId*string

Query Parameters

stream?string
Value in"0""1""false""true"

Request Body

application/json
  1. body
command*string
Length1 <= length <= 65536
cwd?string
Length1 <= length <= 4096
env?
timeoutMs?integer
Range0 < value <= 600000
Default60000

Response Body

The finished command. With ?stream=1: one JSON frame per line as it runs (output, keepalive, then exit or error).

  1. response
durationMs*integer
Range0 <= value <= 9007199254740991
exitCode*|null
stderr*string
stderrTruncated*boolean
stdout*string
stdoutTruncated*boolean
timedOut*boolean
Example Request
curl -X POST 'https://api.homemade.dev/api/vms/string/exec' \  -H 'Content-Type: application/json' \  -d '{  "command": "string"}'
Example Response
{  "durationMs": 0,  "exitCode": -9007199254740991,  "stderr": "string",  "stderrTruncated": true,  "stdout": "string",  "stdoutTruncated": true,  "timedOut": true}