Flag triggers

Flag triggers let you initiate flag changes remotely using a unique webhook URL. For example, you can integrate triggers with your existing tools to enable or disable flags when you hit specific operational health thresholds or receive certain alerts.

Using the Flag triggers API, you can create, delete, and manage triggers.

List flag triggers

Get a list of all flag triggers.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

flagKey
required
string <string>

The flag key

Responses
200

Flag trigger collection response JSON

401

Invalid access token

403

Forbidden

429

Rate limited

get/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}
Request samples
curl -i -X GET \
  'https://app.launchdarkly.com/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "items": [
    ],
  • "_links": {
    }
}

Create flag trigger

Create a new flag trigger. Triggers let you initiate changes to flag targeting remotely using a unique webhook URL.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

flagKey
required
string <string>

The flag key

Request Body schema: application/json
comment
string
Array of objects (Instruction)

The action to perform when triggering. It should pass an array with a single {"kind": } object. Currently supported flag actions are "turnFlagOn" and "turnFlagOff".

integrationKey
required
string

The unique identifier of the integration you intend to set your trigger up with. "generic-trigger" should be used for integrations not explicitly supported.

Responses
201

Successful flag trigger response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

post/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}
Request samples
application/json
{
  • "comment": "string",
  • "instructions": [
    ],
  • "integrationKey": "string"
}
Response samples
application/json
{
  • "_id": "string",
  • "_version": 0,
  • "_creationDate": 0,
  • "_maintainerId": "string",
  • "_maintainer": {
    },
  • "enabled": true,
  • "_integrationKey": "string",
  • "instructions": [
    ],
  • "_lastTriggeredAt": 0,
  • "_recentTriggerBodies": [
    ],
  • "_triggerCount": 0,
  • "triggerURL": "string",
  • "_links": {
    }
}

Get flag trigger by ID

Get a flag trigger by ID.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

flagKey
required
string <string>

The flag key

envKey
required
string <string>

The environment key

id
required
string <string>

The flag trigger ID

Responses
200

Flag trigger response

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}/{id}
Request samples
curl -i -X GET \
  'https://app.launchdarkly.com/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}/{id}' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "_id": "string",
  • "_version": 0,
  • "_creationDate": 0,
  • "_maintainerId": "string",
  • "_maintainer": {
    },
  • "enabled": true,
  • "_integrationKey": "string",
  • "instructions": [
    ],
  • "_lastTriggeredAt": 0,
  • "_recentTriggerBodies": [
    ],
  • "_triggerCount": 0,
  • "triggerURL": "string",
  • "_links": {
    }
}

Update flag trigger

Update a flag trigger. The request body must be a valid JSON patch or JSON merge patch document. To learn more, read Updates.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

flagKey
required
string <string>

The flag key

id
required
string <string>

The flag trigger ID

Request Body schema: application/json
comment
string
Array of objects (Instruction)

The action to perform when triggering. It should pass an array with a single {"kind": } object. Currently supported flag actions are "turnFlagOn" and "turnFlagOff".

Responses
200

Flag trigger response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

409

Status conflict

429

Rate limited

patch/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}/{id}
Request samples
application/json
{
  • "comment": "string",
  • "instructions": [
    ]
}
Response samples
application/json
{
  • "_id": "string",
  • "_version": 0,
  • "_creationDate": 0,
  • "_maintainerId": "string",
  • "_maintainer": {
    },
  • "enabled": true,
  • "_integrationKey": "string",
  • "instructions": [
    ],
  • "_lastTriggeredAt": 0,
  • "_recentTriggerBodies": [
    ],
  • "_triggerCount": 0,
  • "triggerURL": "string",
  • "_links": {
    }
}

Delete flag trigger

Delete a flag trigger by ID.

Request
Security:
ApiKey (readwrite)
path Parameters
projKey
required
string <string>

The project key

envKey
required
string <string>

The environment key

flagKey
required
string <string>

The flag key

id
required
string <string>

The flag trigger ID

Responses
204

Action succeeded

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

delete/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}/{id}
Request samples
curl -i -X DELETE \
  'https://app.launchdarkly.com/api/v2/flags/{projKey}/{flagKey}/triggers/{envKey}/{id}' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "code": "invalid_request",
  • "message": "invalid request body"
}