Skip to main content
PATCH
/
api
/
v2
/
segments
/
{projectKey}
/
{segmentKey}
/
expiring-targets
/
{environmentKey}
Update expiring targets for segment
curl --request PATCH \
  --url https://app.launchdarkly.com/api/v2/segments/{projectKey}/{segmentKey}/expiring-targets/{environmentKey} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "instructions": [
    {
      "contextKey": "user@email.com",
      "contextKind": "user",
      "kind": "updateExpiringTarget",
      "targetType": "included",
      "value": 1587582000000,
      "version": 0
    }
  ],
  "comment": "optional comment"
}
'
{
  "items": [
    {
      "_id": "12ab3c45de678910abc12345",
      "_version": 1,
      "expirationDate": "1672358400000",
      "contextKind": "user",
      "contextKey": "context-key-123abc",
      "_resourceId": {
        "environmentKey": "environment-key-123abc",
        "flagKey": "<string>",
        "key": "segment-key-123abc",
        "kind": "segment",
        "projectKey": "project-key-123abc"
      },
      "targetType": "included",
      "variationId": "cc4332e2-bd4d-4fe0-b509-dfd2caf8dd73"
    }
  ],
  "_links": {},
  "totalInstructions": 123,
  "successfulInstructions": 123,
  "failedInstructions": 123,
  "errors": [
    {
      "instructionIndex": 1,
      "message": "example error message"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Path Parameters

projectKey
string<string>
required

The project key

environmentKey
string<string>
required

The environment key

segmentKey
string<string>
required

The segment key

Body

application/json
instructions
object[]
required

Semantic patch instructions for the desired changes to the resource

Example:
[
{
"contextKey": "user@email.com",
"contextKind": "user",
"kind": "updateExpiringTarget",
"targetType": "included",
"value": 1587582000000,
"version": 0
}
]
comment
string

Optional description of changes

Example:

"optional comment"

Response

Expiring target response

items
object[]
required

A list of the results from each instruction

The location and content type of related resources

totalInstructions
integer
successfulInstructions
integer
failedInstructions
integer
errors
object[]