Skip to main content
Use Run a shell line with an existing workspace. Set 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. Set stream=true and use curl --no-buffer to display the response as it arrives:
The response has content type application/x-ndjson. Each line is a JSON record. Output records identify stdout or stderr and carry base64-encoded data:
Decode each output record’s 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 accepts multipart/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.
The command sorts the input and returns a\nb\n in stdout. See Run a shell line for the complete request fields and response schemas.