ReferenceAPI

Execute a command

Execute a command in the primary container and wait for the process to exit.

POST https://api.nevia.cloud/v1/computers/{cmp}/exec
curl -X POST "https://api.nevia.cloud/v1/computers/01d4cnjk3xg90y576w8y6t4gdwm/exec" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entrypoint": "",
    "argv": [
      "sh",
      "-c",
      "echo hello"
    ]
  }'
{
  "result": {
    "exit_code": 0,
    "signal": 0,
    "stdout": "hello\n",
    "stderr": ""
  },
  "operations": [
    "01d4cnjm89yk0r3xtv80dy0x7by"
  ]
}

Authorization

bearerAuth
Authorization Bearer <token>

Send the token in the Authorization: Bearer <token> header. See Authenticate.

In: header

Path Parameters

cmp* string

Computer id: 27 lowercase letters and digits.

Match ^[A-Za-z0-9_-]{1,64}$

Header Parameters

Accept? string

text/event-stream for SSE output, else JSON

Request Body

application/json

Run a command in the primary container (empty runs the image's own command)

Behavior

argv goes to the image ENTRYPOINT, or the image CMD runs when it is empty. entrypoint replaces the ENTRYPOINT, and "" clears it so a command of your own runs as given.

The command gets the computer's stored env, with env over it. Values resolve at call time, so secrets and variables take their current values.

There is no shell unless argv names one, and no cwd or timeout. Closing the request does not stop the process. An abandoned command runs until it exits.

Each argv item is at most 128 KiB of UTF-8, and the whole array at most 256 KiB as JSON.

For JSON, a successful command returns HTTP 200 with result. A nonzero exit or signal returns HTTP 400 command_failed: details includes exit_code, signal, stdout and stderr. The message uses stderr with trailing whitespace removed, or describes the exit code or signal when stderr is blank. Each output stream is buffered up to 1 MiB. Larger output requires SSE. A command failure means the process ran. Repeating the request runs it again.

With Accept: text/event-stream, stdout and stderr events carry UTF-8 chunks as JSON strings without an output cap. Every completed command ends with an exit event carrying {exit_code, signal}, including nonzero exits and signals. Inspect those fields to determine command success. A startup or transport failure after the stream opens instead arrives as an error event: the error envelope plus status, the HTTP status it would have had. The SSE response itself is HTTP 200.

A command that cannot start is distinct from command_failed: invalid startup input uses validation_failed. An internal startup failure uses command_start_failed.

Exec is an untracked session. No Idempotency-Key is used. Every call runs the command.

Response

application/json

A successful command's buffered result, or an SSE stream.