---
title: "Update expiring user target for flags"
method: PATCH
path: "/api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}"
tags: ["User settings"]
deprecated: true
---

# Update expiring user target for flags

`PATCH /api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}`

> **Deprecated.**

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](https://launchdarkly.com/docs/api#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>

## Path parameters

- `projectKey` string, string, required — The project key
- `userKey` string, string, required — The user key
- `environmentKey` string, string, required — The environment key

## Request body

- PatchUsersRequest
  - `comment` string — Optional comment describing the change
  - `instructions` InstructionUserRequest[], required — The instructions to perform when updating
    - `kind` 'addExpireUserTargetDate' | 'updateExpireUserTargetDate' | 'removeExpireUserTargetDate', required — The type of change to make to the removal date for this user from individual targeting for this flag.
    - `flagKey` string, required — The flag key
    - `variationId` string, required — ID of a variation on the flag
    - `value` integer — The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag. Required if <code>kind</code> is <code>addExpireUserTargetDate</code> or <code>updateExpireUserTargetDate</code>.
    - `version` integer — The version of the expiring user target to update. Optional and only used if <code>kind</code> is <code>updateExpireUserTargetDate</code>. If included, update will fail if version doesn't match current version of the expiring user target.

## Response `200`

Expiring user target response

- ExpiringUserTargetPatchResponse
  - `items` ExpiringUserTargetItem[], required — An array of expiring user targets
    - `_id` string, required — The ID of this expiring user target
    - `_version` integer, required — The version of this expiring user target
    - `expirationDate` integer, required
    - `userKey` string, required — A unique key used to represent the user
    - `targetType` string — A segment's target type. Included when expiring user targets are updated on a segment.
    - `variationId` string — A unique key used to represent the flag variation. Included when expiring user targets are updated on a feature flag.
    - `_resourceId` ResourceIDResponse, required
      - `kind` string
      - `projectKey` string
      - `environmentKey` string
      - `flagKey` string
      - `key` string
  - `_links` object — The location and content type of related resources
  - `totalInstructions` integer — The total count of instructions sent in the PATCH request
  - `successfulInstructions` integer — The total count of successful instructions sent in the PATCH request
  - `failedInstructions` integer — The total count of the failed instructions sent in the PATCH request
  - `errors` ExpiringTargetError[] — An array of error messages for the failed instructions
    - `instructionIndex` integer, required — The index of the PATCH instruction where the error occurred
    - `message` string, required — The error message related to a failed PATCH instruction

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
