curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"defaultVariationKey": "defaultVariationKey",
"isInverted": true,
"tags": [
"tags",
"tags"
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}"
payload = {
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"defaultVariationKey": "defaultVariationKey",
"isInverted": True,
"tags": ["tags", "tags"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
maintainerId: '507f1f77bcf86cd799439011',
maintainerTeamKey: 'example-team-key',
name: 'name',
description: 'description',
evaluationMetricKey: 'evaluationMetricKey',
defaultVariationKey: 'defaultVariationKey',
isInverted: true,
tags: ['tags', 'tags']
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}', 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}/ai-configs/{configKey}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'maintainerId' => '507f1f77bcf86cd799439011',
'maintainerTeamKey' => 'example-team-key',
'name' => 'name',
'description' => 'description',
'evaluationMetricKey' => 'evaluationMetricKey',
'defaultVariationKey' => 'defaultVariationKey',
'isInverted' => true,
'tags' => [
'tags',
'tags'
]
]),
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}/ai-configs/{configKey}"
payload := strings.NewReader("{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"_maintainer": {
"kind": "kind"
},
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"version": 0,
"tags": [
"tags",
"tags"
],
"dependencies": [
{
"type": "agent-graph",
"key": "key"
},
{
"type": "agent-graph",
"key": "key"
}
],
"mode": "completion",
"createdAt": 2,
"evaluationMetricKeys": [
"evaluationMetricKeys",
"evaluationMetricKeys"
],
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"_site": {
"href": "href",
"type": "type"
},
"variations": [
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "OpenAI.gpt-4.1",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"classifiers": [
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
},
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
}
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "published",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
},
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "OpenAI.gpt-4.1",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"classifiers": [
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
},
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
}
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "published",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
}
],
"name": "name",
"key": "key",
"isInverted": true,
"updatedAt": 4
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Update AI Config
Edit an existing AI Config.
The request body must be a JSON object of the fields to update. The values you include replace the existing values for the fields.
Here’s an example:
{
"description": "Example updated description",
"tags": ["new-tag"]
}
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"defaultVariationKey": "defaultVariationKey",
"isInverted": true,
"tags": [
"tags",
"tags"
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}"
payload = {
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"defaultVariationKey": "defaultVariationKey",
"isInverted": True,
"tags": ["tags", "tags"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
maintainerId: '507f1f77bcf86cd799439011',
maintainerTeamKey: 'example-team-key',
name: 'name',
description: 'description',
evaluationMetricKey: 'evaluationMetricKey',
defaultVariationKey: 'defaultVariationKey',
isInverted: true,
tags: ['tags', 'tags']
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}', 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}/ai-configs/{configKey}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'maintainerId' => '507f1f77bcf86cd799439011',
'maintainerTeamKey' => 'example-team-key',
'name' => 'name',
'description' => 'description',
'evaluationMetricKey' => 'evaluationMetricKey',
'defaultVariationKey' => 'defaultVariationKey',
'isInverted' => true,
'tags' => [
'tags',
'tags'
]
]),
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}/ai-configs/{configKey}"
payload := strings.NewReader("{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"description\",\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"defaultVariationKey\": \"defaultVariationKey\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"_maintainer": {
"kind": "kind"
},
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"version": 0,
"tags": [
"tags",
"tags"
],
"dependencies": [
{
"type": "agent-graph",
"key": "key"
},
{
"type": "agent-graph",
"key": "key"
}
],
"mode": "completion",
"createdAt": 2,
"evaluationMetricKeys": [
"evaluationMetricKeys",
"evaluationMetricKeys"
],
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"_site": {
"href": "href",
"type": "type"
},
"variations": [
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "OpenAI.gpt-4.1",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"classifiers": [
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
},
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
}
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "published",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
},
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "OpenAI.gpt-4.1",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"classifiers": [
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
},
{
"instructions": "instructions",
"criteria": "",
"type": "bool",
"key": "key"
}
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "published",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
}
],
"name": "name",
"key": "key",
"isInverted": true,
"updatedAt": 4
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Authorizations
Body
AI Config object to update
Key of the variation this config serves by default
A description of the AI Config
The ID of the member who maintains this resource
"507f1f77bcf86cd799439011"
The key of the team that maintains this resource
"example-team-key"
A human-readable name for the AI Config
Tags for this resource
Evaluation metric key for this config
The success direction of a judge. Offline evaluations use it to decide whether a score passes.
true: A lower score is better. Use this for a judge that scores bad output, such as a toxicity or hallucination judge.false: A higher score is better. Use this for a judge that scores good output, such as an accuracy or relevance judge.
Send this field only when the AI Config's mode is judge. If you omit it, the current direction does not change. For a built-in judge key, the API always returns the built-in direction. Built-in judge keys are ld-ai-judge-accuracy, ld-ai-judge-relevance, and ld-ai-judge-toxicity, with or without a -<timestamp> suffix such as ld-ai-judge-accuracy-1760000000000.
The API returns a 400 error in these cases:
isInverted is only supported for judge mode: You send this field and the AI Config'smodeisagentorcompletion. Remove the field.isInverted is not supported: Custom judges are not available for your account. Remove the field from the request.
true
Response
AI Config updated
A description of the AI Config
The AI Config key
The AI Config name
Tags for this resource
The version number of this resource
The variations of this AI Config
Show child attributes
Show child attributes
Show child attributes
Show child attributes
{
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
]
}
The location and content type of related resources
Show child attributes
Show child attributes
{
"parent": { "href": "href", "type": "type" },
"self": { "href": "href", "type": "type" }
}
Show child attributes
Show child attributes
{ "href": "href", "type": "type" }
The member or team that maintains this resource
- Option 1
- Option 2
Show child attributes
Show child attributes
{ "kind": "kind" }
The AI Config mode
agent, completion, judge Evaluation metric key for this config
List of evaluation metric keys for this config
The success direction of a judge. Offline evaluations use it to decide whether a score passes.
true: A lower score is better. Use this for a judge that scores bad output, such as a toxicity or hallucination judge.false: A higher score is better. Use this for a judge that scores good output, such as an accuracy or relevance judge.
The response includes this field only when mode is judge. For a built-in judge key, the value is always the built-in direction. Built-in judge keys are ld-ai-judge-accuracy, ld-ai-judge-relevance, and ld-ai-judge-toxicity, with or without a -<timestamp> suffix such as ld-ai-judge-accuracy-1760000000000. A custom judge with no stored direction omits this field.
true
Resources that depend on this config, grouped by type
Show child attributes
Show child attributes