Environments

Update environment

PATCH
/api/v2/projects/{projectKey}/environments/{environmentKey}

Update an environment. Updating an environment uses a JSON patch representation of the desired changes. To learn more, read Updates.

To update fields in the environment object that are arrays, set the path to the name of the field and then append /<array index>. Using /0 appends to the beginning of the array.

Approval settings

This request only returns the approvalSettings and resourceApprovalSettings if the approvals feature is enabled.

Only the canReviewOwnRequest, canApplyDeclinedChanges, minNumApprovals, required and requiredApprovalTagsfields are editable.

If you try to patch the environment by setting both required and requiredApprovalTags, the request fails and an error appears. You can specify either required approvals for all flags in an environment or those with specific tags, but not both.

Authorization

ApiKey read, write
Authorization<token>

In: header

Scope: read, write

Path Parameters

projectKey*string

The project key

Formatstring
environmentKey*string

The environment key

Formatstring

Request Body

application/json

[index: integer]?

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/api/v2/projects/string/environments/string" \  -H "Content-Type: application/json" \  -d '[    {      "op": "replace",      "path": "/requireComments",      "value": true    }  ]'
{  "_links": {    "self": {      "href": "/api/v2/projects/my-project/environments/my-environment",      "type": "application/json"    }  },  "_id": "57be1db38b75bf0772d11384",  "key": "environment-key-123abc",  "name": "My Environment",  "apiKey": "sdk-xxx",  "mobileKey": "mob-xxx",  "color": "F5A623",  "defaultTtl": 5,  "secureMode": true,  "_access": {    "denied": [      {        "action": "string",        "reason": {          "resources": [            "proj/*:env/*;qa_*:/flag/*"          ],          "notResources": [            "string"          ],          "actions": [            "*"          ],          "notActions": [            "string"          ],          "effect": "allow",          "role_name": "string"        }      }    ],    "allowed": [      {        "action": "string",        "reason": {          "resources": [            "proj/*:env/*;qa_*:/flag/*"          ],          "notResources": [            "string"          ],          "actions": [            "*"          ],          "notActions": [            "string"          ],          "effect": "allow",          "role_name": "string"        }      }    ]  },  "defaultTrackEvents": false,  "requireComments": true,  "confirmChanges": true,  "tags": [    "ops"  ],  "approvalSettings": {    "required": true,    "bypassApprovalsForPendingChanges": false,    "minNumApprovals": 1,    "canReviewOwnRequest": false,    "canApplyDeclinedChanges": true,    "autoApplyApprovedChanges": true,    "serviceKind": "launchdarkly",    "serviceConfig": {},    "requiredApprovalTags": [      "require-approval"    ],    "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258"  },  "resourceApprovalSettings": {    "property1": {      "required": true,      "bypassApprovalsForPendingChanges": false,      "minNumApprovals": 1,      "canReviewOwnRequest": false,      "canApplyDeclinedChanges": true,      "autoApplyApprovedChanges": true,      "serviceKind": "launchdarkly",      "serviceConfig": {},      "requiredApprovalTags": [        "require-approval"      ],      "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258"    },    "property2": {      "required": true,      "bypassApprovalsForPendingChanges": false,      "minNumApprovals": 1,      "canReviewOwnRequest": false,      "canApplyDeclinedChanges": true,      "autoApplyApprovedChanges": true,      "serviceKind": "launchdarkly",      "serviceConfig": {},      "requiredApprovalTags": [        "require-approval"      ],      "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258"    }  },  "critical": true}