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

# Variables

> Store and reuse context throughout a conversation.

<img src="https://mintcdn.com/voiceflow-009a8802/dQUYRTU7iAzItjOk/images/variables-docs.png?fit=max&auto=format&n=dQUYRTU7iAzItjOk&q=85&s=19789915ee49da9f3b9e4e8cbc0e9f3f" alt="Variables Docs" width="2820" height="1358" data-path="images/variables-docs.png" />

Variables let your agent remember and reuse information during a conversation — things like a user's name, account details, or selections they've made. They act as your agent's short-term memory, letting it personalize responses, make decisions, and pass data between steps.

Variables are scoped to individual users via `user_id`. If ten users are talking to your agent simultaneously, their variable values are completely independent.

## Creating variables

You can create a variable from anywhere your can insert them — type `{` in most text inputs across Voiceflow to see your existing variables or create a new one inline.

<img src="https://mintcdn.com/voiceflow-009a8802/fgJmMBgfwfADVg8o/images/Create-var-docs.png?fit=max&auto=format&n=fgJmMBgfwfADVg8o&q=85&s=ac177fc13503a26eb51a1fb626af3536" alt="Create Var Docs" width="1732" height="1090" data-path="images/Create-var-docs.png" />

You can also manage variables from the **Variables** tab in the sidebar. Click **New variable** in the top right to create one, or click an existing variable to edit it. When creating a variable, you can optionally set a default value — this gives your agent a fallback if the variable hasn't been set yet during a conversation. By default, variables are initialized automatically and set to 0.

<img src="https://mintcdn.com/voiceflow-009a8802/dQUYRTU7iAzItjOk/images/variables-table-docs.png?fit=max&auto=format&n=dQUYRTU7iAzItjOk&q=85&s=745357ff7a68838d0ebab921841c1d4b" alt="Variables Table Docs" width="2820" height="1122" data-path="images/variables-table-docs.png" />

## Using variables

Reference a variable by typing `{` and selecting it from the searchable menu. Variables work inside playbook instructions, API tool URLs and headers, condition steps, response messages, and more. If you're in a place where you need to use a variable, type `{` and it the menu will pop up.

<img src="https://mintcdn.com/voiceflow-009a8802/LeZxXSWbfsUvJ3SN/images/Using-vars.png?fit=max&auto=format&n=LeZxXSWbfsUvJ3SN&q=85&s=73d45f8d65f587708aaefb4c645f77ba" alt="Using Vars" width="1278" height="618" data-path="images/Using-vars.png" />

## Setting variable values

| Method                                           | How it works                                                                                                                                                                                                                                   |
| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**Set step**](/documentation/build/steps/set)   | Assign a value directly in a workflow                                                                                                                                                                                                          |
| [**Code step**](/documentation/build/steps/code) | Set values using JavaScript logic                                                                                                                                                                                                              |
| **Tool responses**                               | Capture the response from an [API tool](/documentation/build/tools/api-tool) or [function](/documentation/build/tools/function-tool) and store it in a variable                                                                                |
| **Playbook exit conditions**                     | Variables attached as [exit conditions](/documentation/build/playbooks) on a playbook are filled by the agent during the conversation, then passed back when the playbook completes via a [playbook step](/documentation/build/steps/playbook) |

## Built-in variables

Every project has access to built-in variables that are automatically set when a conversation begins or when certain events occur.

| Variable           | Description                                                                                                                                                                                                                                                         | Example                                                            |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `user_id`          | The user's unique ID, set via the [web chat widget](/documentation/deploy/widget/embedding-the-chat-widget) or [API](/api-reference/api-overview). For [phone](/documentation/deploy/phone/connect-a-phone-number) integrations, this is the caller's phone number. | `example_user` or `+16471234567`                                   |
| `last_utterance`   | The previous message sent by the user                                                                                                                                                                                                                               | `My name is Braden and I like cookies.`                            |
| `last_response`    | The agent's most recent response                                                                                                                                                                                                                                    | `Hello, I'm an agent! How can I help today?`                       |
| `last_event`       | The last [event](/documentation/building-agents/behaviour) the user triggered (object, not string)                                                                                                                                                                  | `{"type":"event","payload":{"event":{"name":"buySyrup"}}}`         |
| `vf_memory`        | The last ten user inputs and agent responses as a string, including tool calls                                                                                                                                                                                      | `agent: Hey what's up?`<br />`nuser: I want to order maple syrup.` |
| `vf_now`           | Current date and time. Timezone configurable in **Settings** → **General**                                                                                                                                                                                          | `Monday, Jan 1, 2025, 16:37`                                       |
| `vf_date`          | Current date                                                                                                                                                                                                                                                        | `Jan 1, 2025`                                                      |
| `vf_time`          | Current time                                                                                                                                                                                                                                                        | `16:37`                                                            |
| `vf_month`         | Current month                                                                                                                                                                                                                                                       | `January`                                                          |
| `vf_day`           | Current day of the month                                                                                                                                                                                                                                            | `1`                                                                |
| `vf_year`          | Current year                                                                                                                                                                                                                                                        | `2025`                                                             |
| `vf_user_timezone` | The user's timezone. Defaults to project timezone if unavailable                                                                                                                                                                                                    | `America/Toronto`                                                  |
| `sessions`         | Number of times this user has opened the agent                                                                                                                                                                                                                      | `8`                                                                |
| `timestamp`        | [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time) of when the conversation began                                                                                                                                                                            | `873700668`                                                        |
| `locale`           | The user's [locale](https://learn.microsoft.com/en-us/globalization/locale/standard-locale-names), detected from their browser                                                                                                                                      | `en-CA`                                                            |
| `platform`         | The platform your agent is running on                                                                                                                                                                                                                               | `voiceflow`                                                        |
