> 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

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

* Available on Self-hosted Enterprise and Pro and Enterprise Cloud plans.
* 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.n8n.io/build/code-in-n8n/cookbook/built-in-methods-and-variables-examples/vars.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
