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
Example request
{
"name": "My Environment",
"key": "environment-key-123abc",
"color": "F5A623",
"defaultTtl": 5,
"secureMode": true,
"tags": [
"ops"
],
"critical": true
}Response
Environment response
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
}