APIs Built From the Ground Up
Our product was built by developers, for developers. That’s why every product feature is built API-first and tested thoroughly so you know it’s reliable and complete. Our full-featured APIs enable you to build custom integrations, export raw data and build custom scripts for automating your feature flag workflow.
Some awesome things you can do
Automatically change feature flag status’ using other tools in your stack.
Extract flag variation data and join it with additional event data stored in a data warehouse.
Update targeting rules dynamically based on business logic stored in other tools.
Integrate LaunchDarkly into your own developer dashboards.
Build automations for copying variation rules, segments & flags across projects.
Create your own UIs to visualize and manage your feature flags.
Create a new boolean feature flag named "New checkout flow".
const data = {
"name": "New checkout flow",
"key": "new-checkout-flow",
"variations": [
{
"value": true,
},
{
"value": false,
}
],
};
fetch("https://app.launchdarkly.com/api/v2/flags/app", {
method: "POST",
headers: {
"Authorization": "YOUR API ACCESS TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(flag => {
// Do something with the newly created flag
})
Toggle "new-checkout-flow" off.
const data = [
{
"op": "replace",
"path": "/environments/production/on",
"value": false
}
];
fetch("https://app.launchdarkly.com/api/v2/flags/app/new-checkout-flow", {
method: "PATCH",
headers: {
"Authorization": "YOUR API ACCESS TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(flag => {
// Do something with the newly updated flag
});
Find users with email "useremail@email.com" .
fetch("https://app.launchdarkly.com/api/v2/user-search/app/production?q=useremail@email.com", {
method: "GET",
headers: {
"Authorization": "YOUR API ACCESS TOKEN",
}
})
.then(response => response.json())
.then(flag => {
// Do something with user/s
});
Copy flag settings from the production environment to the test environment.
const data = {
"projKey": "default",
"flagKey": "new-checkout-flow",
"envKey": "production",
"source":
{
"key": "production",
},
"target": {
"key": "test",
},
"includedActions": ["updateRules", "updateOffVariation"]
}
fetch("https://app.launchdarkly.com/api/v2/flags/app/new-checkout-flow/copy", {
method: "POST",
headers: {
"Authorization": "YOUR API ACCESS TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(flag => {
// Do something with the newly created flag
})