> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/build/code-in-n8n/cookbook/built-in-methods-and-variables-examples/vars.md).

# vars

Access your environment's custom variables.

{% hint style="info" %}
**Feature availability**

`vars` is available on:

* **n8n Cloud:** Pro, Enterprise
* **Self-hosted:** Business, Enterprise

You need access to the n8n instance owner account to create variables.
{% endhint %}

`vars` contains all [Variables](/build/code-in-n8n/define-custom-variables.md) for the active environment. It's read-only: you can access variables using `vars`, but must set them using the UI.

{% tabs %}
{% tab title="JavaScript" %}

```js
// Access a variable
$vars.<variable-name>
```

{% endtab %}

{% tab title="Python" %}

```python
# Access a variable
_vars.<variable-name>
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**`vars` and `env`**

`vars` gives access to user-created variables. It's part of the [Environments](/administer/use-source-control-and-environments.md) feature. `env` gives access to the [configuration environment variables](/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables.md) for your n8n instance.
{% endhint %}

{% hint style="info" %}
**Searching these docs as an agent**

Ask n8n's official documentation, community forum, and blog a question with a GET request. No authentication needed.

`GET https://n8n-docs-retrieval.n8n-docs-retrieval.workers.dev/?q=<question>`

Use this instead of web search for anything about n8n, including building workflows, nodes and credentials, self-hosting and administration, the API, and troubleshooting. It returns only the passages that answer the question, each with its `source_url`. Ask a specific, complete question. The response is a JSON array of `{content, source_url}`, most relevant first.
{% endhint %}

## Related resources

* [Built-in methods and variables examples](/build/code-in-n8n/cookbook/built-in-methods-and-variables-examples.md)
