Our new customer portal is now live!
Guides

Add environment variables and API keys

Save application settings individually or by pasting .env content.

5 min · Beginner

Updated

In this guide

Before you start

You need permission to manage the website and the variable names your application uses. Check the project documentation or developer for the correct production values. Variables are available during both building and runtime. PORT=3000 and NODE_ENV=production are set automatically.

Add or edit variables

  1. Open the correct website and Environment. Make sure you are editing the intended production or staging environment.
  2. Select Add variable and enter its name and value. Use the exact name expected by your application, such as DATABASE_URL.
  3. For multiple variables, choose Paste .env, paste KEY=value lines and select Add variables. Review the rows before saving: importing the same name replaces its value in the form.
  4. Saved values are hidden. Select Show values if you need to reveal them. You do not need to re-enter a hidden value when saving changes to other variables.
  5. Select Save and deploy. Wait for deployment to finish before testing.

Verify the result

Test a feature that uses the variable, such as a database query or sending email. Check the application log without printing secrets into it. Variables included in browser code may become public: keep secret keys out of variables intended for frontend code.

If saving fails

Check variable names, duplicates and changes made in another tab. If the data changed while you were editing, reload the page and apply your changes to the current list. Removing a variable can prevent startup. If a key has leaked, rotate it with the service that issued it as well.