For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • REST API overview
    • Access Tokens
    • Account Members
    • Account Usage Beta
    • AI Configs
    • Announcements
    • Applications Beta
    • Approvals
    • Approvals Beta
    • Audit Log
    • Code References
    • Contexts
    • Context Settings
    • Custom Roles
    • Data Export Destinations
    • Environments
    • Experiments
    • Feature Flags
    • Feature Flags Beta
    • Flag Import Configurations Beta
    • Flag Links Beta
    • Flag Triggers
    • Follow Flags
    • Holdouts Beta
    • Insights Charts Beta
    • Insights Deployments Beta
    • Insights Flag Events Beta
    • Insights Pull Requests Beta
    • Insights Repositories Beta
    • Insights Scores Beta
    • Integration Audit Log Subscriptions
    • Integration Delivery Configurations Beta
    • Integrations Beta
    • Layers
    • Metrics
    • Metrics Beta
    • OAuth2 Clients
    • Persistent Store Integrations Beta
    • Projects
    • Relay Proxy Configurations
    • Release Pipelines Beta
    • Releases Beta
    • Scheduled Changes
    • Segments
      • POSTCreate big segment export
      • POSTCreate big segment import
      • POSTCreate segment
      • DELDelete segment
      • GETGet big segment export
      • GETGet big segment import
      • GETGet big segment membership for context
      • GETGet big segment membership for user
      • GETGet expiring targets for segment
      • GETGet expiring user targets for segment
      • GETGet segment
      • POSTList segment memberships for context instance
      • GETList segments
      • PATCHPatch segment
      • POSTUpdate context targets on a big segment
      • PATCHUpdate expiring targets for segment
      • PATCHUpdate expiring user targets for segment
      • POSTUpdate user context targets on a big segment
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewSegments

Update expiring user targets for segment

PATCH
/api/v2/segments/:projectKey/:segmentKey/expiring-user-targets/:environmentKey
PATCH
/api/v2/segments/:projectKey/:segmentKey/expiring-user-targets/:environmentKey
$curl -X PATCH https://app.launchdarkly.com/api/v2/segments/projectKey/segmentKey/expiring-user-targets/environmentKey \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "instructions": [
> {
> "kind": "updateExpireUserTargetDate",
> "userKey": "user-key-123abc",
> "targetType": "included",
> "value": 1587582000000,
> "version": 0
> }
> ]
>}'
1{
2 "items": [
3 {
4 "_id": "12ab3c45de678910fgh12345",
5 "_version": 1,
6 "expirationDate": 1658192820000,
7 "userKey": "example-user-key",
8 "_resourceId": {
9 "kind": "string",
10 "projectKey": "string",
11 "environmentKey": "string",
12 "flagKey": "string",
13 "key": "string"
14 },
15 "targetType": "included",
16 "variationId": "ce67d625-a8b9-4fb5-a344-ab909d9d4f4d"
17 }
18 ],
19 "_links": {},
20 "totalInstructions": 1,
21 "successfulInstructions": 1,
22 "failedInstructions": 0,
23 "errors": [
24 {
25 "instructionIndex": 1,
26 "message": "example error message"
27 }
28 ]
29}
> ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Update expiring user targets for a segment. Updating a user 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](https://launchdarkly.com/docs/api#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. ### 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 Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>
Was this page helpful?
Previous

Update user context targets on a big segment

Next
Built with

Contexts are now available

After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Update expiring targets for segment instead of this endpoint. To learn more, read Contexts.

Update expiring user targets for a segment. Updating a user 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.

Instructions

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

Click to expand instructions for updating expiring user targets

addExpireUserTargetDate

Schedules a date and time when LaunchDarkly will remove a user from segment targeting.

Parameters
  • targetType: A segment’s target type, must be either included or excluded.
  • userKey: The user key.
  • value: The date when the user should expire from the segment targeting, in Unix milliseconds.

updateExpireUserTargetDate

Updates the date and time when LaunchDarkly will remove a user from segment targeting.

Parameters
  • targetType: A segment’s target type, must be either included or excluded.
  • userKey: The user key.
  • value: The new date when the user should expire from the segment targeting, in Unix milliseconds.
  • version: The segment version.

removeExpireUserTargetDate

Removes the scheduled expiration for the user in the segment.

Parameters
  • targetType: A segment’s target type, must be either included or excluded.
  • userKey: The user key.

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key
environmentKeystringRequiredformat: "string"
The environment key
segmentKeystringRequiredformat: "string"
The segment key

Request

This endpoint expects an object.
instructionslist of objectsRequired
Semantic patch instructions for the desired changes to the resource
commentstringOptional
Optional description of changes

Response

Expiring user target response
itemslist of objects
An array of expiring user targets
_linksmap from strings to objects
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
errorslist of objects
An array of error messages for the failed instructions

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error