machines

Execute a code snippet.

Changed on

Runs a code snippet with the matching interpreter inside the machine and returns the result. Requires the machine:exec scope.

post/v1/machines/{id}/code

Request

Path parameters

idstring required

Machine id

Request body

codestring required
cwdstring nullable
envobject
languagestring required
timeoutSecondsinteger nullable
userstring nullable

Run as this user (image user name or uid[:gid]), overriding the image's USER.

Response

Code result

durationMsinteger required
exitCodeinteger required
machineIdstring required
stderrstring required

Lossy UTF-8 stderr, capped. Prefer stderrB64.

stderrB64string byte

Byte-exact stderr (base64), binary-safe and NOT truncated. Serializes as stderrB64.

stderrTruncatedboolean
stdoutstring required

Lossy UTF-8 stdout, capped (see stdout_truncated). Kept for old clients and log views; prefer stdoutB64 for byte-exact, untruncated output.

stdoutB64string byte

Byte-exact stdout (base64), binary-safe and NOT truncated. Preferred by clients that need fidelity (smol cloud exec). rename_all=camelCase serializes this as stdoutB64.

stdoutTruncatedboolean
userstring nullable

The user the command was run as, echoed back when the request set one. A client that asked for a user and does not see it here is talking to a control plane that predates the field and dropped it — which the client must treat as an error, never as "ran as the default account".

Changes

    • info

      the endpoint scheme security ApiKeyAuth was added to the API

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status