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

# Create flag trigger

`POST /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}`

Create a new flag trigger.

## Path parameters

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

## Request body

- TriggerPost
  - `comment` string — Optional comment describing the trigger
  - `instructions` Instruction[] — The action to perform when triggering. This should be an array with a single object that looks like <code>{"kind": "flag_action"}</code>. Supported flag actions are <code>turnFlagOn</code> and <code>turnFlagOff</code>.
  - `integrationKey` string, required — The unique identifier of the integration for your trigger. Use <code>generic-trigger</code> for integrations not explicitly supported.

## Response `201`

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
- `429` — Rate limited

---

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