Set the default release plan
curl --request PUT \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'LD-API-Version: <ld-api-version>' \
--data '
{
"key": "checkout-flow-rollout"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan"
payload = { "key": "checkout-flow-rollout" }
headers = {
"LD-API-Version": "<ld-api-version>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'LD-API-Version': '<ld-api-version>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({key: 'checkout-flow-rollout'})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'checkout-flow-rollout'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"LD-API-Version: <ld-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan"
payload := strings.NewReader("{\n \"key\": \"checkout-flow-rollout\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("LD-API-Version", "<ld-api-version>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan")
.header("LD-API-Version", "<ld-api-version>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"checkout-flow-rollout\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["LD-API-Version"] = '<ld-api-version>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"checkout-flow-rollout\"\n}"
response = http.request(request)
puts response.read_body{
"releaseMethod": "progressive_release",
"createdAt": 6,
"default": true,
"progressiveRelease": {
"advancementMode": "manual",
"metrics": {
"key": {
"autoRollback": false,
"isGroup": true
}
},
"randomizationUnit": "user",
"cleanupBehavior": "remove_rules_and_update_default_rule",
"phases": [
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
},
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
}
]
},
"name": "name",
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"version": 0,
"key": "key",
"environmentKey": "environmentKey",
"updatedAt": 1
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Set the default release plan
Set the plan with the given key as the environment’s default, atomically replacing whatever was default before. Each plan whose default flag changes has its version incremented by 1. Idempotent: setting the current default again changes nothing. Rejects a key that is not an active plan in the environment, or a plan that has no randomization unit.
PUT
/
api
/
v2
/
projects
/
{projectKey}
/
environments
/
{environmentKey}
/
default-release-plan
Set the default release plan
curl --request PUT \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'LD-API-Version: <ld-api-version>' \
--data '
{
"key": "checkout-flow-rollout"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan"
payload = { "key": "checkout-flow-rollout" }
headers = {
"LD-API-Version": "<ld-api-version>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'LD-API-Version': '<ld-api-version>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({key: 'checkout-flow-rollout'})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'key' => 'checkout-flow-rollout'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"LD-API-Version: <ld-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan"
payload := strings.NewReader("{\n \"key\": \"checkout-flow-rollout\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("LD-API-Version", "<ld-api-version>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan")
.header("LD-API-Version", "<ld-api-version>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"checkout-flow-rollout\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["LD-API-Version"] = '<ld-api-version>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key\": \"checkout-flow-rollout\"\n}"
response = http.request(request)
puts response.read_body{
"releaseMethod": "progressive_release",
"createdAt": 6,
"default": true,
"progressiveRelease": {
"advancementMode": "manual",
"metrics": {
"key": {
"autoRollback": false,
"isGroup": true
}
},
"randomizationUnit": "user",
"cleanupBehavior": "remove_rules_and_update_default_rule",
"phases": [
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
},
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": [
"",
""
],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
}
]
},
"name": "name",
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"version": 0,
"key": "key",
"environmentKey": "environmentKey",
"updatedAt": 1
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Path Parameters
Body
application/json
The plan to set as the environment's default
Response
The now-default release plan
Show child attributes
Show child attributes
Example:
{
"advancementMode": "manual",
"metrics": {
"key": { "autoRollback": false, "isGroup": true }
},
"randomizationUnit": "user",
"cleanupBehavior": "remove_rules_and_update_default_rule",
"phases": [
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": ["", ""],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": ["", ""],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
},
{
"clauses": [
{
"op": "endsWith",
"negate": false,
"values": ["", ""],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
},
{
"op": "endsWith",
"negate": false,
"values": ["", ""],
"contextKind": "user",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"attribute": "email"
}
],
"description": "description",
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"steps": [
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
},
{
"allocation": 50000,
"durationMillis": 3600000,
"_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
}
]
}
]
}