> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Update an environment

PATCH https://api.postman.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.
- Only [shared variable](https://learning.postman.com/docs/use/send-requests/variables/variables/#share-variable-values) values can be modified through the Postman API. A shared variable is an environment variable with its value synced and stored in the Postman cloud, and can be accessed by your teammates in the environment's workspace.


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

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `environmentId` (string, required) — The environment's ID.

### Body (application/json)

This endpoint expects an Environments_patchEnvironment_Request.

- `Environments_patchEnvironment_Request`
  - Add Variable: list of PatchEnvironmentAddItems
  - Update Environment Name: list of PatchEnvironmentNameItems
  - Update Variable: list of PatchEnvironmentReplaceItems
  - Remove Variable: list of PatchEnvironmentRemoveItems

## Response

### 200

Successful Response

- `environment` (patchEnvironmentInfo, optional) — Information about the environment.

## Errors

### 400 Bad Request Error

Bad Request

- `title` (string, optional) — A short summary of the error.
- `status` (double, optional) — The error's HTTP status code.
- `detail` (PatchEnvironment400ErrorDetail, optional) — Details about the occurrence of the error.
- `type` (string, optional) — The error type.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 403 Forbidden Error

Forbidden

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 404 Not Found Error

Not Found

- `PatchEnvironmentRequestNotFoundError`
  - Error (Type, Title, Detail, Status, Instance): commonErrorTypeTitleDetailStatusInstance
  - Error (Name, Message): commonErrorNameMessage

### 411 Length Required Error

Length Required

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 413 Content Too Large Error

Payload Too Large

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 500 Internal Server Error

Internal Server Error

- `PatchEnvironmentRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### PatchEnvironmentAddItems

- `op` (string, required) — The `add` operation.
- `path` (string, required) — 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` (PatchEnvironmentAddItemsValue, required) — The environment variable to add.

### PatchEnvironmentNameItems

Information about the environment.

- `op` (string, required) — The `replace` operation.
- `path` (string, required) — The `/name` value.
- `value` (string, required) — The environment's updated name.

### PatchEnvironmentReplaceItems

- `op` (string, required) — The `replace` operation.
- `path` (string, required) — 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` (string, required) — The variable's value.

### PatchEnvironmentRemoveItems

- `op` (string, required) — The `remove` operation.
- `path` (string, required) — 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.

### patchEnvironmentInfo

Information about the environment.

- `id` (string, optional) — The environment's ID.
- `name` (string, optional) — The environment's name.
- `owner` (string, optional) — The ID of environment's owner.
- `createdAt` (datetime, optional) — The date and time at which the environment was created.
- `updatedAt` (datetime, optional) — The date and time at which the environment was last updated.
- `values` (list of PatchEnvironmentInfoValuesItems, optional) — Information about the environment's variables.
- `uid` (string, optional) — The environment's unique ID.

### PatchEnvironment400ErrorDetail

Details about the occurrence of the error.

- string
- list of string

### commonErrorTypeTitleDetailStatusInstance

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### PatchEnvironmentAddItemsValue

The environment variable to add.

- Add Variable: environmentVariables
- Add Secret Variable: environmentVaultVariables

### PatchEnvironmentInfoValuesItems

- Add Variable: environmentVariables
- Add Secret Variable: environmentVaultVariables

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### environmentVariables

Information about the variable.

- `enabled` (boolean, optional) — If true, the variable is enabled.
- `key` (string, optional) — The variable's name.
- `value` (string, optional) — The variable's value.
- `type` (enum, optional) — The variable's type: - `secret` — The variable value is masked. - `default` — The variable value is visible in plain text.
  - Allowed values: `secret`, `default`
- `description` (string, optional) — The variable's description.

### environmentVaultVariables

Information about the variable stored in the Postman Vault. This property only returns when a variable is defined as secret.

- `enabled` (boolean, optional) — If true, the variable is enabled.
- `key` (string, optional) — The variable's name.
- `value` (string, optional) — The variable's value.
- `type` (enum, optional) — The variable's type: - `secret` — The variable value is masked. - `default` — The variable value is visible in plain text.
  - Allowed values: `secret`, `default`
- `secret` (boolean, optional) — If true, the variable is marked as secret and its value is retrieved from the mentioned provider in the source field.
- `source` (environmentVariableSource, optional) — Information about the source of the variable's value.
- `description` (string, optional) — The variable's description.

### environmentVariableSource

Information about the source of the variable's value.

- `postman` (EnvironmentVariableSourcePostman, optional) — Information about the Postman-specific source of the variable's value.
- `provider` (enum, optional) — The secret's provider.
  - Allowed values: `postman`

### EnvironmentVariableSourcePostman

Information about the Postman-specific source of the variable's value.

- `secretId` (string, optional) — The variable's secret ID.
- `type` (enum, optional) — The variable's type: - `cloud` — The variable value is synced and stored in the Postman Cloud.
  - Allowed values: `cloud`
- `vaultId` (string, optional) — The variable's ID in the Postman Vault.

## Examples

### 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:56:19.000Z",
    "values": [
      {
        "enabled": true,
        "key": "x-api-key",
        "type": "secret",
        "value": "{{x-api-key}}"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Update Environment Name
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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 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",
        "type": "secret",
        "value": "{{x-api-key}}"
      },
      {
        "description": "The collection's ID.",
        "enabled": true,
        "key": "collectionId",
        "type": "default",
        "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Add Variable
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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": [
      {
        "description": "A valid API key.",
        "enabled": false,
        "key": "x-api-key",
        "type": "secret",
        "value": "{{x-api-key}}"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Add Description to Existing Variable
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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",
        "type": "secret",
        "value": "{{x-api-key}}"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Enable Variable
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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 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": {}
  },
  {
    "op": "replace",
    "path": "/values/1/secret",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/1/source",
    "value": {
      "postman": {
        "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
        "type": "cloud",
        "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
      },
      "provider": "postman"
    }
  }
]
```

**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": [
      {
        "description": "A valid API key.",
        "enabled": false,
        "key": "x-api-key",
        "type": "secret",
        "value": "{{x-api-key}}"
      },
      {
        "enabled": true,
        "key": "apiKey",
        "secret": true,
        "source": {
          "postman": {
            "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
            "type": "cloud",
            "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
          },
          "provider": "postman"
        },
        "type": "default",
        "value": ""
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Update Variable
import requests

url = "https://api.postman.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": {}
    },
    {
        "op": "replace",
        "path": "/values/1/secret",
        "value": {}
    },
    {
        "op": "replace",
        "path": "/values/1/source",
        "value": {
            "postman": {
                "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
                "type": "cloud",
                "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
            },
            "provider": "postman"
        }
    }
]
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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/https/learning.postman.com/values/0/key","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/0/enabled","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/0/value","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/0/type","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/0/description","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/1/secret","value":{}},{"op":"replace","path":"/https/learning.postman.com/values/1/source","value":{"postman":{"secretId":"082351ca-810e-476b-8437-d098b20fba4b","type":"cloud","vaultId":"04084949-0dda-4735-ace5-f83038f7b200"},"provider":"postman"}}]'
};

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.postman.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  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/secret\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/source\",\n    \"value\": {\n      \"postman\": {\n        \"secretId\": \"082351ca-810e-476b-8437-d098b20fba4b\",\n        \"type\": \"cloud\",\n        \"vaultId\": \"04084949-0dda-4735-ace5-f83038f7b200\"\n      },\n      \"provider\": \"postman\"\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 Update Variable
require 'uri'
require 'net/http'

url = URI("https://api.postman.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  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/secret\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/source\",\n    \"value\": {\n      \"postman\": {\n        \"secretId\": \"082351ca-810e-476b-8437-d098b20fba4b\",\n        \"type\": \"cloud\",\n        \"vaultId\": \"04084949-0dda-4735-ace5-f83038f7b200\"\n      },\n      \"provider\": \"postman\"\n    }\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.postman.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  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/secret\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/source\",\n    \"value\": {\n      \"postman\": {\n        \"secretId\": \"082351ca-810e-476b-8437-d098b20fba4b\",\n        \"type\": \"cloud\",\n        \"vaultId\": \"04084949-0dda-4735-ace5-f83038f7b200\"\n      },\n      \"provider\": \"postman\"\n    }\n  }\n]")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.postman.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": {}
  },
  {
    "op": "replace",
    "path": "/values/1/secret",
    "value": {}
  },
  {
    "op": "replace",
    "path": "/values/1/source",
    "value": {
      "postman": {
        "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
        "type": "cloud",
        "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
      },
      "provider": "postman"
    }
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Update Variable
using RestSharp;

var client = new RestClient("https://api.postman.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  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/secret\",\n    \"value\": {}\n  },\n  {\n    \"op\": \"replace\",\n    \"path\": \"/values/1/source\",\n    \"value\": {\n      \"postman\": {\n        \"secretId\": \"082351ca-810e-476b-8437-d098b20fba4b\",\n        \"type\": \"cloud\",\n        \"vaultId\": \"04084949-0dda-4735-ace5-f83038f7b200\"\n      },\n      \"provider\": \"postman\"\n    }\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": []
  ],
  [
    "op": "replace",
    "path": "/values/1/secret",
    "value": []
  ],
  [
    "op": "replace",
    "path": "/values/1/source",
    "value": [
      "postman": [
        "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
        "type": "cloud",
        "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
      ],
      "provider": "postman"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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 Secret Variable

**Request**

```json
[
  {
    "op": "add",
    "path": "/values/1",
    "value": {
      "enabled": true,
      "key": "apiKey",
      "secret": true,
      "source": {
        "postman": {
          "secretId": "f5fa5280-18a3-4d93-a706-2fe48b1007dc",
          "type": "cloud",
          "vaultId": "453a311c-c5b4-4627-8e51-a3bd48953734"
        },
        "provider": "postman"
      },
      "type": "default",
      "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",
        "type": "secret",
        "value": "{{x-api-key}}"
      },
      {
        "description": "The collection's ID.",
        "enabled": true,
        "key": "collectionId",
        "type": "default",
        "value": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
      },
      {
        "enabled": true,
        "key": "apiKey",
        "secret": true,
        "source": {
          "postman": {
            "secretId": "f5fa5280-18a3-4d93-a706-2fe48b1007dc",
            "type": "cloud",
            "vaultId": "453a311c-c5b4-4627-8e51-a3bd48953734"
          },
          "provider": "postman"
        },
        "type": "default",
        "value": ""
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Add Secret Variable
import requests

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

payload = [
    {
        "op": "add",
        "path": "/values/1",
        "value": {
            "enabled": True,
            "key": "apiKey",
            "secret": True,
            "source": {
                "postman": {
                    "secretId": "f5fa5280-18a3-4d93-a706-2fe48b1007dc",
                    "type": "cloud",
                    "vaultId": "453a311c-c5b4-4627-8e51-a3bd48953734"
                },
                "provider": "postman"
            },
            "type": "default",
            "value": ""
        }
    }
]
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add Secret Variable
const url = 'https://api.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/https/learning.postman.com/values/1","value":{"enabled":true,"key":"apiKey","secret":true,"source":{"postman":{"secretId":"f5fa5280-18a3-4d93-a706-2fe48b1007dc","type":"cloud","vaultId":"453a311c-c5b4-4627-8e51-a3bd48953734"},"provider":"postman"},"type":"default","value":""}}]'
};

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

```go Add Secret Variable
package main

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

func main() {

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

	payload := strings.NewReader("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/values/1\",\n    \"value\": {\n      \"enabled\": true,\n      \"key\": \"apiKey\",\n      \"secret\": true,\n      \"source\": {\n        \"postman\": {\n          \"secretId\": \"f5fa5280-18a3-4d93-a706-2fe48b1007dc\",\n          \"type\": \"cloud\",\n          \"vaultId\": \"453a311c-c5b4-4627-8e51-a3bd48953734\"\n        },\n        \"provider\": \"postman\"\n      },\n      \"type\": \"default\",\n      \"value\": \"\"\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 Secret Variable
require 'uri'
require 'net/http'

url = URI("https://api.postman.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      \"enabled\": true,\n      \"key\": \"apiKey\",\n      \"secret\": true,\n      \"source\": {\n        \"postman\": {\n          \"secretId\": \"f5fa5280-18a3-4d93-a706-2fe48b1007dc\",\n          \"type\": \"cloud\",\n          \"vaultId\": \"453a311c-c5b4-4627-8e51-a3bd48953734\"\n        },\n        \"provider\": \"postman\"\n      },\n      \"type\": \"default\",\n      \"value\": \"\"\n    }\n  }\n]"

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

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

HttpResponse<String> response = Unirest.patch("https://api.postman.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      \"enabled\": true,\n      \"key\": \"apiKey\",\n      \"secret\": true,\n      \"source\": {\n        \"postman\": {\n          \"secretId\": \"f5fa5280-18a3-4d93-a706-2fe48b1007dc\",\n          \"type\": \"cloud\",\n          \"vaultId\": \"453a311c-c5b4-4627-8e51-a3bd48953734\"\n        },\n        \"provider\": \"postman\"\n      },\n      \"type\": \"default\",\n      \"value\": \"\"\n    }\n  }\n]")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e', [
  'body' => '[
  {
    "op": "add",
    "path": "/values/1",
    "value": {
      "enabled": true,
      "key": "apiKey",
      "secret": true,
      "source": {
        "postman": {
          "secretId": "f5fa5280-18a3-4d93-a706-2fe48b1007dc",
          "type": "cloud",
          "vaultId": "453a311c-c5b4-4627-8e51-a3bd48953734"
        },
        "provider": "postman"
      },
      "type": "default",
      "value": ""
    }
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Add Secret Variable
using RestSharp;

var client = new RestClient("https://api.postman.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      \"enabled\": true,\n      \"key\": \"apiKey\",\n      \"secret\": true,\n      \"source\": {\n        \"postman\": {\n          \"secretId\": \"f5fa5280-18a3-4d93-a706-2fe48b1007dc\",\n          \"type\": \"cloud\",\n          \"vaultId\": \"453a311c-c5b4-4627-8e51-a3bd48953734\"\n        },\n        \"provider\": \"postman\"\n      },\n      \"type\": \"default\",\n      \"value\": \"\"\n    }\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add Secret Variable
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "add",
    "path": "/values/1",
    "value": [
      "enabled": true,
      "key": "apiKey",
      "secret": true,
      "source": [
        "postman": [
          "secretId": "f5fa5280-18a3-4d93-a706-2fe48b1007dc",
          "type": "cloud",
          "vaultId": "453a311c-c5b4-4627-8e51-a3bd48953734"
        ],
        "provider": "postman"
      ],
      "type": "default",
      "value": ""
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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()
```

### Unshare Variable

**Request**

```json
[
  {
    "op": "remove",
    "path": "/values/0/key",
    "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": [
      {
        "description": "A valid API key.",
        "enabled": false,
        "key": "x-api-key",
        "type": "secret",
        "value": "{{x-api-key}}"
      },
      {
        "enabled": true,
        "key": "apiKey",
        "secret": true,
        "source": {
          "postman": {
            "secretId": "082351ca-810e-476b-8437-d098b20fba4b",
            "type": "cloud",
            "vaultId": "04084949-0dda-4735-ace5-f83038f7b200"
          },
          "provider": "postman"
        },
        "type": "default",
        "value": ""
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Unshare Variable
import requests

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

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

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

print(response.json())
```

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

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

```go Unshare Variable
package main

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

func main() {

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

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/values/0/key\",\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 Unshare Variable
require 'uri'
require 'net/http'

url = URI("https://api.postman.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/key\",\n    \"value\": {}\n  }\n]"

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

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

HttpResponse<String> response = Unirest.patch("https://api.postman.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/key\",\n    \"value\": {}\n  }\n]")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Unshare Variable
using RestSharp;

var client = new RestClient("https://api.postman.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/key\",\n    \"value\": {}\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Unshare Variable
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.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:16:18.000Z",
    "updatedAt": "2025-03-10T15:17:04.000Z",
    "values": [],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove Variable
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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",
        "type": "default",
        "value": "{{x-api-key}}"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove Multiple Variables
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/https/learning.postman.com/values/4","value":{}},{"op":"remove","path":"/https/learning.postman.com/values/3","value":{}},{"op":"remove","path":"/https/learning.postman.com/values/2","value":{}},{"op":"remove","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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": [
      {
        "description": "A valid API key.",
        "enabled": true,
        "key": "x-api-key",
        "type": "default",
        "value": "{{x-api-key}}"
      }
    ],
    "uid": "12345678-5daabc50-8451-43f6-922d-96b403b4f28e"
  }
}
```

**SDK Code**

```python Remove and Add Variable
import requests

url = "https://api.postman.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.postman.com/environments/5daabc50-8451-43f6-922d-96b403b4f28e';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/https/learning.postman.com/values/1","value":{}},{"op":"remove","path":"/https/learning.postman.com/values/0","value":{}},{"op":"add","path":"/https/learning.postman.com/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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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()
```