Logo
30daysofpostman API Documentation

Update Environment

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

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.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 
Content-Type
string




RESPONSES

status OK

{ "environment": { "id": "5daabc50-8451-43f6-922d-96b403b4f28e", "name": "Test A Environment", "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e" } }



Curl
curl -X PUT 'https://api.getpostman.com/environments/environmentUid' -H 'Content-Type: application/json' -d '{"environment":{"name":"environmentName","values":[{"key":"environmentVariableName","value":"environmentVariableValue"}]}}'

ENDPOINTS