CLI
The rq CLI is the command-line interface for working with .rq files. It lets you discover and run requests, inspect environments and authentication configurations, and is the main way to integrate rq into scripts and CI.
If you haven’t installed rq yet, see the INSTALLATION guide first.
At a high level:
rqwithout subcommands runs a request (request run).rq requestmanages requests (list, show, run).rq envlists environments found in.rqfiles.rq authlists and inspects auth providers.
All subcommands accept a global -d, --debug flag to enable debug logging.
Global usage
rq [OPTIONS] [COMMAND]
Commands:
env– Manage environments.auth– Manage authentication.request– Manage requests.
If you call rq without a subcommand, it behaves like rq request run with the same arguments.
Global options:
-d, --debug– Enable debug logging.-V, --version– Print CLI version.-h, --help– Show help.
Unless otherwise noted, most commands share these common flags:
-s, --source <SOURCE>– Path to a.rqfile or directory (defaults to current directory).-o, --output <OUTPUT>– Output format:textorjson(defaults totext, case-insensitive).
Managing requests: rq request
The request subcommand lets you list, inspect, and run requests defined in .rq files.
rq request [OPTIONS] <COMMAND>
Commands:
list– List requests.show– Show request details.run– Run a request.
All rq request commands accept -d, --debug.
rq request list
List all requests discovered under a file or directory.
rq request list [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- In
textmode, prints a human-readable list with entries likename: basic,file: tests/request/run/input/basic.rq. - In
jsonmode, prints a JSON array; each item contains at leastnameandfile, and requests defined inside endpoints include endpoint context (for exampleendpoint: api,name: api/get). - If no requests are found, prints a friendly message (e.g.
No requests found).
Example:
rq request list -s tests/request/run/input
rq request list -s tests/request/run/input -o json
rq request show
Show detailed information about a single request.
rq request show [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the request to show (required). If the request is defined inside an endpoint, use<endpoint>/<request>(for exampleusers/list).-e, --env <ENVIRONMENT>– Environment name to resolve variables and env-specific settings.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Resolves the specified request (including endpoint context if applicable).
- In
textmode, prints fields like URL, method, headers, optional body, and associated auth provider. - In
jsonmode, prints a JSON object containingRequest,URL,Method,Headers, optionalBody, and optionalAuthmetadata.
Example:
rq request show -s tests/request/run/input -n basic
rq request show -s tests/request/run/input -n basic -e local -o json
rq request run
Run one or more requests from .rq files.
rq request run [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the request to run. If omitted and multiple requests exist, the CLI will usually fail and ask you to be explicit. If the request is defined inside an endpoint, use<endpoint>/<request>(for exampleusers/list).-e, --env <ENVIRONMENT>– Environment name.-v, --variable <NAME=VALUE>– Override variables at runtime (can be provided multiple times).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Uses the same variable precedence described in the language definition, with
-v NAME=VALUEproviding the highest-precedence overrides. - In
textmode, prints the HTTP status and a formatted view of the response. - In
jsonmode, prints a JSON structure with the full execution result(s), including response status, headers, body, and elapsed time in milliseconds.
Examples:
# Run a single request in a file
rq request run -s tests/request/run/input/basic.rq -n basic
# Run using an environment and a CLI variable override
rq request run -s tests/request/run/fixtures/cli_override/override.rq -e local -v color=red
# Default invocation (same as `rq request run`)
rq -s tests/request/run/input/basic.rq -n basic
Error handling:
- If
--sourcepoints to a non-existent path, the command exits with code2and printsPath does not exist. - If a variable override does not follow
NAME=VALUE, or the variable name is invalid, the command fails with clear validation messages.
Managing environments: rq env
The env subcommand helps you discover available environments in your .rq files.
rq env [OPTIONS] <COMMAND>
Commands:
list– List environments.
All rq env commands accept -d, --debug.
rq env list
List environment names defined across .rq files.
rq env list [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Recursively scans the given path for
.rqfiles and collects all environment names (fromenv <name> { ... }blocks). - In
textmode, prints a short list prefixed withEnvironments found:or a message likeNo environments foundfor empty results. - In
jsonmode, prints a JSON array of environment names.
Examples:
rq env list -s tests/env/list/input/simple.rq
rq env list -s tests/env/list/input -o json
# Using the current directory as source
cd tests/request/run/input
rq env list
Error handling:
- A non-existent
--sourcepath causes the command to exit with code2and an error mentioningPath does not exist.
Managing auth providers: rq auth
The auth subcommand lets you list and inspect authentication configurations declared in your .rq files.
rq auth [OPTIONS] <COMMAND>
Commands:
list– List auth configurations.show– Show details for a specific auth configuration.
All rq auth commands accept -d, --debug.
rq auth list
List all auth providers defined across .rq files.
rq auth list [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- In
textmode, prints a list of auth provider names (for examplebearer_auth,github_oauth). - In
jsonmode, prints a JSON array of provider names. - For empty directories, prints
No auth configurations found.
Examples:
rq auth list -s tests/request/run/input
rq auth list -s tests/request/run/input -o json
rq auth show
Show the full configuration of a single auth provider.
rq auth show [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the auth configuration (required).-e, --env <ENVIRONMENT>– Environment name to resolve environment-specific overrides for that auth provider.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Resolves the auth provider (e.g.
bearer_auth,github_oauth) and shows its type and fields. - In
textmode, prints a human-readable summary like:Auth Configuration: bearer_authType: bearertoken: ...
- In
jsonmode, prints an object with keys:Auth Configuration– Provider name.Type– Provider type (bearer,oauth2_authorization_code, etc.).Environment– Optional, when-e/--envis provided.Fields– Map of field names to values (for exampleclient_id,authorization_url,token_url).
Examples:
rq auth show -s tests/request/run/input -n bearer_auth
rq auth show -s tests/request/run/input -n github_oauth -o json
rq auth show -s tests/request/run/input -n local_auth -e local
Error handling:
- If the named auth provider does not exist, the command fails with an error mentioning that the auth configuration was not found.
Output formats
Across request list, request show, request run, env list and auth list/show, the -o, --output flag controls how results are printed:
text– Human-readable, stable but meant for terminals.json– Machine-readable, designed for scripting and automated checks.
The value is case-insensitive, so --output json and --output JSON are equivalent. Invalid values cause a clear clap error indicating the allowed values.
When integrating rq into other tools or CI, prefer --output json so you can parse responses reliably.