Update expiring context targets on feature flag

PATCH
/api/v2/flags/:projectKey/:featureFlagKey/expiring-targets/:environmentKey

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.

Instructions

Semantic patch requests support the following kind instructions for updating expiring targets.

Click to expand instructions for updating expiring targets

addExpiringTarget

Adds a date and time that LaunchDarkly will remove the context from the flag’s individual targeting.

Parameters
  • value: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag
  • variationId: ID of a variation on the flag
  • contextKey: The context key for the context to remove from individual targeting
  • contextKind: The kind of context represented by the contextKey

Here’s an example:

1{
2 "instructions": [{
3 "kind": "addExpiringTarget",
4 "value": 1754006460000,
5 "variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
6 "contextKey": "user-key-123abc",
7 "contextKind": "user"
8 }]
9}

updateExpiringTarget

Updates the date and time that LaunchDarkly will remove the context from the flag’s individual targeting

Parameters
  • value: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag
  • variationId: ID of a variation on the flag
  • contextKey: The context key for the context to remove from individual targeting
  • contextKind: The kind of context represented by the contextKey
  • 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:

1{
2 "instructions": [{
3 "kind": "updateExpiringTarget",
4 "value": 1754006460000,
5 "variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
6 "contextKey": "user-key-123abc",
7 "contextKind": "user"
8 }]
9}

removeExpiringTarget

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.

Parameters
  • variationId: ID of a variation on the flag
  • contextKey: The context key for the context to remove from individual targeting
  • contextKind: The kind of context represented by the contextKey

Here’s an example:

1{
2 "instructions": [{
3 "kind": "removeExpiringTarget",
4 "variationId": "4254742c-71ae-411f-a992-43b18a51afe0",
5 "contextKey": "user-key-123abc",
6 "contextKind": "user"
7 }]
8}

Path parameters

projectKeystringRequired

The project key

environmentKeystringRequired

The environment key

featureFlagKeystringRequired

The feature flag key

Request

This endpoint expects an object.
instructionslist of maps from strings to anyRequired

The instructions to perform when updating

commentstringOptional

Optional comment describing the change

Response

Expiring target response

itemslist of objects

A list of the results from each instruction

totalInstructionsintegerOptional
successfulInstructionsintegerOptional
failedInstructionsintegerOptional
errorslist of objectsOptional

Errors

Built with