Edit and set environment variables in Postman
Last Updated :
15 Mar, 2024
In Postman, the "environment" refers to a set of key-value pairs or a collection of variables used to customize requests. Environments allow you to define variables that can be reused across multiple requests, making it easier to manage different configurations for testing APIs or web services.
Features of Environment Variables:
- Variables: It allows us to define and store variables, such as URLs, authentication tokens, API keys, etc. These variables can be used across multiple requests within the same environment, making it easy to manage and update them centrally.
- Scope Control: Variables in environments can have different scopes, such as global or environment-specific.
- Environment Switching: Postman provides a simple interface for switching between different environments. This allows us to quickly change the configuration of our requests based on the environment we are testing.
- Security: Postman environments support encrypted variables, ensuring sensitive information such as passwords or API keys are securely stored and transmitted.
Implementation of Environment Variables :
1. Setting environment variable :
Step 1: Create a request in a collection. In below image localhost may vary depending on development, testing, staging, and production. So, we can use the environment variable here.

Step 2 : In left-hand side of the Postman interface, you'll see a menu labeled "Environments". Click on "Create Environment".

Step 3 : A tab will gets opened and we can add new variables, their types and values. Save the environment after adding all the variables.

Step 4: Use the variables in request and choose environment from top right corner "No Environment".

Step 5 : Run the request and we will get the results as per our variable.

2. Editing an environment variable.
Step 1: Open the environment and update the variables (Here we can see that we have not added port 3000 in baseUrl variable, so let us edit this variable).

Step 2: Save it and then run the request again against the choosen environment (GFG Env).

Output :

Similar Reads
How to add environment variable in MacOS? While programmers work on different Programming Languages, they use to declare Variables to work on any certain piece of code. The Variables in general terms are used to store some values that can be again accessed in the future. There are some Operating System Variables present that are known as En
3 min read
How to create an environment in Postman? Postman is a popular API testing tool that is used to simplify the process of developing and testing APIs (Application Programming Interface). API acts as a bridge between two software applications which enables them to communicate and share data. Postman provides a simple Graphical User Interface f
3 min read
How to Set Environment Variable in AWS Lambda ? AWS Lambda is a managed serverless deployment service of AWS that can be used for the implementation of various applications in the cloud. AWS lambda may use various environment variables for the execution of different operations. eg. Database Credentials, API Keys .etc. There are various ways we ca
4 min read
How To Configure And Use Environment Variables in NestJS? Environment variables are an important part of application development, allowing developers to configure applications in different environments (development, staging, production) without hardcoding sensitive or environment-specific information into the application code.In this article, we'll walk th
2 min read
Next.js Environment Variables Environment variables are a fundamental aspect of modern web development, allowing developers to configure applications based on the environment they are running in (development, testing, production, etc.). In Next.js, environment variables provide a flexible and secure way to manage configuration s
3 min read