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

# Global Variables

> Learn how to add global environment variables in Sevalla for use across all applications.

In Sevalla, you can define global environment variables at the company level. These variables are available to all applications within the organization, making them ideal for shared settings such as API keys, credentials, or feature flags.

Set global environment variables within **Integration** > **Global variables**.

<Frame caption="Global environment variables in Sevalla.">
  <img className="block dark:hidden" alt="Global environment variables" src="https://mintcdn.com/sevalla/znhzGue4KWYN3uG0/images/global-variables-light.png?fit=max&auto=format&n=znhzGue4KWYN3uG0&q=85&s=fcd67e75eb7735e7497338bf1cd8403e" width="3376" height="1268" data-path="images/global-variables-light.png" />

  <img className="hidden dark:block" alt="Global environment variables" src="https://mintcdn.com/sevalla/znhzGue4KWYN3uG0/images/global-variables-dark.png?fit=max&auto=format&n=znhzGue4KWYN3uG0&q=85&s=77a151c75cdca2dadf4cc050d12b52ec" width="3388" height="1276" data-path="images/global-variables-dark.png" />
</Frame>

**Copy all** copies all environment variables, allowing you to paste them elsewhere. **Export to file** exports all the environment variables; if you only want to export certain values, select the required environment variables and then click **Export to file**.

<Info>
  You cannot use a `.env` file to pass environment variables to the application; you must set them in Sevalla. You can import the contents of a `.env` file when you add environment variables.
</Info>

## Special characters in environment variables

In the environment variable keys, you can only use a-z, 0-9, or underscore (`_`). Environment variable values are applied literally, with the exception of parentheses, commas, and double quotes.

### Parentheses

Parentheses can cause the build or rollout process to fail, depending on when they are available during deployment. They cannot be used in environment variables.

### Commas

Unescaped [commas are interpreted as delimiters](/applications/troubleshooting/failed-deployment#environment-variables) and cannot be used in environment variables.

* For example: `write_stock,read_orders` will cause the rollout process to fail.
* To keep a comma inside a string, escape it with a backslash (`\`) like this: `write_stock\,read_orders` — which will be applied as `write_stock,read_orders`.

### Double quotes

Unescaped double quotes are either disregarded or will cause the rollout process to fail.

* For example, `"my_example_variable"` will be applied as `my_example_variable`.
* To keep double quotes around a variable, escape them with a backslash (`\`) like this: `\"my_example_var\"` — which will be applied as `"my_example_var"`.
* If double quotes are inside of a string (e.g. `my_exampl"e_text`), the [rollout process will fail](/applications/troubleshooting/failed-deployment).
* To keep double quotes inside a string, escape them with a backslash (`\`) like this: `my_examp\"le_var` — which will be applied as `my_examp"le_var`.

### Base64 encoded variables

If your environment variable is Base64 encoded and you experience issues (e.g. 500 errors in the browser, build errors, runtime errors, etc.), try wrapping the value of the variable with single quotes.

## Add global variables

<Warning>
  If you use a Dockerfile to build your application and you want the environment variable to be available during build time, you must add ARG ENVVAR\_XY to your Dockerfile, where ENVVAR\_XY is the environment variable. For example, if your environment variable is DB\_CONNECTION\_URL you would need to add ARG DB\_CONNECTION\_URL.
</Warning>

To add global environment variables, click **Add environment variables**. Add the key-value pairs, select if the variables are to be available during runtime and/or the build process, and click **Add environment variables**.

You can reference another environment variable using the `${key}` format. For example, to reference an environment variable with the key `DB_PASSWORD` use `${DB_PASSWORD}`.

To add multiple environment variables, copy the keys and values using CMD + C (Mac) or CTRL + C (Windows), and in **Add global app environment variables**, press CMD + V (Mac) or CTRL + V (Windows). You can also paste the contents of a `.env` file or import the `.env` file using **Import .env**.

<Frame caption="Add global environment variables.">
  <img className="block dark:hidden" alt="Add global environment variables" src="https://mintcdn.com/sevalla/zJ9gaZGBj9vl5nle/images/add-global-env-var-light.png?fit=max&auto=format&n=zJ9gaZGBj9vl5nle&q=85&s=55d31b8585721152e2ce9148cb5d8b25" width="1180" height="848" data-path="images/add-global-env-var-light.png" />

  <img className="hidden dark:block" alt="Add global environment variables" src="https://mintcdn.com/sevalla/zJ9gaZGBj9vl5nle/images/add-global-env-var-dark.png?fit=max&auto=format&n=zJ9gaZGBj9vl5nle&q=85&s=7da286ecc01cc86c71cd700c8a766ff9" width="1180" height="848" data-path="images/add-global-env-var-dark.png" />
</Frame>

## Edit global variables

You can edit variable names (keys) or values on the **Global variables** page. To edit a variable, click the ellipsis (three dots) and click **Update**, make your changes, and click **Update global environment variable**.

## View global variables in your applications

If you have a global variable, it is displayed within each application's [Environment variables](https://docs.sevalla.com/applications/environment-variables).

<Frame caption="Global variables shown in your application.">
  <img className="block dark:hidden" alt="Global variables shown in your application" src="https://mintcdn.com/sevalla/lkU9QSvd-oREFN9R/images/global-variable-app-light.png?fit=max&auto=format&n=lkU9QSvd-oREFN9R&q=85&s=78637b8f8e1d2e659bd330211db2f04d" width="2556" height="842" data-path="images/global-variable-app-light.png" />

  <img className="hidden dark:block" alt="Global variables shown in your application" src="https://mintcdn.com/sevalla/lkU9QSvd-oREFN9R/images/global-variable-app-dark.png?fit=max&auto=format&n=lkU9QSvd-oREFN9R&q=85&s=6e12809727d65fe8f625d1604d900dae" width="2558" height="848" data-path="images/global-variable-app-dark.png" />
</Frame>
