---
title: "Update flag trigger"
method: PATCH
path: "/api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id}"
tags: ["Flag triggers"]
---

# Update flag trigger

`PATCH /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id}`

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>

## Path parameters

- `projectKey` string, string, required — The project key
- `environmentKey` string, string, required — The environment key
- `featureFlagKey` string, string, required — The feature flag key
- `id` string, string, required — The flag trigger ID

## Request body

- FlagTriggerInput
  - `comment` string — Optional comment describing the update
  - `instructions` Instruction[] — The instructions to perform when updating. This should be an array with objects that look like <code>{"kind": "trigger_action"}</code>.

## Response `200`

Flag trigger response

- TriggerWorkflowRep
  - `_id` string
  - `_version` integer — The flag trigger version
  - `_creationDate` integer
  - `_maintainerId` string — The ID of the flag trigger maintainer
  - `_maintainer` MemberSummary
    - `_links` object, required — The location and content type of related resources
    - `_id` string, required — The member's ID
    - `firstName` string — The member's first name
    - `lastName` string — The member's last name
    - `role` string, required — The member's base role. If the member has no additional roles, this role will be in effect.
    - `email` string, required — The member's email address
  - `enabled` boolean — Whether the flag trigger is currently enabled
  - `_integrationKey` string — The unique identifier of the integration for your trigger
  - `instructions` Instruction[]
  - `_lastTriggeredAt` integer
  - `_recentTriggerBodies` RecentTriggerBody[] — Details on recent flag trigger requests.
    - `timestamp` integer
    - `jsonBody` object — The marshalled JSON request body for the incoming trigger webhook. If this is empty or contains invalid JSON, the timestamp is recorded but this field will be empty.
  - `_triggerCount` integer — Number of times the trigger has been executed
  - `triggerURL` string — The unguessable URL for this flag trigger
  - `_links` object — The location and content type of related resources

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `409` — Status conflict
- `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)
