You can import .env files with environment variables from your API project into new environments in Postman. Then you can sync changes from your .env files to their respective environments in Postman. This enables you to maintain your environment variables in your API project and sync them with your environments in Postman when you’re ready to test your APIs.
When you open your API project in VS Code, you’ll be notified by an in-app notification if the Postman VS Code extension detects new .env files. You can bulk import multiple .env files and their environment variables into Postman. You can also import a single .env file with its environment variables by clicking the link at the top of the file or right-clicking the file.
From the imported files in your API project, you can then open the environment variables in their respective environments in Postman.
Before importing your files, make sure your project has at least one file with the
.envextension that stores your project’s environment variables in key-value pairs.
To bulk import multiple .env files, do the following:
Open your API project in VS Code. The Postman VS Code extension checks your API project for .env files you haven’t imported into Postman.
In the in-app notification, click Import Now. You can also click
Import at the top of the sidebar, then select .env files to check for files.
In the Import Environments tab, review the detected .env files. You can enter text in the Search by name box to filter the list of files by name.
(Optional) Click Edit next to a .env file you want to edit before importing into Postman. You can take the following actions:
Select the checkbox next to one or more .env files you want to import into new environments in Postman. Each .env file is imported into its own environment in Postman.
Click Import.
As you make changes to your imported .env files in your project, you can sync your changes with Postman.
To import a single .env file, do the following:
Open your API project in VS Code.
Open the .env file you want to import, then click Import to Postman at the top of the file. You can also right-click the .env file, then click Import / Open in Postman.
You won’t have the option to edit the environment variables before importing the
.envfile into Postman. You can edit the variables once they’re imported, such as changing the variable type.
A new Postman environment opens in a new tab with the variables imported from your project. Review the imported variables.
Click Save if you make any changes to the environment.
As you make changes to your imported .env files in your project, you can sync your changes with Postman.
Once your .env files are imported into Postman, you can open an imported file in your API project and click Open in Postman at the top. You can also right-click an imported file and select Import / Open in Postman. This opens the environment in a new tab with the environment variables you imported earlier.
When the environment is moved to a new workspace in Postman, these options open the relocated environment if you have permission to access it.
Learn more about managing environments in the Postman VS Code extension.
You can sync changes made to your imported .env files with their respective environments in Postman.
When you sync changes to imported
.envfiles, both the current (local) and initial (shared) values are updated in their respective environments in Postman. The initial value is synced to the Postman cloud, sharing it with your team when you share the environment.
To detect and sync changes in .env files, do the following:
Open your API project in VS Code.
Edit .env files you’ve already imported into Postman.
Choose how you want to sync your changes:
Repeat these steps for each imported .env file you’ve made changes to.
Last modified: 2025/08/22