MIRAGE_AUTH_TOKEN to your server’s configured token, or
omit the authorization header in local mode without a token.
Stream command output
The server supports streaming shell output. Setstream=true and use
curl --no-buffer to display the response as it arrives:
application/x-ndjson. Each line is a JSON record.
Output records identify stdout or stderr and carry base64-encoded data:
data to display the bytes. The output example decodes
to hello\n on stdout. Records labeled stderr carry stderr bytes in the same format.
Read through the final record:
A stream without a final status record was interrupted. HTTP
200 alone does not
mean the shell command succeeded. Closing the request cancels the running line.
Streaming cannot be combined with explain.
The server includes line_id in the result. Use it to get the line record.
Send stdin
The server acceptsmultipart/form-data with a JSON request part followed by
a stdin part. It accepts up to 64 MiB of input and supplies the bytes to the command
as they arrive.
a\nb\n in stdout.
Write to a running command
Astdin part is one upload. To keep sending input after the line starts, from
any request, set open_stdin and stream=true. The first record names the line:
A write waits while the buffer is full, so a command that reads slowly holds its
writer back. Send one write at a time and wait for its answer, to keep the bytes
in order. Total input has no limit.
open_stdin needs stream=true and takes no
stdin part. Closing the streaming request cancels the line.
See Run shell command for the complete
request fields and response schemas.