For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Update expiring context targets for a segment. Updating a context target expiration 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.
If the request is well-formed but any of its instructions failed to process, this operation returns status code 200. In this case, the response errors array will be non-empty.
Semantic patch requests support the following kind instructions for updating expiring context targets.
Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target.
targetType: The type of individual target for this context. Must be either included or excluded.contextKey: The context key.contextKind: The kind of context being targeted.value: The date when the context should expire from the segment targeting, in Unix milliseconds.Here’s an example:
{
"instructions": [{
"kind": "addExpiringTarget",
"targetType": "included",
"contextKey": "user-key-123abc",
"contextKind": "user",
"value": 1754092860000
}]
}
Updates the date and time when LaunchDarkly will remove a context from segment targeting.
targetType: The type of individual target for this context. Must be either included or excluded.contextKey: The context key.contextKind: The kind of context being targeted.value: The new date when the context should expire from the segment targeting, in Unix milliseconds.version: (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",
"targetType": "included",
"contextKey": "user-key-123abc",
"contextKind": "user",
"value": 1754179260000
}]
}
Removes the scheduled expiration for the context in the segment.
targetType: The type of individual target for this context. Must be either included or excluded.contextKey: The context key.contextKind: The kind of context being targeted.Here’s an example:
{
"instructions": [{
"kind": "removeExpiringTarget",
"targetType": "included",
"contextKey": "user-key-123abc",
"contextKind": "user",
}]
}
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/segments/{projectKey}/{segmentKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": [
{
"contextKey": "user@email.com",
"contextKind": "user",
"kind": "updateExpiringTarget",
"targetType": "included",
"value": 1587582000000,
"version": 0
}
],
"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 segment key
Semantic patch instructions for the desired changes to the resource
Show child attributes
[
{
"contextKey": "user@email.com",
"contextKind": "user",
"kind": "updateExpiringTarget",
"targetType": "included",
"value": 1587582000000,
"version": 0
}
]Optional description of changes
"optional comment"
Expiring target response
curl --request PATCH \
--url https://app.launchdarkly.com/api/v2/segments/{projectKey}/{segmentKey}/expiring-targets/{environmentKey} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instructions": [
{
"contextKey": "user@email.com",
"contextKind": "user",
"kind": "updateExpiringTarget",
"targetType": "included",
"value": 1587582000000,
"version": 0
}
],
"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"
}
]
}