Create scheduled changes workflow
For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Create scheduled changes for a feature flag. The changes you schedule may include any semantic patch instructions available when updating a feature flag. If the ignoreConflicts query parameter is false and there are conflicts between these instructions and existing scheduled changes, the request will fail. If the parameter is true and there are conflicts, the request will succeed.
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"comment": "Optional comment describing the scheduled changes",
"executionDate": 1718467200000,
"instructions": [
{
"kind": "turnFlagOn"
}
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes"
payload = {
"comment": "Optional comment describing the scheduled changes",
"executionDate": 1718467200000,
"instructions": [{ "kind": "turnFlagOn" }]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
comment: 'Optional comment describing the scheduled changes',
executionDate: 1718467200000,
instructions: [{kind: 'turnFlagOn'}]
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes', 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}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'comment' => 'Optional comment describing the scheduled changes',
'executionDate' => 1718467200000,
'instructions' => [
[
'kind' => 'turnFlagOn'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes"
payload := strings.NewReader("{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"_id": "12ab3c45de678910abc12345",
"_creationDate": "1654123897062",
"_maintainerId": "12ab3c45de678910abc12345",
"_version": 1,
"executionDate": "1636558831870",
"instructions": "[ { \"kind\": \"turnFlagOn\" }]",
"conflicts": "<unknown>",
"_links": {}
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "method_not_allowed",
"message": "Method not allowed"
}{
"code": "optimistic_locking_error",
"message": "Conflict. Optimistic lock error. Try again later."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Authorizations
Path Parameters
The project key
The feature flag key
The environment key
Query Parameters
Whether to succeed (true) or fail (false) when these instructions conflict with existing scheduled changes
Body
When the scheduled changes should be executed
"1636558831870"
The actions to perform on the execution date for these scheduled changes. This should be an array with a single object that looks like {"kind": "scheduled_action"}. Supported scheduled actions include any semantic patch instructions available when updating a feature flag.
Show child attributes
Show child attributes
"[ { \"kind\": \"turnFlagOn\" }]"
Optional comment describing the scheduled changes
"optional comment"
Response
Scheduled changes response
The ID of this scheduled change
"12ab3c45de678910abc12345"
Timestamp of when the scheduled change was created
"1654123897062"
The ID of the scheduled change maintainer
"12ab3c45de678910abc12345"
Version of the scheduled change
1
When the scheduled changes should be executed
"1636558831870"
The actions to perform on the execution date for these scheduled changes
Show child attributes
Show child attributes
"[ { \"kind\": \"turnFlagOn\" }]"
Details on any conflicting scheduled changes
The location and content type of related resources
Show child attributes
Show child attributes
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"comment": "Optional comment describing the scheduled changes",
"executionDate": 1718467200000,
"instructions": [
{
"kind": "turnFlagOn"
}
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes"
payload = {
"comment": "Optional comment describing the scheduled changes",
"executionDate": 1718467200000,
"instructions": [{ "kind": "turnFlagOn" }]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
comment: 'Optional comment describing the scheduled changes',
executionDate: 1718467200000,
instructions: [{kind: 'turnFlagOn'}]
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes', 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}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'comment' => 'Optional comment describing the scheduled changes',
'executionDate' => 1718467200000,
'instructions' => [
[
'kind' => 'turnFlagOn'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes"
payload := strings.NewReader("{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/scheduled-changes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"comment\": \"Optional comment describing the scheduled changes\",\n \"executionDate\": 1718467200000,\n \"instructions\": [\n {\n \"kind\": \"turnFlagOn\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"_id": "12ab3c45de678910abc12345",
"_creationDate": "1654123897062",
"_maintainerId": "12ab3c45de678910abc12345",
"_version": 1,
"executionDate": "1636558831870",
"instructions": "[ { \"kind\": \"turnFlagOn\" }]",
"conflicts": "<unknown>",
"_links": {}
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "not_found",
"message": "Invalid resource identifier"
}{
"code": "method_not_allowed",
"message": "Method not allowed"
}{
"code": "optimistic_locking_error",
"message": "Conflict. Optimistic lock error. Try again later."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}