Flag triggers is an Enterprise feature
Flag triggers is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.
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. To learn more, read Flag triggers.
With the flag triggers API, you can create, delete, and manage triggers.
Several of the endpoints in the flag triggers API require a flag trigger ID. The flag trigger ID is returned as part of the Create flag trigger and List flag triggers responses. It is the _id
field, or the _id
field of each element in the items
array.
Get a list of all flag triggers.
Flag trigger collection response
Invalid access token
Forbidden
Rate limited
{- "items": [
- {
- "_id": "string",
- "_version": 1,
- "_creationDate": 0,
- "_maintainerId": "12ab3c45de678910abc12345",
- "_maintainer": {
- "_links": {
- "self": {
- "href": "/api/v2/members/569f183514f4432160000007",
- "type": "application/json"
}
}, - "_id": "569f183514f4432160000007",
- "firstName": "Ariel",
- "lastName": "Flores",
- "role": "admin",
- "email": "ariel@acme.com"
}, - "enabled": true,
- "_integrationKey": "generic-trigger",
- "instructions": [
- {
- "property1": null,
- "property2": null
}
], - "_lastTriggeredAt": 0,
- "_recentTriggerBodies": [
- {
- "timestamp": 0,
- "jsonBody": {
- "property1": null,
- "property2": null
}
}
], - "_triggerCount": 3,
- "triggerURL": "string",
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
], - "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
Create a new flag trigger.
Flag trigger response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "comment": "example comment",
- "instructions": [
- {
- "kind": "turnFlagOn"
}
], - "integrationKey": "generic-trigger"
}
{- "_id": "string",
- "_version": 1,
- "_creationDate": 0,
- "_maintainerId": "12ab3c45de678910abc12345",
- "_maintainer": {
- "_links": {
- "self": {
- "href": "/api/v2/members/569f183514f4432160000007",
- "type": "application/json"
}
}, - "_id": "569f183514f4432160000007",
- "firstName": "Ariel",
- "lastName": "Flores",
- "role": "admin",
- "email": "ariel@acme.com"
}, - "enabled": true,
- "_integrationKey": "generic-trigger",
- "instructions": [
- {
- "property1": null,
- "property2": null
}
], - "_lastTriggeredAt": 0,
- "_recentTriggerBodies": [
- {
- "timestamp": 0,
- "jsonBody": {
- "property1": null,
- "property2": null
}
}
], - "_triggerCount": 3,
- "triggerURL": "string",
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
Get a flag trigger by ID.
Flag trigger response
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_id": "string",
- "_version": 1,
- "_creationDate": 0,
- "_maintainerId": "12ab3c45de678910abc12345",
- "_maintainer": {
- "_links": {
- "self": {
- "href": "/api/v2/members/569f183514f4432160000007",
- "type": "application/json"
}
}, - "_id": "569f183514f4432160000007",
- "firstName": "Ariel",
- "lastName": "Flores",
- "role": "admin",
- "email": "ariel@acme.com"
}, - "enabled": true,
- "_integrationKey": "generic-trigger",
- "instructions": [
- {
- "property1": null,
- "property2": null
}
], - "_lastTriggeredAt": 0,
- "_recentTriggerBodies": [
- {
- "timestamp": 0,
- "jsonBody": {
- "property1": null,
- "property2": null
}
}
], - "_triggerCount": 3,
- "triggerURL": "string",
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
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.
Semantic patch requests support the following kind
instructions for updating flag triggers.
Removes the existing trigger action and replaces it with the new instructions.
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:
{
"instructions": [
{
"kind": "replaceTriggerActionInstructions",
"value": [ {"kind": "turnFlagOff"} ]
}
]
}
Generates a new URL for this trigger. You must update any clients using the trigger to use this new URL.
Here's an example:
{
"instructions": [{ "kind": "cycleTriggerUrl" }]
}
Disables the trigger. This saves the trigger configuration, but the trigger stops running. To re-enable, use enableTrigger
.
Here's an example:
{
"instructions": [{ "kind": "disableTrigger" }]
}
Enables the trigger. If you previously disabled the trigger, it begins running again.
Here's an example:
{
"instructions": [{ "kind": "enableTrigger" }]
}
Flag trigger response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Status conflict
Rate limited
{- "comment": "optional comment",
- "instructions": [
- {
- "kind": "disableTrigger"
}
]
}
{- "_id": "string",
- "_version": 1,
- "_creationDate": 0,
- "_maintainerId": "12ab3c45de678910abc12345",
- "_maintainer": {
- "_links": {
- "self": {
- "href": "/api/v2/members/569f183514f4432160000007",
- "type": "application/json"
}
}, - "_id": "569f183514f4432160000007",
- "firstName": "Ariel",
- "lastName": "Flores",
- "role": "admin",
- "email": "ariel@acme.com"
}, - "enabled": true,
- "_integrationKey": "generic-trigger",
- "instructions": [
- {
- "property1": null,
- "property2": null
}
], - "_lastTriggeredAt": 0,
- "_recentTriggerBodies": [
- {
- "timestamp": 0,
- "jsonBody": {
- "property1": null,
- "property2": null
}
}
], - "_triggerCount": 3,
- "triggerURL": "string",
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
Delete a flag trigger by ID.
Action succeeded
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "code": "invalid_request",
- "message": "Invalid request body"
}