Skip to main content

CLI Overview

Bruno CLI (bru) allows you to run your API collections from the command line, making it easy to:
  • Test APIs in different environments
  • Automate testing workflows
  • Integrate with CI/CD pipelines
  • Run tests in headless environments
The CLI reads the same .bru files you create in the Bruno desktop app, ensuring consistency between manual and automated testing.

Key Features

Environment Support

Switch between environments and override variables on the fly

Multiple Reporters

Export results as JSON, JUnit, or HTML for CI/CD integration

Flexible Execution

Run individual requests, folders, or entire collections recursively

Custom Certificates

Add custom CA certificates and client certificates for secure connections

Quick Start

Navigate to your collection directory and run all requests:
bru run
Run a specific request:
bru run request.bru
Run with a specific environment:
bru run --env production

Common Use Cases

CI/CD Integration

Generate JUnit reports for your CI/CD pipeline:
bru run --reporter-junit results.xml

Environment Testing

Test against multiple environments with overrides:
bru run --env staging --env-var apiKey=test123

Selective Testing

Run only requests that have tests:
bru run --tests-only

Filtered Execution

Run requests with specific tags:
bru run --tags=smoke,critical --exclude-tags=skip

Exit Codes

Bruno CLI returns specific exit codes for scripting and automation:
Exit CodeDescription
0Execution successful
1An assertion, test, or request failed
2The specified output directory does not exist
3The request chain loops endlessly
4Bru was called outside of a collection root directory
5The specified input file does not exist
6The specified environment does not exist
7The environment override was not a string or object
8An environment override is malformed
9An invalid output format was requested
255Another error occurred

Next Steps

Installation

Install Bruno CLI globally or in your project

Running Tests

Learn how to run API tests with various options

CLI Options

Complete reference of all CLI flags and options

Importing Collections

Import collections from OpenAPI and other formats

Build docs developers (and LLMs) love