v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
Environments

Create environment

Approval settings

The approvalSettings key is only returned when the approvals feature is enabled.

You cannot update approval settings when creating new environments. Update approval settings with the [https://launchdarkly.com/docs/api/environments/patch-environment).

Create a new environment in a specified project with a given name, key, swatch color, and default TTL.

post/api/v2/projects/{projectKey}/environments

Path parameters

projectKeystring string required

The project key

The project key

Request body

namestring required

A human-friendly name for the new environment

keystring required

A project-unique key for the new environment

colorstring required

A color to indicate this environment in the UI

defaultTtlinteger

The default time (in minutes) that the PHP SDK can cache feature flag rules locally

secureModeboolean

Ensures that one end user of the client-side SDK cannot inspect the variations for another end user

defaultTrackEventsboolean

Enables tracking detailed information for new flags by default

confirmChangesboolean

Requires confirmation for all flag and segment changes via the UI in this environment

requireCommentsboolean

Requires comments for all flag and segment changes via the UI in this environment

tagsstring[]

Tags to apply to the new environment

criticalboolean

Whether the environment is critical

Example request

{
  "name": "My Environment",
  "key": "environment-key-123abc",
  "color": "F5A623",
  "defaultTtl": 5,
  "secureMode": true,
  "tags": [
    "ops"
  ],
  "critical": true
}

Response

Environment response

_linksobject required

The location and content type of related resources

_idstring required

The ID for the environment. Use this as the client-side ID for authorization in some client-side SDKs, and to associate LaunchDarkly environments with CDN integrations in edge SDKs.

keystring required

A project-unique key for the new environment

namestring required

A human-friendly name for the new environment

apiKeystring required

The SDK key for the environment. Use this for authorization in server-side SDKs.

mobileKeystring required

The mobile key for the environment. Use this for authorization in mobile SDKs.

colorstring required

The color used to indicate this environment in the UI

defaultTtlinteger required

The default time (in minutes) that the PHP SDK can cache feature flag rules locally

secureModeboolean required

Ensures that one end user of the client-side SDK cannot inspect the variations for another end user

defaultTrackEventsboolean required

Enables tracking detailed information for new flags by default

requireCommentsboolean required

Whether members who modify flags and segments through the LaunchDarkly user interface are required to add a comment

confirmChangesboolean required

Whether members who modify flags and segments through the LaunchDarkly user interface are required to confirm those changes

tagsstring[] required

A list of tags for this environment

resourceApprovalSettingsobject

Details on the approval settings for this environment for each resource kind

criticalboolean required

Whether the environment is critical

Example response

{
  "_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": [
      {
        "reason": {
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ],
          "effect": "allow"
        }
      }
    ],
    "allowed": [
      {
        "reason": {
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ],
          "effect": "allow"
        }
      }
    ]
  },
  "requireComments": true,
  "confirmChanges": true,
  "tags": [
    "ops"
  ],
  "approvalSettings": {
    "required": true,
    "minNumApprovals": 1,
    "canApplyDeclinedChanges": true,
    "autoApplyApprovedChanges": true,
    "serviceKind": "launchdarkly",
    "serviceConfig": {},
    "requiredApprovalTags": [
      "require-approval"
    ],
    "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258"
  },
  "critical": true
}