Execute Command
Execute a command on a specific Machine and return a JSON response containing stdout, stderr, exit_code, and exit_signal.
A completed command returns HTTP 200, including when the command exits unsuccessfully.
HTTP 412 is returned when the Machine is not running. On Machines without
containers, it can also indicate an error before or during command execution.
For example, the executable may be missing or lack execute permission. The
error field describes the failure.
HTTP 413 responses include a status field identifying the size limit that was
exceeded:
exec_request_too_large: the Machine rejected the exec request as too large. The error message isexec request rejected: payload too large. The limit applies to the encoded request sent to the Machine, which can differ in size from the public API request.exec_output_too_large: the command ran, but its output could not be returned because it exceeded the maximum allowed response size after JSON encoding.
Authorizations
A Fly API token with access to the requested organization or resource. Send it as Authorization: Bearer <Fly API token>.
Body
Request body
Command line to run, split into arguments like a shell would. Takes precedence over
command.
Deprecated: use command.
Command to run, as the program followed by its arguments. It is run directly, not by a shell.
Name of the container to run the command in, for Machines with containers.
Run the command in the Machine's own namespace instead of in a container. Mutually
exclusive with container.
Data to write to the command's standard input.
How long to let the command run, in seconds. Defaults to 10; at most 600.