Create environment
Approval settings
You cannot configure approval settings when you create a new environment. Use Update environment to update approval settings.
The
approvalSettingsandresourceApprovalSettingskeys are only returned when the approvals feature is enabled.
Create a new environment in a specified project with a given name, key, swatch color, and default TTL.
Authorization
ApiKey read, writeIn: header
Scope: read, write
Path Parameters
The project key
stringRequest Body
application/json
A human-friendly name for the new environment
A project-unique key for the new environment
A color to indicate this environment in the UI
The default time (in minutes) that the PHP SDK can cache feature flag rules locally
Ensures that one end user of the client-side SDK cannot inspect the variations for another end user
The initial value of trackEvents for flags created in this environment. Does not affect existing flags. Required for Data Export, but doesn't enable Data Export on its own.
Requires confirmation for all flag and segment changes via the UI in this environment
Requires comments for all flag and segment changes via the UI in this environment
Tags to apply to the new environment
Indicates that the new environment created will be cloned from the provided source environment
Whether the environment is critical
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v2/projects/string/environments" \ -H "Content-Type: application/json" \ -d '{ "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, "_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}List environments GET
Return a list of environments for the specified project. By default, this returns the first 20 environments. Page through this list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the `_links` field that returns. If those links do not appear, the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page, because there is no previous page and you cannot return to the first page when you are already on the first page. ### Filtering environments LaunchDarkly supports the following fields for filters: - `query` is a string that matches against the environments' names and keys. It is not case sensitive. - `tags` is a `+`-separated list of environment tags. It filters the list of environments that have all of the tags in the list. - `critical` is a boolean filter. `critical:true` returns only environments marked as critical, and `critical:false` returns only non-critical environments. For example, the filter `filter=query:abc,tags:tag-1+tag-2` matches environments with the string `abc` in their name or key and also are tagged with `tag-1` and `tag-2`. The filter is not case-sensitive. The documented values for `filter` query parameters are prior to URL encoding. For example, the `+` in `filter=tags:tag-1+tag-2` must be encoded to `%2B`. ### Sorting environments LaunchDarkly supports the following fields for sorting: - `createdOn` sorts by the creation date of the environment. - `critical` sorts by whether the environments are marked as critical. - `name` sorts by environment name. For example, `sort=name` sorts the response by environment name in ascending order.
Get environment GET
> ### Approval settings > > The `approvalSettings` and `resourceApprovalSettings` keys are only returned when the [approvals](https://launchdarkly.com/docs/home/releases/approvals/) feature is enabled. Get an environment given a project and key.