Logo
30 days of Postman - for developers API Documentation

Environments

Number of APIs: 5


1. All Environments

GET https://api.getpostman.com/environments

The /environments endpoint returns a list of all environments that belong to you..

The response contains an array of environments' information containing the name, id, owner and uid of each environment.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



2. Single Environment

GET https://api.getpostman.com/environments/{{environment_uid}}

Access the contents of an environment that is accessible to you using its unique id (uid).

Requires API Key as X-Api-Key request header or apikey URL query parameter.



3. Create Environment

POST https://api.getpostman.com/environments

A sample body is added to the request that conforms to the following JSON schema:

{
  "type": "object",
  "properties": {
    "environment": {
      "type": "object",
      "properties": {
        "name": {
              "type": "string",
              "maxLength": 254,
              "minLength": 1
            },
        "values": {
          "type": "array",
          "maxItems": 100,
          "additionalItems": false,
          "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 254
                  "minLength": 1
                },
                "value": { "type": "string" },
                "enabled": { "type": "boolean" }
              },
              "required": ["key", "value"]
            }
        }
      },
      "required": ["name"]
    }
  },
  "required": ["environment"]
}

On successful creation of the environment, the API returns the environment name and id.

You can also specify the context of a workspace to create an environment in directly by passing the workspace as a query param.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



4. Update Environment

PUT https://api.getpostman.com/environments/{{environment_uid}}

This endpoint replaces an existing environment.

A sample body is added to the request that conforms to the following JSON schema:

{
    "type": "object",
    "properties": {
        "environment": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "maxLength": 254,
                    "minLength": 1
                },
                "values": {
                    "type": "array",
                    "maxItems": 100,
                    "additionalItems": false,
                    "items": {
                        "type": "object",
                        "properties": {
                            "key": {
                                "type": "string",
                                "maxLength": 254,
                                "minLength": 1
                            },
                            "value": {
                                "type": "string",
                                "maxLength": 254,
                                "minLength": 1
                            },
                            "type": {
                                "type": "string"
                            },
                            "enabled": {
                                "type": "boolean"
                            }
                        },
                        "required": [
                            "key",
                            "value"
                        ]
                    }
                }
            }
        }
    },
    "required": [
        "environment"
    ]
}

On successful updation of the environment, the API returns the environment name and id.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



5. Delete Environment

DELETE https://api.getpostman.com/environments/{{environment_uid}}

This endpoint allows you to delete a single environment based on an environment's unique uid.

Requires API Key as X-Api-Key request header or apikey URL query parameter.



ENDPOINTS