> For the complete documentation index, see [llms.txt](https://docs.testmace.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.testmace.com/master/variables/env.md).

# Environment Variables

In TestMace you can create changeable variables, for instanсe, to switch between **stage** and **prod** environments.

### Creating environment variables

In this example we'll create a single variable for stage and prod environments.

1. Click on the settings icon.
2. In the pop-up window choose a new environment by clicking on the Add environment button and name it stage.
   * Create the **serverUrl** variable and set the stage server url as its value.
3. Add the prod environment by clicking on the Add environment button.
   * Create the **serverUrl** variable and set the prod server url as its value.

### Importing environment from Postman

TestMace allows you to import your environments from [Postman](https://learning.getpostman.com/docs/postman/environments_and_globals/manage_environments/). To do that, click the **+ Import environment** button, that may be found in the variables editing dialog right under the list with all available environments. After you click the + Import environment button, you'll see the dialog where you should enter the path to the file.

![](/files/-Ll_vhhwuZP7Rsl1UjJq)

### Using Environment Variables

To create a changeable variable use the `${$env.%VARIABLE%}` reference. Change the value of our variable in every node to `${$env.serverUrl}`. Now you can change this variable value anytime.

![](/files/-LhFYqaW5QfteLxqdRug)

#### Where to use environment variables?

Just like plain variables, you can use environment variables in any string field of the node.

### Local Environments <a href="#local-environments" id="local-environments"></a>

Local environments are just usual environments that are not saved into project files, but are stored in the application's local storage. We reccomend you use this environment while working with local and privite data, such as logins, passwords, API-tokens, etc.

You can see local environments at the bottom of the sidebar. Each local environment has the `(local)` prefix, so that you could distinguish from other environments.

![Local environments in the environments variables dialog](/files/-LmFN0AzzPc2yQWwQqUW)

Drag and drop your local environments to turn them into ordinary ones and vice versa.

![](/files/-LmFN2QmhcHNQbUo8K4m)


---

# 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.testmace.com/master/variables/env.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.
