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 and inspects environments found in.rqfiles.rq authlists and inspects auth providers.rq eplists and inspects endpoints.rq varlists and inspects variables.rq checkvalidates.rqfiles without executing requests.
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.ep– Manage endpoints.var– Manage variables.check– Validate.rqfiles.
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.
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).
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>or<endpoint>.<request>(for exampleusers/listorusers.list).-e, --env <ENVIRONMENT>– Environment name to resolve variables and env-specific settings.--no-var-interpolation– Skip variable interpolation and show raw values.-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>or<endpoint>.<request>(for exampleusers/listorusers.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.show– Show environment details.
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.
rq env show
Show details for a single environment.
rq env show [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the environment to show (required).--no-var-interpolation– Skip variable interpolation and show raw values.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Examples:
rq env show -s tests/env/list/input/simple.rq -n local
rq env show -s tests/env/list/input/simple.rq -n local -o json
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.
Managing endpoints: rq ep
The ep subcommand lets you discover and inspect endpoints defined in .rq files.
rq ep [OPTIONS] <COMMAND>
Commands:
list– List endpoints.show– Show endpoint details.refs– Find all references to an endpoint.
All rq ep commands accept -d, --debug.
rq ep list
List all endpoints discovered under a file or directory.
rq ep list [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- In
textmode, printsEndpoints found:followed by endpoint names, orNo endpoints found in .rq files. - In
jsonmode, prints a JSON array of endpoint entries.
Examples:
rq ep list -s src/
rq ep list -s src/ -o json
rq ep show
Show details for a single endpoint.
rq ep show [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the endpoint to show (required).--no-var-interpolation– Skip variable interpolation and show raw values.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Examples:
rq ep show -n users
rq ep show -n users -o json
rq ep refs
Find all references to an endpoint across .rq files.
rq ep refs [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the endpoint to find references for (required).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Prints
References found:followed by locations, orNo references found.
Examples:
rq ep refs -n users
rq ep refs -n users -o json
Managing variables: rq var
The var subcommand lets you discover and inspect variables defined in .rq files.
rq var [OPTIONS] <COMMAND>
Commands:
list– List variables.show– Show variable details.refs– Find all references to a variable.
All rq var commands accept -d, --debug.
rq var list
List all variables discovered under a file or directory.
rq var list [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-e, --env <ENVIRONMENT>– Environment name to filter environment-specific variables.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- In
textmode, printsVariables found:followed by variable names, orNo variables found in .rq files. - In
jsonmode, prints a JSON array of variable entries.
Examples:
rq var list -s src/
rq var list -s src/ -e local -o json
rq var show
Show details for a single variable.
rq var show [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the variable to show (required).-e, --env <ENVIRONMENT>– Environment name to resolve environment-specific values.--no-var-interpolation– Skip variable interpolation and show raw values.-o, --output <OUTPUT>– Output format:textorjson(default:text).
Examples:
rq var show -n base_url
rq var show -n base_url -e local -o json
rq var refs
Find all references to a variable across .rq files.
rq var refs [OPTIONS] --name <NAME>
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-n, --name <NAME>– Name of the variable to find references for (required).-o, --output <OUTPUT>– Output format:textorjson(default:text).
Behavior:
- Prints
References found:followed by locations, orNo references found.
Examples:
rq var refs -n base_url
rq var refs -n base_url -o json
Validating files: rq check
Parse and validate .rq files without executing any requests.
rq check [OPTIONS]
Options:
-s, --source <SOURCE>– Path to the.rqfile or directory (default:.).-e, --env <ENVIRONMENT>– Environment name to use for variable resolution.
Behavior:
- Always outputs JSON with a single
errorsarray. - Each error entry contains
file,line,column, andmessage. - If no errors are found,
errorsis an empty array. - Exits with code
1if any errors are found; exits with code0on success.
Example:
rq check -s src/
rq check -s src/api.rq -e local
Example output (no errors):
{
"errors": []
}
Example output (with errors):
{
"errors": [
{
"file": "src/api.rq",
"line": 5,
"column": 3,
"message": "unexpected token"
}
]
}
Output formats
Across all commands, the -o, --output flag controls how results are printed (except rq check, which always outputs JSON):
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.