> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Update an environment

PATCH https://api.getpostman.com/environments/{environmentId}
Content-Type: application/json

Updates specific environment properties, such as its name and variables.

**Note:**

- You can only perform one type of operation at a time. For example, you cannot perform an `add` and `replace` operation in the same call.
- The request body size cannot exceed the maximum allowed size of 30MB.
- If you receive an HTTP `411 Length Required` error response, manually pass the `Content-Length` header and its value in the request header.
- To add a description to an existing variable, use the `add` operation.


Reference: https://learning.postman.com/api-docs/api-reference/environments/patch-environment

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /environments/{environmentId}:
    patch:
      operationId: patchEnvironment
      summary: Update an environment
      description: >
        Updates specific environment properties, such as its name and variables.


        **Note:**


        - You can only perform one type of operation at a time. For example, you
        cannot perform an `add` and `replace` operation in the same call.

        - The request body size cannot exceed the maximum allowed size of 30MB.

        - If you receive an HTTP `411 Length Required` error response, manually
        pass the `Content-Length` header and its value in the request header.

        - To add a description to an existing variable, use the `add` operation.
      tags:
        - environments
      parameters:
        - name: environmentId
          in: path
          description: The environment's ID.
          required: true
          schema:
            $ref: '#/components/schemas/environmentId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/patchEnvironmentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/patchEnvironment400Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatchEnvironmentRequestNotFoundError'
        '411':
          description: Length Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
        '413':
          description: Payload Too Large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Environments_patchEnvironment_Request'
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    environmentId:
      type: string
      title: environmentId
    EnvironmentVariablesType:
      type: string
      enum:
        - secret
        - default
      description: |
        The variable's type:
        - `secret` — The variable value is masked.
        - `default` — The variable value is visible in plain text.
      title: EnvironmentVariablesType
    environmentVariables:
      type: object
      properties:
        enabled:
          type: boolean
          description: If true, the variable is enabled.
        key:
          type: string
          description: The variable's name.
        value:
          type: string
          description: The variable's value.
        type:
          $ref: '#/components/schemas/EnvironmentVariablesType'
          description: |
            The variable's type:
            - `secret` — The variable value is masked.
            - `default` — The variable value is visible in plain text.
        description:
          type: string
          description: The variable's description.
      description: Information about the environment's variables.
      title: environmentVariables
    PatchEnvironmentAddItems:
      type: object
      properties:
        op:
          type: string
          description: The `add` operation.
        path:
          type: string
          description: >-
            The [JSON Pointer
            syntax](https://datatracker.ietf.org/doc/html/rfc6901) that
            indicates the entry to update, in `/values/#` format, where `#` is
            the entry ID. The first record begins at the `0` value.
        value:
          $ref: '#/components/schemas/environmentVariables'
      required:
        - op
        - path
        - value
      title: PatchEnvironmentAddItems
    patchEnvironmentAdd:
      type: array
      items:
        $ref: '#/components/schemas/PatchEnvironmentAddItems'
      title: patchEnvironmentAdd
    PatchEnvironmentNameItems:
      type: object
      properties:
        op:
          type: string
          description: The `replace` operation.
        path:
          type: string
          description: The `/name` value.
        value:
          type: string
          description: The environment's updated name.
      required:
        - op
        - path
        - value
      description: Information about the environment.
      title: PatchEnvironmentNameItems
    patchEnvironmentName:
      type: array
      items:
        $ref: '#/components/schemas/PatchEnvironmentNameItems'
      title: patchEnvironmentName
    PatchEnvironmentReplaceItems:
      type: object
      properties:
        op:
          type: string
          description: The `replace` operation.
        path:
          type: string
          description: >
            The [JSON Pointer
            syntax](https://datatracker.ietf.org/doc/html/rfc6901) that
            indicates the entry to update, in `/values/#/{value}` format, where:

            - `#` — The entry ID. The first record begins at the `0` value.

            - `{value}` — The variable property to update. Accepts `key`,
            `value`, `type`, and `enable`.
        value:
          type: string
          description: The variable's value.
      required:
        - op
        - path
        - value
      title: PatchEnvironmentReplaceItems
    patchEnvironmentReplace:
      type: array
      items:
        $ref: '#/components/schemas/PatchEnvironmentReplaceItems'
      title: patchEnvironmentReplace
    PatchEnvironmentRemoveItems:
      type: object
      properties:
        op:
          type: string
          description: The `remove` operation.
        path:
          type: string
          description: >-
            The [JSON Pointer
            syntax](https://datatracker.ietf.org/doc/html/rfc6901) that
            indicates the entry to update, in `/values/#` format, where `#` is
            the entry ID. The first record begins at the `0` value.
      required:
        - op
        - path
      title: PatchEnvironmentRemoveItems
    patchEnvironmentRemove:
      type: array
      items:
        $ref: '#/components/schemas/PatchEnvironmentRemoveItems'
      title: patchEnvironmentRemove
    Environments_patchEnvironment_Request:
      oneOf:
        - $ref: '#/components/schemas/patchEnvironmentAdd'
        - $ref: '#/components/schemas/patchEnvironmentName'
        - $ref: '#/components/schemas/patchEnvironmentReplace'
        - $ref: '#/components/schemas/patchEnvironmentRemove'
      title: Environments_patchEnvironment_Request
    patchEnvironmentInfo:
      type: object
      properties:
        id:
          type: string
          description: The environment's ID.
        name:
          type: string
          description: The environment's name.
        owner:
          type: string
          description: The ID of environment's owner.
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the environment was created.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the environment was last updated.
        values:
          type: array
          items:
            $ref: '#/components/schemas/environmentVariables'
          description: Information about the environment's variables.
        uid:
          type: string
          format: uid
          description: The environment's unique ID.
      description: Information about the environment.
      title: patchEnvironmentInfo
    patchEnvironmentResponse:
      type: object
      properties:
        environment:
          $ref: '#/components/schemas/patchEnvironmentInfo'
      title: patchEnvironmentResponse
    PatchEnvironment400ErrorDetail:
      oneOf:
        - type: string
        - type: array
          items:
            type: string
      description: Details about the occurrence of the error.
      title: PatchEnvironment400ErrorDetail
    patchEnvironment400Error:
      type: object
      properties:
        title:
          type: string
          description: A short summary of the error.
        status:
          type: number
          format: double
          description: The error's HTTP status code.
        detail:
          $ref: '#/components/schemas/PatchEnvironment400ErrorDetail'
          description: Details about the occurrence of the error.
        type:
          type: string
          format: uri
          description: The error type.
        instance:
          type: string
          description: >-
            The URI reference that identifies the specific occurrence of the
            problem.
      title: patchEnvironment400Error
    commonErrorTypeTitleDetailStatusInstance:
      type: object
      properties:
        type:
          type: string
          format: uri-reference
          description: >-
            The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that
            identifies the type of problem.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: An explanation about the problem.
        status:
          type: integer
          description: The HTTP status code generated by the origin server.
        instance:
          type: string
          description: >-
            The URI reference that identifies the specific occurrence of the
            problem.
      title: commonErrorTypeTitleDetailStatusInstance
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    PatchEnvironmentRequestNotFoundError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: PatchEnvironmentRequestNotFoundError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples

### Successful Response



**Request**

```json
undefined
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript Successful Response
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Successful Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Successful Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add Variable



**Request**

```json
[
  {
    "op": "add",
    "path": "/values/1",
    "value": {
      "description": "The collection's ID.",
      "enabled": true,
      "key": "collectionId",
      "type": "default",
      "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
    }
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:56:19.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "secret"
      },
      {
        "enabled": true,
        "key": "collectionId",
        "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
        "type": "default",
        "description": "The collection's ID."
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Add Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "add",
        "path": "/values/1",
        "value": {
            "description": "The collection's ID.",
            "enabled": True,
            "key": "collectionId",
            "type": "default",
            "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
        }
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/values/1","value":{"description":"The collection\'s ID.","enabled":true,"key":"collectionId","type":"default","value":"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/1\",\n    \"value\": {\n      \"description\": \"The collection's ID.\",\n      \"enabled\": true,\n      \"key\": \"collectionId\",\n      \"type\": \"default\",\n      \"value\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n    }\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/1\",\n    \"value\": {\n      \"description\": \"The collection's ID.\",\n      \"enabled\": true,\n      \"key\": \"collectionId\",\n      \"type\": \"default\",\n      \"value\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n    }\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Add Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/1\",\n    \"value\": {\n      \"description\": \"The collection's ID.\",\n      \"enabled\": true,\n      \"key\": \"collectionId\",\n      \"type\": \"default\",\n      \"value\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n    }\n  }\n]")
  .asString();
```

```php Add Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "add",
    "path": "/values/1",
    "value": {
      "description": "The collection\'s ID.",
      "enabled": true,
      "key": "collectionId",
      "type": "default",
      "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
    }
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Add Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/1\",\n    \"value\": {\n      \"description\": \"The collection's ID.\",\n      \"enabled\": true,\n      \"key\": \"collectionId\",\n      \"type\": \"default\",\n      \"value\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\"\n    }\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "add",
    "path": "/values/1",
    "value": [
      "description": "The collection's ID.",
      "enabled": true,
      "key": "collectionId",
      "type": "default",
      "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Remove Variables



**Request**

```json
undefined
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:16:18.000Z",
    "updatedAt": "2025-03-10T15:17:04.000Z",
    "values": [],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove Variables
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript Remove Variables
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Remove Variables
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Remove Variables
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Remove Variables
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Remove Variables
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Remove Variables
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Remove Variables
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Update Variable



**Request**

```json
[
  {
    "op": "replace",
    "path": "/values/0/key",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/enabled",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/value",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/type",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/description",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:56:19.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "secret",
        "description": "A valid API key."
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Update Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "replace",
        "path": "/values/0/key",
        "value": {}
    },
    {
        "op": "replace",
        "path": "/values/0/enabled",
        "value": {}
    },
    {
        "op": "replace",
        "path": "/values/0/value",
        "value": {}
    },
    {
        "op": "replace",
        "path": "/values/0/type",
        "value": {}
    },
    {
        "op": "replace",
        "path": "/values/0/description",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Update Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/values/0/key","value":{}},{"op":"replace","path":"/values/0/enabled","value":{}},{"op":"replace","path":"/values/0/value","value":{}},{"op":"replace","path":"/values/0/type","value":{}},{"op":"replace","path":"/values/0/description","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Update Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/key\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/value\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/type\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Update Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/key\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/value\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/type\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Update Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/key\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/value\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/type\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Update Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "replace",
    "path": "/values/0/key",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/enabled",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/value",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/type",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/0/description",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Update Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/key\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/value\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/type\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "replace",
    "path": "/values/0/key",
    "value": []
  ],
  [
    "op": "replace",
    "path": "/values/0/enabled",
    "value": []
  ],
  [
    "op": "replace",
    "path": "/values/0/value",
    "value": []
  ],
  [
    "op": "replace",
    "path": "/values/0/type",
    "value": []
  ],
  [
    "op": "replace",
    "path": "/values/0/description",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add Description to Existing Variable



**Request**

```json
[
  {
    "op": "add",
    "path": "/values/0/description",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Add Description to Existing Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "add",
        "path": "/values/0/description",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add Description to Existing Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/values/0/description","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add Description to Existing Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add Description to Existing Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Add Description to Existing Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Add Description to Existing Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "add",
    "path": "/values/0/description",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Add Description to Existing Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0/description\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add Description to Existing Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "add",
    "path": "/values/0/description",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Enable Variable



**Request**

```json
[
  {
    "op": "replace",
    "path": "/values/0/enabled",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Enable Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "replace",
        "path": "/values/0/enabled",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Enable Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/values/0/enabled","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Enable Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Enable Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Enable Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Enable Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "replace",
    "path": "/values/0/enabled",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Enable Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/0/enabled\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Enable Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "replace",
    "path": "/values/0/enabled",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Remove Variable



**Request**

```json
[
  {
    "op": "remove",
    "path": "/values/0",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "remove",
        "path": "/values/0",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Remove Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/values/0","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Remove Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Remove Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Remove Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Remove Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "remove",
    "path": "/values/0",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Remove Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/values/0",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Remove Multiple Variables



**Request**

```json
[
  {
    "op": "remove",
    "path": "/values/4",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/3",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/2",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/1",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove Multiple Variables
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "remove",
        "path": "/values/4",
        "value": {}
    },
    {
        "op": "remove",
        "path": "/values/3",
        "value": {}
    },
    {
        "op": "remove",
        "path": "/values/2",
        "value": {}
    },
    {
        "op": "remove",
        "path": "/values/1",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Remove Multiple Variables
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/values/4","value":{}},{"op":"remove","path":"/values/3","value":{}},{"op":"remove","path":"/values/2","value":{}},{"op":"remove","path":"/values/1","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Remove Multiple Variables
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/4\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/3\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/2\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Remove Multiple Variables
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/4\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/3\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/2\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Remove Multiple Variables
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/4\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/3\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/2\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Remove Multiple Variables
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "remove",
    "path": "/values/4",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/3",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/2",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/1",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Remove Multiple Variables
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/4\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/3\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/2\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove Multiple Variables
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/values/4",
    "value": []
  ],
  [
    "op": "remove",
    "path": "/values/3",
    "value": []
  ],
  [
    "op": "remove",
    "path": "/values/2",
    "value": []
  ],
  [
    "op": "remove",
    "path": "/values/1",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Remove and Add Variable



**Request**

```json
[
  {
    "op": "remove",
    "path": "/values/1",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/0",
    "value": {}
  },
  {
    "op": "add",
    "path": "/values/0",
    "value": {
      "description": "A valid API key.",
      "enabled": true,
      "key": "x-api-key",
      "type": "default",
      "value": "{{x-api-key}}"
    }
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove and Add Variable
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "remove",
        "path": "/values/1",
        "value": {}
    },
    {
        "op": "remove",
        "path": "/values/0",
        "value": {}
    },
    {
        "op": "add",
        "path": "/values/0",
        "value": {
            "description": "A valid API key.",
            "enabled": True,
            "key": "x-api-key",
            "type": "default",
            "value": "{{x-api-key}}"
        }
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Remove and Add Variable
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/values/1","value":{}},{"op":"remove","path":"/values/0","value":{}},{"op":"add","path":"/values/0","value":{"description":"A valid API key.","enabled":true,"key":"x-api-key","type":"default","value":"{{x-api-key}}"}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Remove and Add Variable
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0\",\n    \"value\": {\n      \"description\": \"A valid API key.\",\n      \"enabled\": true,\n      \"key\": \"x-api-key\",\n      \"type\": \"default\",\n      \"value\": \"{{x-api-key}}\"\n    }\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Remove and Add Variable
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0\",\n    \"value\": {\n      \"description\": \"A valid API key.\",\n      \"enabled\": true,\n      \"key\": \"x-api-key\",\n      \"type\": \"default\",\n      \"value\": \"{{x-api-key}}\"\n    }\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Remove and Add Variable
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0\",\n    \"value\": {\n      \"description\": \"A valid API key.\",\n      \"enabled\": true,\n      \"key\": \"x-api-key\",\n      \"type\": \"default\",\n      \"value\": \"{{x-api-key}}\"\n    }\n  }\n]")
  .asString();
```

```php Remove and Add Variable
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "remove",
    "path": "/values/1",
    "value": {}
  },
  {
    "op": "remove",
    "path": "/values/0",
    "value": {}
  },
  {
    "op": "add",
    "path": "/values/0",
    "value": {
      "description": "A valid API key.",
      "enabled": true,
      "key": "x-api-key",
      "type": "default",
      "value": "{{x-api-key}}"
    }
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Remove and Add Variable
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/1\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/0\",\n    \"value\": {\n      \"description\": \"A valid API key.\",\n      \"enabled\": true,\n      \"key\": \"x-api-key\",\n      \"type\": \"default\",\n      \"value\": \"{{x-api-key}}\"\n    }\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove and Add Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/values/1",
    "value": []
  ],
  [
    "op": "remove",
    "path": "/values/0",
    "value": []
  ],
  [
    "op": "add",
    "path": "/values/0",
    "value": [
      "description": "A valid API key.",
      "enabled": true,
      "key": "x-api-key",
      "type": "default",
      "value": "{{x-api-key}}"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Update Environment Name



**Request**

```json
[
  {
    "op": "replace",
    "path": "/name",
    "value": {}
  }
]
```

**Response**

```json
{
  "environment": {
    "id": "5daabc50-8451-43f6-922d-96b403b4f28e",
    "name": "Test API Environment",
    "owner": "12345678",
    "createdAt": "2025-03-10T15:37:00.000Z",
    "updatedAt": "2025-03-10T15:54:02.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "value": "{{x-api-key}}",
        "type": "default"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Update Environment Name
import requests

url = "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

payload = [
    {
        "op": "replace",
        "path": "/name",
        "value": {}
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Update Environment Name
const url = 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/name","value":{}}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Update Environment Name
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e"

	payload := strings.NewReader("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/name\",\n    \"value\": {}\n  }\n]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Update Environment Name
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/name\",\n    \"value\": {}\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java Update Environment Name
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/name\",\n    \"value\": {}\n  }\n]")
  .asString();
```

```php Update Environment Name
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "replace",
    "path": "/name",
    "value": {}
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Update Environment Name
using RestSharp;

var client = new RestClient("https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/name\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Environment Name
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "replace",
    "path": "/name",
    "value": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```