How to create an environment in Postman

In Postman, an environment envelops variables meant to be reused in API requests. These variables store environment-specific information that will be automatically included wherever these variables are referenced. This turns the API requests flexible, reduces the probability of errors, and increases efficiency.

An environment is simply a collection of variables stored as key-value pairs. The key represents the variable name. The following example illustrates the concept of environments:

Environment

Variable

Value

Production

base_url

https://api.agify.io/?name=production

Development

base_url

https://api.agify.io/?name=development

Testing

base_url

https://api.agify.io/?name=test

Whenever we switch between these environments, the variable {{base_url}} 's value will change and be automatically reflected throughout the API requests, including this variable.

To foster a formal development life cycle, setting up different API environments in Postman is always better. Such segregation of environments will allow us to build custom requests based on the variables defined in these environments and easily switch between them without modifying our requests.

Environments can be exported as JSON files, imported, shared, duplicated, and removed.

Let's examine the environment's configuration in the Postman web version.

Creating an environment

Kindly follow the steps listed below:

  1. Log in to the Postman web version.

  2. Select a workspace.

  3. Click the "Environment quick look" button located in the top-right corner near the Environment Selector or press the "Create Environment" link as illustrated in the screenshot below:

Step 1: Environment creation
Step 1: Environment creation
  1. Name the newly created environment; for example, Name it "Production" as shown below:

Step 2: Name the environment
Step 2: Name the environment
  1. Initialize the environment with the required variables. Enter the following attributes when defining a variable:
    • Name: This is the name of the variable.

    • Type: The “default” option shows the variable content in plain text. The “secret” option mixes up all workspace members’ initial and current values and is more appropriate for hiding sensitive info like passwords, tokens, and keys.

    • Initial value: Any collaborator with access to the Postman environment will have access.

    • Current value: The current value is only visible to the user.

The "Environments" sidebar provides access to all available environments. To activate an environment, select the "Set active" icon next to its name as displayed below:

Environment activation process
Environment activation process

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved