Skip to main content
POST
/
api
/
v2
/
projects
/
{projectKey}
/
environments
Create environment
curl --request POST \
  --url https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "color": "DADBEE",
  "key": "environment-key-123abc",
  "name": "My Environment"
}
'
{
  "_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,
  "defaultTrackEvents": false,
  "requireComments": true,
  "confirmChanges": true,
  "tags": [
    "ops"
  ],
  "critical": true,
  "_access": {
    "denied": [
      {
        "action": "<string>",
        "reason": {
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "notResources": [
            "<string>"
          ],
          "actions": [
            "*"
          ],
          "notActions": [
            "<string>"
          ],
          "role_name": "<string>"
        }
      }
    ],
    "allowed": [
      {
        "action": "<string>",
        "reason": {
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "notResources": [
            "<string>"
          ],
          "actions": [
            "*"
          ],
          "notActions": [
            "<string>"
          ],
          "role_name": "<string>"
        }
      }
    ]
  },
  "approvalSettings": {
    "required": true,
    "bypassApprovalsForPendingChanges": false,
    "minNumApprovals": 1,
    "canReviewOwnRequest": false,
    "canApplyDeclinedChanges": true,
    "serviceKind": "launchdarkly",
    "serviceConfig": {},
    "requiredApprovalTags": [
      "require-approval"
    ],
    "autoApplyApprovedChanges": true,
    "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258"
  },
  "resourceApprovalSettings": {}
}

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Path Parameters

projectKey
string<string>
required

The project key

Body

application/json
name
string
required

A human-friendly name for the new environment

Example:

"My Environment"

key
string
required

A project-unique key for the new environment

Example:

"environment-key-123abc"

color
string
required

A color to indicate this environment in the UI

Example:

"F5A623"

defaultTtl
integer

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

Example:

5

secureMode
boolean

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

Example:

true

defaultTrackEvents
boolean

Enables tracking detailed information for new flags by default

Example:

false

confirmChanges
boolean

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

Example:

false

requireComments
boolean

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

Example:

false

tags
string[]

Tags to apply to the new environment

Example:
["ops"]
source
object

Indicates that the new environment created will be cloned from the provided source environment

critical
boolean

Whether the environment is critical

Example:

true

Response

Environment response

The location and content type of related resources

Example:
{
"self": {
"href": "/api/v2/projects/my-project/environments/my-environment",
"type": "application/json"
}
}
_id
string
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.

Example:

"57be1db38b75bf0772d11384"

key
string
required

A project-unique key for the new environment

Example:

"environment-key-123abc"

name
string
required

A human-friendly name for the new environment

Example:

"My Environment"

apiKey
string
required

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

Example:

"sdk-xxx"

mobileKey
string
required

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

Example:

"mob-xxx"

color
string
required

The color used to indicate this environment in the UI

Example:

"F5A623"

defaultTtl
integer
required

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

Example:

5

secureMode
boolean
required

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

Example:

true

defaultTrackEvents
boolean
required

Enables tracking detailed information for new flags by default

Example:

false

requireComments
boolean
required

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

Example:

true

confirmChanges
boolean
required

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

Example:

true

tags
string[]
required

A list of tags for this environment

Example:
["ops"]
critical
boolean
required

Whether the environment is critical

Example:

true

_access
object
approvalSettings
object

Details about the approval settings for flags in this environment

resourceApprovalSettings
object

Details about the approval settings for other resources in this environment, organized by resource kind (for example, "aiconfig" and "segment")