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

# Using secrets in Request Fields

After you fetch 1Password secrets into an environment, reference resolved values in requests as `{{name}}` or `{{$secrets.name}}`. Both work in headers, query params, body, and auth fields.

## Variable syntax

Each **Name** you configured under External Secrets is the variable you use in requests.

```
{{<name>}}
{{$secrets.<name>}}
```

For example, with a row named `username` pointing at `op://BrunoTestVault/login/username`:

```
{{username}}
{{$secrets.username}}
```

![Using 1Password secrets in a request](https://mintcdn.com/bruno-a6972042/VX3WPts363I_eNpX/images/screenshots/v4/1password/using-1password-secrets.webp?fit=max\&auto=format\&n=VX3WPts363I_eNpX\&q=85\&s=ab479fe7548f082bd67bd5a033abf49b)

## Using secrets in scripts

Access secrets from Pre-request and Post-response scripts with `bru.getSecretVar()`:

```javascript theme={null}
const username = bru.getSecretVar('username');
req.setHeader('X-User', username);
```

Make sure the 1Password account is configured and secrets are fetched (or will be fetched on demand) before using them in scripts. Names must match the environment rows exactly.

## Using secrets with Bruno CLI

Supply the Service Account token with `--secrets-env-file`. The environment file already holds the `op://` references; the CLI resolves them at run time.

```bash theme={null}
bru run collection/ --env local --secrets-env-file ./secrets.env
```

Example `secrets.env`:

```bash theme={null}
BRUNO_ONE_PASSWORD_SERVICE_ACCOUNT_TOKEN=ops_...
```

You can export this file from **Preferences** > **Secrets Manager** (see [Integrating 1Password](https://docs.usebruno.com/secrets-management/secret-managers/1password/adding-a-secret-provider.md#exporting-as-a-env-file)).

For the full CLI reference across providers, see [Secret Managers using CLI](https://docs.usebruno.com/bru-cli/secret-managers.md).
