> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/usebruno/bruno/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Options Reference

> Complete reference of all Bruno CLI command-line options and flags

# CLI Options Reference

Complete reference for all Bruno CLI commands, options, and flags.

## Global Options

These options are available for all commands:

<ParamField path="--help" type="boolean">
  Show help information.

  **Aliases:** `-h`

  ```bash theme={null}
  bru --help
  bru run --help
  ```
</ParamField>

<ParamField path="--version" type="boolean">
  Show version number.

  ```bash theme={null}
  bru --version
  ```
</ParamField>

## Run Command

Execute API requests and tests from your collection.

```bash theme={null}
bru run [paths...] [options]
```

### Paths

<ParamField path="paths" type="string[]">
  One or more request files or folders to run. If omitted, runs all requests in the current directory recursively.

  ```bash theme={null}
  bru run                          # Run all requests
  bru run request.bru              # Run single request
  bru run folder                   # Run folder
  bru run auth users -r            # Run multiple paths recursively
  ```
</ParamField>

### Execution Options

<ParamField path="-r" type="boolean" default={false}>
  Run requests recursively in subdirectories.

  ```bash theme={null}
  bru run tests -r
  ```
</ParamField>

<ParamField path="--tests-only" type="boolean" default={false}>
  Only run requests that have tests or active assertions.

  ```bash theme={null}
  bru run --tests-only
  ```
</ParamField>

<ParamField path="--bail" type="boolean" default={false}>
  Stop execution immediately after a failure of a request, test, or assertion.

  ```bash theme={null}
  bru run --bail
  ```
</ParamField>

<ParamField path="--delay" type="number">
  Add delay between each request in milliseconds.

  ```bash theme={null}
  bru run --delay 1000  # 1 second delay
  bru run --delay 500   # 500ms delay
  ```
</ParamField>

<ParamField path="--verbose" type="boolean" default={false}>
  Enable verbose output for debugging purposes.

  ```bash theme={null}
  bru run --verbose
  ```
</ParamField>

### Environment Options

<ParamField path="--env" type="string">
  Specify environment to run with. Loads from `environments/<name>.bru` or `environments/<name>.yml`.

  ```bash theme={null}
  bru run --env production
  bru run --env local
  ```
</ParamField>

<ParamField path="--env-file" type="string">
  Path to environment file (.bru, .json, or .yml) - absolute or relative.

  ```bash theme={null}
  bru run --env-file custom-env.bru
  bru run --env-file /path/to/env.json
  ```
</ParamField>

<ParamField path="--env-var" type="string">
  Override a single environment variable. Can be used multiple times.

  ```bash theme={null}
  bru run --env-var apiKey=secret123
  bru run --env-var baseUrl=https://api.test.com --env-var token=xyz
  ```
</ParamField>

<ParamField path="--global-env" type="string">
  Global environment name (requires collection to be in a workspace).

  ```bash theme={null}
  bru run --global-env production
  bru run --global-env staging --workspace-path /path/to/workspace
  ```
</ParamField>

<ParamField path="--workspace-path" type="string">
  Path to workspace directory (auto-detected if not provided).

  ```bash theme={null}
  bru run --global-env production --workspace-path ~/my-workspace
  ```
</ParamField>

### Output and Reporting

<ParamField path="--output" type="string">
  Path to write file results to. Use with `--format` to specify format.

  **Aliases:** `-o`

  ```bash theme={null}
  bru run --output results.json
  bru run --output results.xml --format junit
  bru run -o report.html --format html
  ```
</ParamField>

<ParamField path="--format" type="string" default="json">
  Format of the file results.

  **Aliases:** `-f`

  **Options:** `json`, `junit`, `html`

  ```bash theme={null}
  bru run --output results.xml --format junit
  ```
</ParamField>

<ParamField path="--reporter-json" type="string">
  Path to generate a JSON report.

  ```bash theme={null}
  bru run --reporter-json results.json
  ```
</ParamField>

<ParamField path="--reporter-junit" type="string">
  Path to generate a JUnit XML report.

  ```bash theme={null}
  bru run --reporter-junit results.xml
  ```
</ParamField>

<ParamField path="--reporter-html" type="string">
  Path to generate an HTML report.

  ```bash theme={null}
  bru run --reporter-html report.html
  ```
</ParamField>

### Reporter Customization

<ParamField path="--reporter-skip-all-headers" type="boolean" default={false}>
  Omit all headers from the reporter output.

  ```bash theme={null}
  bru run --reporter-skip-all-headers
  ```
</ParamField>

<ParamField path="--reporter-skip-headers" type="array" default={[]}>
  Skip specific headers from the reporter output.

  ```bash theme={null}
  bru run --reporter-skip-headers Authorization Cookie
  bru run --reporter-skip-headers "X-Api-Key"
  ```
</ParamField>

<ParamField path="--reporter-skip-request-body" type="boolean" default={false}>
  Omit request body from the reporter output.

  ```bash theme={null}
  bru run --reporter-skip-request-body
  ```
</ParamField>

<ParamField path="--reporter-skip-response-body" type="boolean" default={false}>
  Omit response body from the reporter output.

  ```bash theme={null}
  bru run --reporter-skip-response-body
  ```
</ParamField>

<ParamField path="--reporter-skip-body" type="boolean" default={false}>
  Omit both request and response bodies from the reporter output.

  ```bash theme={null}
  bru run --reporter-skip-body
  ```
</ParamField>

### Security and Certificates

<ParamField path="--cacert" type="string">
  CA certificate to verify peer against. By default, uses system truststore + custom cert.

  ```bash theme={null}
  bru run --cacert myCustomCA.pem
  bru run --cacert corporate-ca.crt
  ```
</ParamField>

<ParamField path="--ignore-truststore" type="boolean" default={false}>
  Use only the specified custom CA certificate (--cacert) and ignore the default truststore.

  ```bash theme={null}
  bru run --cacert myCustomCA.pem --ignore-truststore
  ```
</ParamField>

<ParamField path="--insecure" type="boolean" default={false}>
  Allow insecure server connections (skip SSL certificate verification).

  <Warning>Only use in development/testing environments.</Warning>

  ```bash theme={null}
  bru run --insecure
  ```
</ParamField>

<ParamField path="--client-cert-config" type="string">
  Path to client certificate configuration JSON file.

  ```bash theme={null}
  bru run --client-cert-config client-certs.json
  ```

  **Config format:**

  ```json theme={null}
  {
    "enabled": true,
    "certs": [
      {
        "domain": "https://api.example.com",
        "certFilePath": "/path/to/cert.pem",
        "keyFilePath": "/path/to/key.pem",
        "passphrase": "optional"
      }
    ]
  }
  ```
</ParamField>

### Network Options

<ParamField path="--noproxy" type="boolean" default={false}>
  Disable all proxy settings (both collection-defined and system proxies).

  ```bash theme={null}
  bru run --noproxy
  ```
</ParamField>

<ParamField path="--disable-cookies" type="boolean" default={false}>
  Disable automatic cookie saving and sending with requests.

  ```bash theme={null}
  bru run --disable-cookies
  ```
</ParamField>

### Advanced Options

<ParamField path="--sandbox" type="string" default="safe">
  JavaScript sandbox runtime to use.

  **Options:**

  * `safe` - Uses QuickJS (secure, limited features)
  * `developer` - Uses Node.js VM (more features, less secure)

  ```bash theme={null}
  bru run --sandbox developer
  ```
</ParamField>

<ParamField path="--tags" type="string">
  Comma-separated list of tags to include in the run.

  ```bash theme={null}
  bru run --tags=smoke,critical
  bru run --tags=api
  ```
</ParamField>

<ParamField path="--exclude-tags" type="string">
  Comma-separated list of tags to exclude from the run.

  ```bash theme={null}
  bru run --exclude-tags=skip,wip
  bru run --tags=api --exclude-tags=slow
  ```
</ParamField>

## Import Command

Import collections from other formats.

```bash theme={null}
bru import <type> [options]
```

### Import Types

<ParamField path="type" type="string" required>
  Type of collection to import.

  **Options:** `openapi`, `wsdl`

  ```bash theme={null}
  bru import openapi --source api.yml --output ./collection
  bru import wsdl --source service.wsdl --output ./soap
  ```
</ParamField>

### Import Options

<ParamField path="--source" type="string" required>
  Path to the source file or URL.

  **Aliases:** `-s`

  ```bash theme={null}
  bru import openapi --source api.yml
  bru import openapi -s https://api.example.com/openapi.json
  ```
</ParamField>

<ParamField path="--output" type="string">
  Path to the output directory. Conflicts with `--output-file`.

  **Aliases:** `-o`

  ```bash theme={null}
  bru import openapi -s api.yml -o ~/Desktop/my-collection
  ```
</ParamField>

<ParamField path="--output-file" type="string">
  Path to the output JSON file. Conflicts with `--output`.

  **Aliases:** `-f`

  ```bash theme={null}
  bru import openapi -s api.yml -f ~/Desktop/collection.json
  ```
</ParamField>

<ParamField path="--collection-name" type="string">
  Name for the imported collection.

  **Aliases:** `-n`

  ```bash theme={null}
  bru import openapi -s api.yml -o ./collection -n "My API"
  ```
</ParamField>

<ParamField path="--collection-format" type="string" default="opencollection">
  Format of the imported collection.

  **Options:** `bru`, `opencollection`

  ```bash theme={null}
  bru import openapi -s api.yml -o ./collection --collection-format bru
  ```
</ParamField>

<ParamField path="--insecure" type="boolean" default={false}>
  Skip SSL certificate verification when fetching from URLs.

  ```bash theme={null}
  bru import openapi -s https://self-signed.com/api.json --insecure
  ```
</ParamField>

<ParamField path="--group-by" type="string" default="tags">
  How to group imported requests (OpenAPI only).

  **Aliases:** `-g`

  **Options:** `tags`, `path`

  ```bash theme={null}
  bru import openapi -s api.yml -o ./collection --group-by path
  bru import openapi -s api.yml -o ./collection -g tags
  ```
</ParamField>

## Exit Codes

Bruno CLI returns specific exit codes for scripting and automation:

| Exit Code | Constant                              | Description                                            |
| --------- | ------------------------------------- | ------------------------------------------------------ |
| `0`       | -                                     | Execution successful                                   |
| `1`       | `ERROR_FAILED_COLLECTION`             | An assertion, test, or request failed                  |
| `2`       | `ERROR_MISSING_OUTPUT_DIR`            | The specified output directory does not exist          |
| `3`       | `ERROR_INFINITE_LOOP`                 | The request chain loops endlessly                      |
| `4`       | `ERROR_NOT_IN_COLLECTION`             | Bru was called outside of a collection root            |
| `5`       | `ERROR_FILE_NOT_FOUND`                | The specified input file does not exist                |
| `6`       | `ERROR_ENV_NOT_FOUND`                 | The specified environment does not exist               |
| `7`       | `ERROR_MALFORMED_ENV_OVERRIDE`        | Environment override not presented as string or object |
| `8`       | `ERROR_INCORRECT_ENV_OVERRIDE`        | Environment override format incorrect                  |
| `9`       | `ERROR_INCORRECT_OUTPUT_FORMAT`       | Invalid output format requested                        |
| `10`      | `ERROR_INVALID_FILE`                  | Invalid file format                                    |
| `11`      | `ERROR_WORKSPACE_NOT_FOUND`           | The specified workspace was not found                  |
| `12`      | `ERROR_GLOBAL_ENV_REQUIRES_WORKSPACE` | Global environment requires a workspace                |
| `13`      | `ERROR_GLOBAL_ENV_NOT_FOUND`          | The specified global environment was not found         |
| `255`     | `ERROR_GENERIC`                       | Another error occurred                                 |

### Using Exit Codes in Scripts

```bash theme={null}
#!/bin/bash

bru run --env production
EXIT_CODE=$?

if [ $EXIT_CODE -eq 0 ]; then
  echo "All tests passed!"
elif [ $EXIT_CODE -eq 1 ]; then
  echo "Some tests failed"
  exit 1
elif [ $EXIT_CODE -eq 6 ]; then
  echo "Environment not found"
  exit 1
else
  echo "Error occurred: $EXIT_CODE"
  exit 1
fi
```

## Environment Variables

Bruno CLI respects the following environment variables:

<ParamField path="HTTP_PROXY" type="string">
  HTTP proxy server URL.

  ```bash theme={null}
  export HTTP_PROXY=http://proxy.example.com:8080
  bru run
  ```
</ParamField>

<ParamField path="HTTPS_PROXY" type="string">
  HTTPS proxy server URL.

  ```bash theme={null}
  export HTTPS_PROXY=https://proxy.example.com:8443
  bru run
  ```
</ParamField>

<ParamField path="NO_PROXY" type="string">
  Comma-separated list of hosts to exclude from proxying.

  ```bash theme={null}
  export NO_PROXY=localhost,127.0.0.1,.example.com
  bru run
  ```
</ParamField>

## Complete Examples

### Production Test Suite

```bash theme={null}
bru run \
  --env production \
  --env-var apiKey=$PROD_API_KEY \
  --reporter-junit results.xml \
  --reporter-html report.html \
  --reporter-skip-headers Authorization \
  --bail \
  --cacert corporate-ca.pem
```

### Development Testing

```bash theme={null}
bru run \
  --env local \
  --env-var baseUrl=http://localhost:3000 \
  --tests-only \
  --verbose \
  --insecure
```

### CI/CD Integration

```bash theme={null}
bru run \
  --env staging \
  --reporter-junit test-results.xml \
  --reporter-json test-results.json \
  --bail \
  --tags=smoke,regression \
  --exclude-tags=manual
```

### Import and Test

```bash theme={null}
# Import collection
bru import openapi \
  --source https://api.example.com/openapi.json \
  --output ./my-api \
  --collection-name "Example API" \
  --group-by path

# Run tests
cd my-api
bru run --env production --reporter-html results.html
```

## Next Steps

<CardGroup cols={2}>
  <Card title="CLI Overview" icon="terminal" href="/cli/overview">
    Learn about Bruno CLI fundamentals
  </Card>

  <Card title="Running Tests" icon="play" href="/cli/running-tests">
    Practical guide to running API tests
  </Card>

  <Card title="Importing Collections" icon="file-import" href="/cli/importing-collections">
    Import from OpenAPI and other formats
  </Card>

  <Card title="Installation" icon="download" href="/cli/installation">
    Install Bruno CLI in your environment
  </Card>
</CardGroup>
