v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
User settings

Update expiring user target for flags

Schedule the specified user for removal from individual targeting on one or more flags. The user must already be individually targeted for each flag.

You can add, update, or remove a scheduled removal date. You can only schedule a user 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.

<details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary>

addExpireUserTargetDate

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

Parameters
  • flagKey: The flag key
  • variationId: ID of a variation on the flag
  • value: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag.

updateExpireUserTargetDate

Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting.

Parameters
  • flagKey: The flag key
  • variationId: ID of a variation on the flag
  • value: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag.
  • version: 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 explicitly removed, or until another removal is scheduled.

Parameters
  • flagKey: The flag key
  • variationId: ID of a variation on the flag
</details>
patch/api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}

Path parameters

projectKeystring string required

The project key

The project key

userKeystring string required

The user key

The user key

environmentKeystring string required

The environment key

The environment key

Request body

commentstring

Optional comment describing the change

Example request

{
  "comment": "optional comment",
  "instructions": [
    {
      "kind": "addExpireUserTargetDate",
      "flagKey": "sample-flag-key",
      "variationId": "ce12d345-a1b2-4fb5-a123-ab123d4d5f5d",
      "value": 1653469200000,
      "version": 1
    }
  ]
}

Response

Expiring user target response

_linksobject

The location and content type of related resources

totalInstructionsinteger

The total count of instructions sent in the PATCH request

successfulInstructionsinteger

The total count of successful instructions sent in the PATCH request

failedInstructionsinteger

The total count of the failed instructions sent in the PATCH request

Example response

{
  "items": [
    {
      "_id": "12ab3c45de678910fgh12345",
      "_version": 1,
      "userKey": "example-user-key",
      "targetType": "included",
      "variationId": "ce67d625-a8b9-4fb5-a344-ab909d9d4f4d"
    }
  ],
  "totalInstructions": 1,
  "successfulInstructions": 1,
  "errors": [
    {
      "instructionIndex": 1,
      "message": "example error message"
    }
  ]
}