How-to

Shared environment variables

Learn how to use Shared environment variables, which are environment variables that you define at the Team level and can link to multiple projects.
Table of Contents

Shared Environment Variables are environment variables that you define at the team-level and can link to multiple projects. When a Shared Environment Variable is updated, the change is applied to all linked projects.

When a project-level and a Shared Environment Variable share the same key and environment, the project-level environment variable always overrides the Shared Environment Variable.

Shared Environment Variables are created on the Team Settings page. To create a new Shared Environment Variable, follow these steps:

  1. Go to the Vercel dasboard and select your team from the scope selector. Click on the Settings tab and then select Environment Variables from the left navigation.
  2. Populate the form with your environment variable detials or paste or import an .env file:
    • Key: Fill in the key of the environment variable. - Value: Fill in the value of the environment variable. - Environment: Select the Environments where you want to include it. The environment(s) chosen for the Shared Environment Variable is used when linked to a project. - Link to Projects: Select one or more projects in succession to link the new Shared Environment Variable by using the searchable drop-down. You can keep this empty and link to projects later.
  3. Click Save to save your new Shared Environment Variable.

A Shared Environment Variable is activated once it is linked to at least one project.

You can link an existing Shared Environment Variable to a project either at the project-level or the team-level.

For project-level linking:

  1. From your dashboard, select the Project you would like to link the Shared Environment Variable to and click the Settings tab.
  2. Select Environment Variables from the list, and click on the Link Shared Environment Variables tab.
  3. Select one or more Shared Environment Variables using the search box:
  4. Click the Link button
  1. From your dashboard, click the Settings tab and go to Environment Variables.

  2. Scroll down below the Shared Environment Variable creation form.

  3. Find the variable you would like to link. You can use the Search box, the Environments drop-down filter and sort by last updated date, name or type to more easily find the variable.

  4. Open the context menu for the specific Shared Environment Variable using the vertical ellipsis icon on the right hand side of the row, and click Edit:

  5. From the Environment Variable form, you can link additional projects using the Link to Projects field

  6. Click Save when you are done

There are two ways to remove a Shared Environment Variable from a project:

  • Unlinking: It is disassociated from the selected project(s) but continues to exist at the level of the team
  • Deleting: It is permanently removed from the team and disconnected from all projects it was previously linked to.
  1. From your dashboard, select the project you would like to unlink the Shared Environment Variable from and click the Settings tab.
  2. Select Environment Variables, and scroll down to the Shared Environment Variables section.
  3. Open the context menu for the specific shared environment variable you would like to unlink using the vertical ellipsis icon on the right hand side.
  4. Click Unlink from this Project:
  1. From your dashboard, click the Settings tab and go to Environment Variables.
  2. Scroll down below the Environment Variable creation form.
  3. Find the variable you would like to link. You can use the Search box, the Environments drop-down filter and sort by last updated date, name or type to more easily find the variable.
  4. Open the context menu for the specific shared environment variable using the vertical ellipsis icon on the right hand side of the row, and click Edit:
  5. From the Environment Variable form, click the minus icon to unlink existing projects
  6. When you are done, click the Save button.
  1. From your dashboard, click the Settings tab and go to Environment Variables.
  2. Scroll down below the Environment Variable creation form
  3. Use the context menu on the specific Shared Environment Variable by clicking the vertical ellipsis icon on the right side of the row
  4. Click the Delete button

This action will remove the Shared Environment Variable from the Vercel Team. It will also unlink the Environment Variable from ALL previously linked projects.

Branch-specific variables are not currently supported with Shared Environment Variables

Last updated on September 27, 2024