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
      • POSTCreate flag trigger
      • DELDelete flag trigger
      • GETGet flag trigger by ID
      • GETList flag triggers
      • PATCHUpdate flag trigger
    • 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
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewFlag Triggers

Update flag trigger

PATCH
/api/v2/flags/:projectKey/:featureFlagKey/triggers/:environmentKey/:id
PATCH
/api/v2/flags/:projectKey/:featureFlagKey/triggers/:environmentKey/:id
$curl -X PATCH https://app.launchdarkly.com/api/v2/flags/projectKey/featureFlagKey/triggers/environmentKey/id \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{}'
1{
2 "_id": "12ab3c45de678910abc12345",
3 "_version": 1,
4 "_creationDate": 1654104600000,
5 "_maintainerId": "12ab3c45de678910abc12345",
6 "_maintainer": {
7 "_links": {
8 "self": {
9 "href": "/api/v2/members/569f183514f4432160000007",
10 "type": "application/json"
11 }
12 },
13 "_id": "569f183514f4432160000007",
14 "role": "admin",
15 "email": "ariel@acme.com",
16 "firstName": "Ariel",
17 "lastName": "Flores"
18 },
19 "enabled": true,
20 "_status": "active",
21 "_lastFailedAt": 1654114600000,
22 "_integrationKey": "generic-trigger",
23 "instructions": [
24 "[ { \"kind\": \"turnFlagOn\" }]"
25 ],
26 "_lastTriggeredAt": 1654114600000,
27 "_recentTriggerBodies": [
28 {
29 "timestamp": 1654104600000,
30 "jsonBody": {}
31 }
32 ],
33 "_triggerCount": 3,
34 "triggerURL": "string",
35 "_links": {}
36}
Update a flag trigger. Updating a flag trigger 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 flag triggers. <details> <summary>Click to expand instructions for <strong>updating flag triggers</strong></summary> #### replaceTriggerActionInstructions Removes the existing trigger action and replaces it with the new instructions. ##### Parameters - `value`: An array of the new `kind`s of actions to perform when triggering. Supported flag actions are `turnFlagOn` and `turnFlagOff`. Here's an example that replaces the existing action with new instructions to turn flag targeting off: ```json { "instructions": [ { "kind": "replaceTriggerActionInstructions", "value": [ {"kind": "turnFlagOff"} ] } ] } ``` #### cycleTriggerUrl Generates a new URL for this trigger. You must update any clients using the trigger to use this new URL. Here's an example: ```json { "instructions": [{ "kind": "cycleTriggerUrl" }] } ``` #### disableTrigger Disables the trigger. This saves the trigger configuration, but the trigger stops running. To re-enable, use `enableTrigger`. Here's an example: ```json { "instructions": [{ "kind": "disableTrigger" }] } ``` #### enableTrigger Enables the trigger. If you previously disabled the trigger, it begins running again. Here's an example: ```json { "instructions": [{ "kind": "enableTrigger" }] } ``` </details>
Was this page helpful?
Previous

Follow Flags

Next
Built with

Update a flag trigger. Updating a flag trigger 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 flag triggers.

Click to expand instructions for updating flag triggers

replaceTriggerActionInstructions

Removes the existing trigger action and replaces it with the new instructions.

Parameters
  • value: An array of the new kinds of actions to perform when triggering. Supported flag actions are turnFlagOn and turnFlagOff.

Here’s an example that replaces the existing action with new instructions to turn flag targeting off:

1{
2 "instructions": [
3 {
4 "kind": "replaceTriggerActionInstructions",
5 "value": [ {"kind": "turnFlagOff"} ]
6 }
7 ]
8}

cycleTriggerUrl

Generates a new URL for this trigger. You must update any clients using the trigger to use this new URL.

Here’s an example:

1{
2 "instructions": [{ "kind": "cycleTriggerUrl" }]
3}

disableTrigger

Disables the trigger. This saves the trigger configuration, but the trigger stops running. To re-enable, use enableTrigger.

Here’s an example:

1{
2 "instructions": [{ "kind": "disableTrigger" }]
3}

enableTrigger

Enables the trigger. If you previously disabled the trigger, it begins running again.

Here’s an example:

1{
2 "instructions": [{ "kind": "enableTrigger" }]
3}

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key
environmentKeystringRequiredformat: "string"
The environment key
featureFlagKeystringRequiredformat: "string"
The feature flag key
idstringRequiredformat: "string"
The flag trigger ID

Request

This endpoint expects an object.
commentstringOptional
Optional comment describing the update
instructionslist of maps from strings to anyOptional

The instructions to perform when updating. This should be an array with objects that look like <code>{“kind”: “trigger_action”}</code>.

Response

Flag trigger response
_idstring
The ID of this flag trigger
_versioninteger
The flag trigger version
_creationDatelong
Timestamp of when the flag trigger was created
_maintainerIdstring
The ID of the flag trigger maintainer
_maintainerobject
Details on the member who maintains this flag trigger
enabledboolean
Whether the flag trigger is currently enabled
_statusenum

The trigger state: active, inactive, or failed

Allowed values:
_lastFailedAtlong
Timestamp of when the trigger most recently entered failed state
_integrationKeystring
The unique identifier of the integration for your trigger
instructionslist of maps from strings to any
Details on the action to perform when triggering
_lastTriggeredAtlong
Timestamp of when the trigger was most recently executed
_recentTriggerBodieslist of objects
Details on recent flag trigger requests.
_triggerCountinteger
Number of times the trigger has been executed
triggerURLstring
The unguessable URL for this flag trigger
_linksmap from strings to objects
The location and content type of related resources

Errors

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