Command Behavior

Understand exit codes, redirects, diagnostics, stdout, stderr, and script-friendly behavior.

Restish is designed for terminals and scripts. Output channels, exit codes, and verbose diagnostics are part of the interface.

Exit Codes

Restish uses a compact exit-code policy:

ResultExit codeNotes
Successful command, including final HTTP 2xx responses0Redirects are followed before the final status is evaluated.
Final HTTP 3xx response3Redirects are followed before the final status is evaluated.
Final HTTP 4xx response4Restish still writes the response body before exiting non-zero.
Final HTTP 5xx response5Restish still writes the response body before exiting non-zero.
Runtime failure1Network errors, TLS failures, config problems, auth failures, parse errors, formatter errors, and most plugin failures.
Usage error2Missing arguments, unknown commands, unknown flags, or invalid flag values before the request runs.
Interrupted with Ctrl-C / SIGINT130Matches the usual shell convention for interrupted processes.
Command plugin exit codeplugin-definedCommand plugins may return their own 0-255 exit code.

Inspect an error body without failing the shell command:

Browser preview

Edit the command and run it from your browser against the live docs API.

Ready

Use the same flag for structured problem responses when the error document is the data you need to inspect:

Browser preview

Edit the command and run it from your browser against the live docs API.

Ready

Add -o json when a script needs the error body as one JSON document.

Stdout And Stderr

Response output goes to stdout. Diagnostics, verbose request/response metadata, progress, and warnings go to stderr.

restish -v api.rest.sh/images/jpeg > dragonfly.jpg 2> headers.txt

Verbose Mode

restish -v api.rest.sh/headers
restish -vv api.rest.sh/headers

-v shows request and response headers plus the resolved config path, profile, auth state, input source, request body media type, response decode media type, filter language, output format, plugin invocations, and a compact pipeline summary when those details apply. -vv adds more TLS detail.

Redirects

Use redirect fixtures to inspect behavior:

restish api.rest.sh/redirect/2 -v
restish 'api.rest.sh/redirect-to?url=/get&status_code=307' -v

When auth or custom headers are involved, use verbose mode to confirm what is sent after redirects.

Timeouts

restish 'api.rest.sh/slow?delay=2s' --rsh-timeout 500ms

Timeouts are useful in scripts where a hanging request is worse than a clear failure.

Silent Mode

Use -S when only the exit code matters:

restish -S api.rest.sh/status/204