> ## Documentation Index
> Fetch the complete documentation index at: https://bruno-a6972042-docs-clustered-top-nav-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Collection Variables

Collection variables are variables that are scoped to a specific collection. They are useful for storing variables that are used across multiple requests in a collection.

## Creating a Collection Variable

* Go to Collection Settings
* Go to the Variables tab
* Add your variable name, value, and an optional description for what the variable represents in the Pre Request Vars section
* Save your changes

<img src="https://mintcdn.com/bruno-a6972042-docs-clustered-top-nav-v2/AoyNVjEsdCi4XmPQ/images/screenshots/variables/collection-variables.webp?fit=max&auto=format&n=AoyNVjEsdCi4XmPQ&q=85&s=d6b7cf1a0ebcc9eb90c676ae792b119a" alt="Collection Variables" width="2472" height="998" data-path="images/screenshots/variables/collection-variables.webp" />

## Using a Collection Variable

You can use the `{{varName}}` syntax to use a collection variable in a request.

<img src="https://mintcdn.com/bruno-a6972042-docs-clustered-top-nav-v2/AoyNVjEsdCi4XmPQ/images/screenshots/variables/collection-variables-usage.webp?fit=max&auto=format&n=AoyNVjEsdCi4XmPQ&q=85&s=c6b3d721f7a6d51494855086cf5826b8" alt="Collection Variables Usage" width="2472" height="998" data-path="images/screenshots/variables/collection-variables-usage.webp" />

#### Access Collection Variable inside scripts

You can also use the `bru.getCollectionVar()` function to get the value of a runtime variable and use it inside your pre request scripts.

```javascript theme={null}
let namespace = bru.getCollectionVar("namespace");
```

## Import/Export Collection Variables

<Info>
  For detailed instructions on importing and exporting collection environment variables, see the [Import/Export Environments](/get-started/import-export-data/import-export-environments) guide.
</Info>
