Skip to main content
PATCH
/
api
/
v2
/
projects
/
{projectKey}
/
ai-configs
/
{configKey}
/
targeting
Update AI Config targeting
curl --request PATCH \
  --url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/targeting \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "instructions": [
    {
      "key": ""
    },
    {
      "key": ""
    }
  ],
  "comment": "comment",
  "environmentKey": "environmentKey"
}
'
{
  "createdAt": 0,
  "defaults": {
    "onVariation": 6,
    "offVariation": 1
  },
  "environments": {
    "key": {
      "trackEventsFallthrough": true,
      "_environmentName": "_environmentName",
      "contextTargets": [
        {
          "values": [
            "values",
            "values"
          ],
          "contextKind": "contextKind",
          "variation": 5
        },
        {
          "values": [
            "values",
            "values"
          ],
          "contextKind": "contextKind",
          "variation": 5
        }
      ],
      "rules": [
        {
          "clauses": [
            {
              "op": "op",
              "negate": true,
              "values": [
                "",
                ""
              ],
              "attribute": "attribute",
              "id": "id"
            },
            {
              "op": "op",
              "negate": true,
              "values": [
                "",
                ""
              ],
              "attribute": "attribute",
              "id": "id"
            }
          ],
          "trackEvents": true
        },
        {
          "clauses": [
            {
              "op": "op",
              "negate": true,
              "values": [
                "",
                ""
              ],
              "attribute": "attribute",
              "id": "id"
            },
            {
              "op": "op",
              "negate": true,
              "values": [
                "",
                ""
              ],
              "attribute": "attribute",
              "id": "id"
            }
          ],
          "trackEvents": true
        }
      ],
      "lastModified": 2,
      "trackEvents": true,
      "fallthrough": {
        "rollout": {
          "experimentAllocation": {
            "defaultVariation": 2,
            "canReshuffle": true,
            "type": "type"
          },
          "seed": 7,
          "variations": [
            {
              "weight": 3,
              "_untracked": true,
              "variation": 9
            },
            {
              "weight": 3,
              "_untracked": true,
              "variation": 9
            }
          ],
          "contextKind": "contextKind",
          "bucketBy": "bucketBy"
        },
        "variation": 5
      },
      "offVariation": 4,
      "targets": [
        {
          "values": [
            "values",
            "values"
          ],
          "contextKind": "contextKind",
          "variation": 5
        },
        {
          "values": [
            "values",
            "values"
          ],
          "contextKind": "contextKind",
          "variation": 5
        }
      ],
      "_version": 7,
      "enabled": true
    }
  },
  "variations": [
    {
      "name": "name",
      "description": "description",
      "_id": "_id",
      "value": null
    },
    {
      "name": "name",
      "description": "description",
      "_id": "_id",
      "value": null
    }
  ],
  "experiments": {
    "baselineIdx": 1,
    "items": [
      {
        "metricKey": "my-metric",
        "environments": [
          "production",
          "test",
          "my-environment"
        ],
        "_environmentSettings": {
          "key": {
            "startDate": 4,
            "stopDate": 5,
            "enabledPeriods": [
              {
                "startDate": 9,
                "stopDate": 9
              },
              {
                "startDate": 9,
                "stopDate": 9
              }
            ]
          }
        },
        "_metric": {
          "_maintainer": {
            "firstName": "Ariel",
            "lastName": "Flores",
            "role": "admin",
            "_links": {
              "self": {
                "href": "/api/v2/members/569f183514f4432160000007",
                "type": "application/json"
              }
            },
            "_id": "569f183514f4432160000007",
            "email": "ariel@acme.com"
          },
          "_links": {
            "parent": {
              "href": "/api/v2/metrics/my-project",
              "type": "application/json"
            },
            "self": {
              "href": "/api/v2/metrics/my-project/my-metric",
              "type": "application/json"
            }
          },
          "description": "description",
          "activeExperimentCount": 2,
          "activeGuardedRolloutCount": 1,
          "windowEndOffset": 1,
          "randomizationUnits": [
            "user"
          ],
          "guardedRolloutCount": 0,
          "archived": true,
          "urls": [
            null,
            null
          ],
          "_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"
          },
          "selector": "selector",
          "_version": 1,
          "key": "metric-key-123abc",
          "percentileValue": 95,
          "traceQuery": "service.name = \"checkout\"",
          "kind": "custom",
          "_attachedFlagCount": 0,
          "metricGroupCount": 0,
          "traceValueLocation": "duration",
          "filters": {
            "op": "op",
            "negate": false,
            "values": [
              "JP"
            ],
            "contextKind": "user",
            "attribute": "country",
            "type": "contextAttribute"
          },
          "_creationDate": 1,
          "windowStartOffset": 7,
          "tags": [],
          "eventDefault": {
            "disabled": true,
            "value": 0
          },
          "archivedAt": 6,
          "maintainerId": "569fdeadbeef1644facecafe",
          "unit": "unit",
          "lastSeen": 1,
          "successCriteria": "HigherThanBaseline",
          "releasePolicyCount": 0,
          "_versionId": "version-id-123abc",
          "isNumeric": true,
          "eventKey": "Order placed",
          "experimentCount": 0,
          "name": "My metric",
          "_id": "5902deadbeef667524a01290",
          "lastModified": {
            "date": "2021-08-05T19:46:31.148Z"
          },
          "unitAggregationType": "average",
          "category": "Error monitoring",
          "analysisType": "mean",
          "dataSource": {
            "_name": "_name",
            "_integrationKey": "_integrationKey",
            "key": "key",
            "environmentKey": "environmentKey"
          }
        }
      },
      {
        "metricKey": "my-metric",
        "environments": [
          "production",
          "test",
          "my-environment"
        ],
        "_environmentSettings": {
          "key": {
            "startDate": 4,
            "stopDate": 5,
            "enabledPeriods": [
              {
                "startDate": 9,
                "stopDate": 9
              },
              {
                "startDate": 9,
                "stopDate": 9
              }
            ]
          }
        },
        "_metric": {
          "_maintainer": {
            "firstName": "Ariel",
            "lastName": "Flores",
            "role": "admin",
            "_links": {
              "self": {
                "href": "/api/v2/members/569f183514f4432160000007",
                "type": "application/json"
              }
            },
            "_id": "569f183514f4432160000007",
            "email": "ariel@acme.com"
          },
          "_links": {
            "parent": {
              "href": "/api/v2/metrics/my-project",
              "type": "application/json"
            },
            "self": {
              "href": "/api/v2/metrics/my-project/my-metric",
              "type": "application/json"
            }
          },
          "description": "description",
          "activeExperimentCount": 2,
          "activeGuardedRolloutCount": 1,
          "windowEndOffset": 1,
          "randomizationUnits": [
            "user"
          ],
          "guardedRolloutCount": 0,
          "archived": true,
          "urls": [
            null,
            null
          ],
          "_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"
          },
          "selector": "selector",
          "_version": 1,
          "key": "metric-key-123abc",
          "percentileValue": 95,
          "traceQuery": "service.name = \"checkout\"",
          "kind": "custom",
          "_attachedFlagCount": 0,
          "metricGroupCount": 0,
          "traceValueLocation": "duration",
          "filters": {
            "op": "op",
            "negate": false,
            "values": [
              "JP"
            ],
            "contextKind": "user",
            "attribute": "country",
            "type": "contextAttribute"
          },
          "_creationDate": 1,
          "windowStartOffset": 7,
          "tags": [],
          "eventDefault": {
            "disabled": true,
            "value": 0
          },
          "archivedAt": 6,
          "maintainerId": "569fdeadbeef1644facecafe",
          "unit": "unit",
          "lastSeen": 1,
          "successCriteria": "HigherThanBaseline",
          "releasePolicyCount": 0,
          "_versionId": "version-id-123abc",
          "isNumeric": true,
          "eventKey": "Order placed",
          "experimentCount": 0,
          "name": "My metric",
          "_id": "5902deadbeef667524a01290",
          "lastModified": {
            "date": "2021-08-05T19:46:31.148Z"
          },
          "unitAggregationType": "average",
          "category": "Error monitoring",
          "analysisType": "mean",
          "dataSource": {
            "_name": "_name",
            "_integrationKey": "_integrationKey",
            "key": "key",
            "environmentKey": "environmentKey"
          }
        }
      }
    ]
  },
  "name": "name",
  "_version": 6,
  "key": "key",
  "tags": [
    "tags",
    "tags"
  ]
}

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Path Parameters

projectKey
string
required
configKey
string
required

Body

application/json

AI Config targeting semantic patch instructions

environmentKey
string
required
instructions
object[]
required
comment
string

Response

AI Config targeting updated

createdAt
integer<int64>
required

Unix timestamp in milliseconds

environments
object
required
experiments
object
required
Example:
{
"baselineIdx": 1,
"items": [
{
"metricKey": "my-metric",
"environments": ["production", "test", "my-environment"],
"_environmentSettings": {
"key": {
"startDate": 4,
"stopDate": 5,
"enabledPeriods": [
{ "startDate": 9, "stopDate": 9 },
{ "startDate": 9, "stopDate": 9 }
]
}
},
"_metric": {
"_maintainer": {
"firstName": "Ariel",
"lastName": "Flores",
"role": "admin",
"_links": {
"self": {
"href": "/api/v2/members/569f183514f4432160000007",
"type": "application/json"
}
},
"_id": "569f183514f4432160000007",
"email": "ariel@acme.com"
},
"_links": {
"parent": {
"href": "/api/v2/metrics/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"description": "description",
"activeExperimentCount": 2,
"activeGuardedRolloutCount": 1,
"windowEndOffset": 1,
"randomizationUnits": ["user"],
"guardedRolloutCount": 0,
"archived": true,
"urls": [null, null],
"_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" },
"selector": "selector",
"_version": 1,
"key": "metric-key-123abc",
"percentileValue": 95,
"traceQuery": "service.name = \"checkout\"",
"kind": "custom",
"_attachedFlagCount": 0,
"metricGroupCount": 0,
"traceValueLocation": "duration",
"filters": {
"op": "op",
"negate": false,
"values": ["JP"],
"contextKind": "user",
"attribute": "country",
"type": "contextAttribute"
},
"_creationDate": 1,
"windowStartOffset": 7,
"tags": [],
"eventDefault": { "disabled": true, "value": 0 },
"archivedAt": 6,
"maintainerId": "569fdeadbeef1644facecafe",
"unit": "unit",
"lastSeen": 1,
"successCriteria": "HigherThanBaseline",
"releasePolicyCount": 0,
"_versionId": "version-id-123abc",
"isNumeric": true,
"eventKey": "Order placed",
"experimentCount": 0,
"name": "My metric",
"_id": "5902deadbeef667524a01290",
"lastModified": { "date": "2021-08-05T19:46:31.148Z" },
"unitAggregationType": "average",
"category": "Error monitoring",
"analysisType": "mean",
"dataSource": {
"_name": "_name",
"_integrationKey": "_integrationKey",
"key": "key",
"environmentKey": "environmentKey"
}
}
},
{
"metricKey": "my-metric",
"environments": ["production", "test", "my-environment"],
"_environmentSettings": {
"key": {
"startDate": 4,
"stopDate": 5,
"enabledPeriods": [
{ "startDate": 9, "stopDate": 9 },
{ "startDate": 9, "stopDate": 9 }
]
}
},
"_metric": {
"_maintainer": {
"firstName": "Ariel",
"lastName": "Flores",
"role": "admin",
"_links": {
"self": {
"href": "/api/v2/members/569f183514f4432160000007",
"type": "application/json"
}
},
"_id": "569f183514f4432160000007",
"email": "ariel@acme.com"
},
"_links": {
"parent": {
"href": "/api/v2/metrics/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"description": "description",
"activeExperimentCount": 2,
"activeGuardedRolloutCount": 1,
"windowEndOffset": 1,
"randomizationUnits": ["user"],
"guardedRolloutCount": 0,
"archived": true,
"urls": [null, null],
"_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" },
"selector": "selector",
"_version": 1,
"key": "metric-key-123abc",
"percentileValue": 95,
"traceQuery": "service.name = \"checkout\"",
"kind": "custom",
"_attachedFlagCount": 0,
"metricGroupCount": 0,
"traceValueLocation": "duration",
"filters": {
"op": "op",
"negate": false,
"values": ["JP"],
"contextKind": "user",
"attribute": "country",
"type": "contextAttribute"
},
"_creationDate": 1,
"windowStartOffset": 7,
"tags": [],
"eventDefault": { "disabled": true, "value": 0 },
"archivedAt": 6,
"maintainerId": "569fdeadbeef1644facecafe",
"unit": "unit",
"lastSeen": 1,
"successCriteria": "HigherThanBaseline",
"releasePolicyCount": 0,
"_versionId": "version-id-123abc",
"isNumeric": true,
"eventKey": "Order placed",
"experimentCount": 0,
"name": "My metric",
"_id": "5902deadbeef667524a01290",
"lastModified": { "date": "2021-08-05T19:46:31.148Z" },
"unitAggregationType": "average",
"category": "Error monitoring",
"analysisType": "mean",
"dataSource": {
"_name": "_name",
"_integrationKey": "_integrationKey",
"key": "key",
"environmentKey": "environmentKey"
}
}
}
]
}
key
string
required
name
string
required
tags
string[]
required
variations
object[]
required
_version
integer
required
defaults
object
Example:
{ "onVariation": 6, "offVariation": 1 }