Conceptual

Managing Environment Variables

Learn how to use Vercel Environment Variables, which are key-value pairs configured outside your source code that change depending on the environment.
Table of Contents

Environment Variables are key-value pairs configured outside your source code so that each value can change depending on the Environment.

Changes to Environment Variables are not applied to previous deployments, they only apply to new deployments. You must redeploy your project to update the value of any variables you change in the deployment.

To declare an Environment Variable for your deployment:

  1. From your dashboard, select your project. If neccessary, you can also set Environments team-wide so that they will be available for all projects.

  2. Select the Settings tab.

  3. Go to the Environment Variables section of your Project Settings.

    The 'Add New' section of the Environment Variables page in the Project Settings.
    The 'Add New' section of the Environment Variables page in the Project Settings.
  4. Enter the desired Name for your Environment Variable. For example, if you are using Node.js and you create an Environment Variable named API_URL, it will be available under process.env.API_URL in your code.

    process.env.API_URL;
  5. Then, enter the Value for your Environment Variable. The value is encrypted at rest so it is safe to add sensitive data like authentication tokens or private keys.

  6. Configure which deployment environment(s) this variable should apply to.

  7. Click Save.

  8. To ensure that the new Environment Variable is applied to your deployment, you must redeploy your project.

To find and view all Environment Variables.

  1. From your dashboard, select your project. You can also view all team-wide Environments through the Team Settings.
  2. Select the Settings tab.
  3. Go to the Environment Variables section of your Project Settings.
  4. Below the Add New form is a list of all the Environment Variables for the Project.
  5. You can search for an existing Environment Variable by name using the search input and/or filter by Environment.
  6. To edit or delete the Environment Variable, click the three dots to the right of the Environment Variable name.
    An example of an Environment Variable with the search and filter inputs above.
    An example of an Environment Variable with the search and filter inputs above.
Last updated on September 18, 2024