Skip to main content
POST
/
api
/
v2
/
flags
/
{projectKey}
/
{featureFlagKey}
/
triggers
/
{environmentKey}
Create flag trigger
curl --request POST \
  --url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "integrationKey": "generic-trigger",
  "comment": "example comment",
  "instructions": [
    {
      "kind": "turnFlagOn"
    }
  ]
}
'
{
  "_id": "12ab3c45de678910abc12345",
  "_version": 1,
  "_creationDate": "1654104600000",
  "_maintainerId": "12ab3c45de678910abc12345",
  "_maintainer": {
    "_links": {
      "self": {
        "href": "/api/v2/members/569f183514f4432160000007",
        "type": "application/json"
      }
    },
    "_id": "569f183514f4432160000007",
    "role": "admin",
    "email": "ariel@acme.com",
    "firstName": "Ariel",
    "lastName": "Flores"
  },
  "enabled": true,
  "_status": "active",
  "_lastFailedAt": "1654114600000",
  "_integrationKey": "generic-trigger",
  "instructions": "[ { \"kind\": \"turnFlagOn\" }]",
  "_lastTriggeredAt": "1654114600000",
  "_recentTriggerBodies": [
    {
      "timestamp": "1654104600000",
      "jsonBody": {}
    }
  ],
  "_triggerCount": 3,
  "triggerURL": "<string>",
  "_links": {}
}

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

featureFlagKey
string<string>
required

The feature flag key

Body

application/json
integrationKey
string
required

The unique identifier of the integration for your trigger. Use generic-trigger for integrations not explicitly supported.

Example:

"generic-trigger"

comment
string

Optional comment describing the trigger

Example:

"example comment"

instructions
object[]

The action to perform when triggering. This should be an array with a single object that looks like {"kind": "flag_action"}. Supported flag actions are turnFlagOn and turnFlagOff.

Example:
[{ "kind": "turnFlagOn" }]

Response

Flag trigger response

_id
string

The ID of this flag trigger

Example:

"12ab3c45de678910abc12345"

_version
integer

The flag trigger version

Example:

1

_creationDate
integer<int64>

Timestamp of when the flag trigger was created

Example:

"1654104600000"

_maintainerId
string

The ID of the flag trigger maintainer

Example:

"12ab3c45de678910abc12345"

_maintainer
object

Details on the member who maintains this flag trigger

enabled
boolean

Whether the flag trigger is currently enabled

Example:

true

_status
enum<string>

The trigger state: active, inactive, or failed

Available options:
active,
inactive,
failed
Example:

"active"

_lastFailedAt
integer<int64>

Timestamp of when the trigger most recently entered failed state

Example:

"1654114600000"

_integrationKey
string

The unique identifier of the integration for your trigger

Example:

"generic-trigger"

instructions
object[]

Details on the action to perform when triggering

Example:

"[ { \"kind\": \"turnFlagOn\" }]"

_lastTriggeredAt
integer<int64>

Timestamp of when the trigger was most recently executed

Example:

"1654114600000"

_recentTriggerBodies
object[]

Details on recent flag trigger requests.

_triggerCount
integer

Number of times the trigger has been executed

Example:

3

triggerURL
string

The unguessable URL for this flag trigger

The location and content type of related resources