Update expiring user targets on feature flag
Contexts are now available
After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Update expiring context targets on feature flag instead of this endpoint. To learn more, read Contexts.
Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key.
You can add, update, or remove a scheduled removal date. You can only schedule a target 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 user targets.
addExpireUserTargetDate
Adds a date and time that LaunchDarkly will remove the user from the flag's individual targeting.
Parameters
value: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flagvariationId: ID of a variation on the flaguserKey: The user key for the user to remove from individual targeting
updateExpireUserTargetDate
Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting.
Parameters
value: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flagvariationId: ID of a variation on the flaguserKey: The user key for the user to remove from individual targetingversion: (Optional) The version of the expiring user target to update. If included, update will fail if version doesn't match current version of the expiring user target.
removeExpireUserTargetDate
Removes the scheduled removal of the user from the flag's individual targeting. The user will remain part of the flag's individual targeting until you explicitly remove them, or until you schedule another removal.
Parameters
variationId: ID of a variation on the flaguserKey: The user key for the user to remove from individual targeting
Authorization
ApiKey read, writeIn: header
Scope: read, write
Path Parameters
The project key
stringThe environment key
stringThe feature flag key
stringRequest Body
application/json
Optional comment describing the change
The instructions to perform when updating
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/api/v2/flags/string/string/expiring-user-targets/string" \ -H "Content-Type: application/json" \ -d '{ "instructions": [ { "kind": "addExpireUserTargetDate", "userKey": "sandy", "value": 1686412800000, "variationId": "ce12d345-a1b2-4fb5-a123-ab123d4d5f5d" } ] }'{ "items": [ { "_id": "12ab3c45de678910fgh12345", "_version": 1, "expirationDate": "1658192820000", "userKey": "example-user-key", "targetType": "included", "variationId": "ce67d625-a8b9-4fb5-a344-ab909d9d4f4d", "_resourceId": { "kind": "string", "projectKey": "string", "environmentKey": "string", "flagKey": "string", "key": "string" } } ], "_links": { "property1": { "href": "string", "type": "string" }, "property2": { "href": "string", "type": "string" } }, "totalInstructions": 1, "successfulInstructions": 1, "failedInstructions": 0, "errors": [ { "instructionIndex": 1, "message": "example error message" } ]}Get expiring user targets for feature flag GET
> ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](https://launchdarkly.com/docs/api/feature-flags/get-expiring-context-targets) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get a list of user targets on a feature flag that are scheduled for removal.
Get migration safety issues POST
Returns the migration safety issues that are associated with the POSTed flag patch. The patch must use the semantic patch format for updating feature flags.