For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context.
You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag.
Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append domain-model=launchdarkly.semanticpatch to your Content-Type header. To learn more, read Updates using semantic patch.
Semantic patch requests support the following kind instructions for updating expiring targets.
Adds a date and time that LaunchDarkly will remove the context from the flag’s individual targeting.
value: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flagvariationId: ID of a variation on the flagcontextKey: The context key for the context to remove from individual targetingcontextKind: The kind of context represented by the contextKeyHere’s an example:
{
"instructions": [{
"kind": "addExpiringTarget",
"value": 1754006460000,
"variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
"contextKey": "user-key-123abc",
"contextKind": "user"
}]
}
Updates the date and time that LaunchDarkly will remove the context from the flag’s individual targeting
value: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flagvariationId: ID of a variation on the flagcontextKey: The context key for the context to remove from individual targetingcontextKind: The kind of context represented by the contextKeyversion: (Optional) The version of the expiring target to update. If included, update will fail if version doesn’t match current version of the expiring target.Here’s an example:
{
"instructions": [{
"kind": "updateExpiringTarget",
"value": 1754006460000,
"variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
"contextKey": "user-key-123abc",
"contextKind": "user"
}]
}
Removes the scheduled removal of the context from the flag’s individual targeting. The context will remain part of the flag’s individual targeting until you explicitly remove it, or until you schedule another removal.
variationId: ID of a variation on the flagcontextKey: The context key for the context to remove from individual targetingcontextKind: The kind of context represented by the contextKeyHere’s an example:
{
"instructions": [{
"kind": "removeExpiringTarget",
"variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
"contextKey": "user-key-123abc",
"contextKind": "user"
}]
}
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": [
{
"kind": "addExpireUserTargetDate",
"userKey": "sandy",
"value": 1686412800000,
"variationId": "ce12d345-a1b2-4fb5-a123-ab123d4d5f5d"
}
],
"comment": "optional comment"
}
'{
"items": [
{
"_id": "12ab3c45de678910abc12345",
"_version": 1,
"expirationDate": "1672358400000",
"contextKind": "user",
"contextKey": "context-key-123abc",
"_resourceId": {
"environmentKey": "environment-key-123abc",
"flagKey": "<string>",
"key": "segment-key-123abc",
"kind": "segment",
"projectKey": "project-key-123abc"
},
"targetType": "included",
"variationId": "cc4332e2-bd4d-4fe0-b509-dfd2caf8dd73"
}
],
"_links": {},
"totalInstructions": 123,
"successfulInstructions": 123,
"failedInstructions": 123,
"errors": [
{
"instructionIndex": 1,
"message": "example error message"
}
]
}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.
The project key
The environment key
The feature flag key
The instructions to perform when updating
Show child attributes
[
{
"kind": "addExpireUserTargetDate",
"userKey": "sandy",
"value": 1686412800000,
"variationId": "ce12d345-a1b2-4fb5-a123-ab123d4d5f5d"
}
]Optional comment describing the change
"optional comment"
Expiring target response
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": [
{
"kind": "addExpireUserTargetDate",
"userKey": "sandy",
"value": 1686412800000,
"variationId": "ce12d345-a1b2-4fb5-a123-ab123d4d5f5d"
}
],
"comment": "optional comment"
}
'{
"items": [
{
"_id": "12ab3c45de678910abc12345",
"_version": 1,
"expirationDate": "1672358400000",
"contextKind": "user",
"contextKey": "context-key-123abc",
"_resourceId": {
"environmentKey": "environment-key-123abc",
"flagKey": "<string>",
"key": "segment-key-123abc",
"kind": "segment",
"projectKey": "project-key-123abc"
},
"targetType": "included",
"variationId": "cc4332e2-bd4d-4fe0-b509-dfd2caf8dd73"
}
],
"_links": {},
"totalInstructions": 123,
"successfulInstructions": 123,
"failedInstructions": 123,
"errors": [
{
"instructionIndex": 1,
"message": "example error message"
}
]
}