Command Options
Bruno CLI provides a variety of command options to help you customize your API testing and execution process. These options allow you to specify environments, configure reports, handle security, and much more. Below is a comprehensive list of available options:
Bruno version
To check the current version of your Bruno CLI installation, use the following command:
bru --version
This will display the version number of the Bruno CLI you have installed. It’s a helpful command for ensuring you’re working with the latest version or for troubleshooting version-specific issues.
Getting Started
Navigate to the directory where your API collection resides, and run the following command:
bru run
This will run all the requests in your collection. If you want to run a single request, specify its filename:
bru run request.bru
Running Requests in a Folder
To run all the requests within a folder, use:
bru run folder
Using Environments
If you need to use a specific environment, you can pass it with the --env
option:
bru run folder --env Local
Passing Environment Variables
Variables marked as secrets in Bruno app are not accessible via the CLI. Pass them directly as command-line arguments.
bru run folder --env Local --env-var JWT_TOKEN=1234
Multiple Environment Variables
You can override multiple environment variables by using additional --env-var
flags:
bru run folder --env Local --env-var JWT_TOKEN=1234 --env-var API_KEY=abcd1234
Each --env-var
flag adds or overrides a single environment variable, and you can chain as many as needed.
Adding Delay
If you need to add a delay between requests during the execution of your API collection, you can use the --delay
option.
Example:
bru run --delay 1000
Using Client Certificates for API Requests
If your API requests require client certificates for authentication, you can specify using the --client-cert-config
option. The configuration should be provided in a JSON file. Here’s an example of how to use this option:
bru run folder --client-cert-config /path/to/client-cert-config.json
The client-cert-config.json file should contain the following fields:
{
"enabled": true,
"certs": [
{
"domain": "usebruno.com",
"type": "cert",
"certFilePath": "certs/server_1.crt",
"keyFilePath": "private/server_1.key",
"passphrase": "Iu$eBrun0_#Secure!"
},
{
"domain": "the-example.com",
"type": "pfx",
"pfxFilePath": "pfx/server_3.pfx",
"passphrase": "L!ghT_Y@g@mi_2024!"
}
]
}
Disabling Proxies
If you need to bypass all proxy settings (both collection-defined and system proxies) when running requests, you can use the --noproxy
flag:
bru run --noproxy
The flag completely disables all proxy settings for that particular CLI run.
Importing OpenAPI Specifications
Bruno CLI allows you to import OpenAPI specifications directly into Bruno collection from the command line, which can be integrated into CI/CD pipelines whenever API changes are committed.
Option 1: Import to Bruno Collection
This will import the OpenAPI specification (supports both YAML and JSON formats) and generate a Bruno collection in the specified output directory.
bru import openapi --source <your-openapi.yaml> --output <preferred-location> --collection-name "Petstore API"
Where:
<your-openapi.yaml>
: Path to your OpenAPI specification file (can be either YAML or JSON format)<preferred-location>
: Directory where you want to save the collection
Option 2: Import to Single JSON File
This will import the OpenAPI specification and generate a Bruno collection as a single JSON file at the specified location.
bru import openapi --source <your-openapi.yaml> --output-file <preferred-location>.json --collection-name "Petstore API"
Where:
<your-openapi.yaml>
: Path to your OpenAPI specification file (can be either YAML or JSON format)<preferred-location>
: Base path and filename for your JSON output
Options
Option | Details |
---|---|
-h , --help | Show help |
--version | Show version number |
-r | Indicates a recursive run (default: false) |
--cacert [string] | CA certificate to verify peer against |
--ignore-truststore | The specified custom CA certificate (—cacert) will be used exclusively and the default truststore is ignored [boolean] [default: false] |
--disable-cookies | Automatically save and sent cookies with requests [boolean] [default: false] |
--env [string] | Specify environment to run with |
--env-var [string] | Overwrite a single environment variable, multiple usages possible |
--sandbox [string] | Javascript sandbox to use; available sandboxes are “developer” (default) or “safe” [string] [default: “developer”] |
-o , --output [string] | [DEPRECATED] Path to write file results to. Use reporter options instead |
-f , --format [string] | [DEPRECATED] Format of the file results. Use reporter options instead |
--reporter-json [string] | Path to generate a JSON report |
--reporter-junit [string] | Path to generate a JUnit report |
--reporter-html [string] | Path to generate an HTML report |
--insecure | Allow insecure server connections |
--tests-only | Only run requests that have tests or active assertions |
--bail | Stop execution after a failure of a request, test, or assertion |
--csv-file-path | CSV file to run the collection with |
--reporter-skip-all-headers | Skip all headers in the report [boolean] [default: false] |
--reporter-skip-headers | Skip specific headers in the report [array] [default: []] |
--client-cert-config | Path to the Client certificate config file used for securing the connection |
--delay [number] | Delay between each requests (in milliseconds) |
--noproxy | Disable all proxy settings (both collection-defined and system proxies) [boolean] [default: false] |
--source [string] | Path to the OpenAPI specification file (YAML or JSON) |
--output-file [string] | Output file to export as Bruno collection in JSON format |
--collection-name [string] | Name for the imported collection |
Demo
Support
If you encounter any issues or have any feedback or suggestions, please raise them on our GitHub repository