Skip to main content
Bruno CLI allows you to run your API collections with ease, either by directly executing requests or using external data sources. This guide explains how to run entire collections, specific folders, and how to use data sources like CSV and JSON files to drive your API tests. For the full reference of every flag used below, see Command Options.
v3.0.0 Breaking Change Starting from Bruno CLI v3.0.0, the default runtime mode is Safe Mode. If your collection requires Developer Mode features (external npm packages, filesystem access), pass the --sandbox=developer flag: bru run --sandbox=developer

Basic Collection Execution

To run an entire collection, navigate to your collection directory and use the run command:
copy

Running a Folder within a Collection

You can run all the requests within a specific folder by specifying the folder name:
copy
For example, to run all requests in the users folder:
copy

Running a Collection with a CSV File

If you need to run a collection using data from a CSV file, specify the path to the file with the --csv-file-path option:
copy
This will execute the collection once for each row in the CSV file, with each row’s data available as variables in your requests.

Running a Collection with a JSON File

To run a collection using data from a JSON file, provide the file path using the --json-file-path option:
copy

Running a Collection Multiple Times

You can run a collection multiple times in a single command using the --iteration-count flag:
copy
This will execute the collection twice. This is useful for load testing or when you need to repeat the same set of requests multiple times.

Running a Collection with Environments

You can run a collection using environment variables from either a .bru file or a .json file. This allows you to attach environments via the CLI from anywhere in the filesystem.

Using Environment Files

To run a collection with an environment file, use the --env-file option:
copy
You can specify either a relative or absolute path to the environment file:
copy
The environment file should be in Bruno’s .bru format. Make sure the file contains valid environment variables and their values.

Using JSON Environment Files

Bruno CLI now supports JSON environment files, which is particularly useful for global environments created in the Bruno app. This bridges the gap between UI-only global environments and CLI-based workflows. To use a JSON environment file:
copy

JSON Environment File Format

The JSON environment file should follow Bruno’s environment schema:
copy

Using Environments Names

If you need to use a specific environment, you can pass it with the --env option:
copy

Using Global/Workspace-Level Environments

Bruno CLI now supports referencing global/workspace-level environments when running a collection. This feature allows you to use environment variables defined at the workspace level rather than at the collection level.

Using Global Environments

Use the --global-env flag to reference a global/workspace-level environment:
copy

Specifying Workspace Path

When your collection is not located at the workspace root, use the --workspace-path flag to specify the workspace path:
copy

Combined Usage

You can combine global environments with collection-level environments:
copy

Passing Environment Variables

Variables marked as secrets in the Bruno app are not persisted to disk for the CLI. Pass them at runtime with --env-var (collection) or --global-env-var (global).
Use --env-var to override collection-level environment variables:
copy
You can override multiple collection variables by repeating the flag:
copy
Each --env-var flag adds or overrides a single collection environment variable. Collection-level --env-var behavior is unchanged.

Passing Global Environment Variables

Use --global-env-var to override variables in the active global environment. This is required when scripts call bru.getGlobalEnvVar() or when you need to inject global secret values in CI/CD. --global-env-var requires --global-env:
copy
Override multiple global variables, optionally with a collection environment:
copy
During the run:
  • Overrides are merged into globalEnvironmentVariables before requests start.
  • bru.getGlobalEnvVar('apiKey') returns the overridden value in scripts.
  • {{apiKey}} interpolation also resolves to the overridden value.
  • Overrides are not written back to the global environment file on disk.

Filtering Requests with Tags

Bruno CLI supports filtering requests by tags, allowing you to run only specific subsets of your collection based on tag criteria.

Include Tags

Run only requests that have at least one matching tag.
copy

Exclude Tags

Skip requests that have ANY of the specified tags:
copy

Combined Filtering

You can combine include and exclude filters:
copy

Parallel Execution and Progress Tracking

Bruno CLI supports running requests in parallel and displaying real-time progress during collection execution.

Parallel Execution

By default, Bruno CLI runs requests sequentially. You can enable parallel execution using the --parallel flag:
copy

Generate API Documentation

Bruno CLI can generate the same standalone HTML API documentation as Collection → Generate Documentation in the desktop app. This lets teams keep generated docs in Git, review changes alongside the collection, and regenerate or deploy the artifact from release and CI pipelines. Run the command from the collection root:
copy
Without additional options, Bruno writes:
to the current directory. The CLI creates parent directories when needed and overwrites an existing output file without prompting. A successful command prints the output path. See Generate API Documentation options for the complete flag reference.

Choose the output file

Use --output or -o to write the HTML file somewhere else:
copy
The short form is equivalent:
copy

Select environments

Use --all-envs to embed every environment in the collection:
copy
Use --envs to embed only selected collection environments. Separate names with commas and quote the value when an environment name contains spaces:
copy
Use --exclude-envs to leave environments out. Combine it with --all-envs to start from the full set, or with --envs to start from a named list:
copy
--exclude-envs takes preference. If the same environment name appears in both --envs and --exclude-envs, that environment is left out. The command exits with an error if a requested environment does not exist.

Filter requests by tags

Use --tags to include requests carrying any matching tag:
copy
Use --exclude-tags to remove requests carrying any matching tag:
copy
You can combine both filters. --exclude-tags takes preference, the same way --exclude-envs does. If the same tag name appears in both --tags and --exclude-tags, requests with that tag are left out:
copy
Excluded requests do not remain in the embedded collection data, navigation, or search index of the generated documentation. Git links are included by default:
copy
Use --no-git-link to omit gitCollectionUrl:
copy

CI example

Generate a filtered artifact after the collection changes, then publish or commit the resulting file:
copy
The CLI and desktop app use the same HTML generation and filtering implementation. For the same collection and options, they produce the same documentation.
For details about the generated site and deployment options, see Generated HTML Documentation.