For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • REST API overview
    • Access Tokens
    • Account Members
    • Account Usage Beta
    • AI Configs
    • Announcements
    • Applications Beta
    • Approvals
    • Approvals Beta
    • Audit Log
    • Code References
    • Contexts
    • Context Settings
    • Custom Roles
    • Data Export Destinations
    • Environments
    • Experiments
    • Feature Flags
    • Feature Flags Beta
    • Flag Import Configurations Beta
    • Flag Links Beta
    • Flag Triggers
      • POSTCreate flag trigger
      • DELDelete flag trigger
      • GETGet flag trigger by ID
      • GETList flag triggers
      • PATCHUpdate flag trigger
    • Follow Flags
    • Holdouts Beta
    • Insights Charts Beta
    • Insights Deployments Beta
    • Insights Flag Events Beta
    • Insights Pull Requests Beta
    • Insights Repositories Beta
    • Insights Scores Beta
    • Integration Audit Log Subscriptions
    • Integration Delivery Configurations Beta
    • Integrations Beta
    • Layers
    • Metrics
    • Metrics Beta
    • OAuth2 Clients
    • Persistent Store Integrations Beta
    • Projects
    • Relay Proxy Configurations
    • Release Pipelines Beta
    • Releases Beta
    • Scheduled Changes
    • Segments
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewFlag Triggers

Create flag trigger

POST
/api/v2/flags/:projectKey/:featureFlagKey/triggers/:environmentKey
POST
/api/v2/flags/:projectKey/:featureFlagKey/triggers/:environmentKey
$curl -X POST https://app.launchdarkly.com/api/v2/flags/projectKey/featureFlagKey/triggers/environmentKey \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "integrationKey": "generic-trigger"
>}'
1{
2 "_id": "12ab3c45de678910abc12345",
3 "_version": 1,
4 "_creationDate": 1654104600000,
5 "_maintainerId": "12ab3c45de678910abc12345",
6 "_maintainer": {
7 "_links": {
8 "self": {
9 "href": "/api/v2/members/569f183514f4432160000007",
10 "type": "application/json"
11 }
12 },
13 "_id": "569f183514f4432160000007",
14 "role": "admin",
15 "email": "ariel@acme.com",
16 "firstName": "Ariel",
17 "lastName": "Flores"
18 },
19 "enabled": true,
20 "_status": "active",
21 "_lastFailedAt": 1654114600000,
22 "_integrationKey": "generic-trigger",
23 "instructions": [
24 "[ { \"kind\": \"turnFlagOn\" }]"
25 ],
26 "_lastTriggeredAt": 1654114600000,
27 "_recentTriggerBodies": [
28 {
29 "timestamp": 1654104600000,
30 "jsonBody": {}
31 }
32 ],
33 "_triggerCount": 3,
34 "triggerURL": "string",
35 "_links": {}
36}
Create a new flag trigger.
Was this page helpful?
Previous

Delete flag trigger

Next
Built with

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key
environmentKeystringRequiredformat: "string"
The environment key
featureFlagKeystringRequiredformat: "string"
The feature flag key

Request

This endpoint expects an object.
integrationKeystringRequired

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

commentstringOptional
Optional comment describing the trigger
instructionslist of maps from strings to anyOptional

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>.

Response

Flag trigger response
_idstring
The ID of this flag trigger
_versioninteger
The flag trigger version
_creationDatelong
Timestamp of when the flag trigger was created
_maintainerIdstring
The ID of the flag trigger maintainer
_maintainerobject
Details on the member who maintains this flag trigger
enabledboolean
Whether the flag trigger is currently enabled
_statusenum

The trigger state: active, inactive, or failed

Allowed values:
_lastFailedAtlong
Timestamp of when the trigger most recently entered failed state
_integrationKeystring
The unique identifier of the integration for your trigger
instructionslist of maps from strings to any
Details on the action to perform when triggering
_lastTriggeredAtlong
Timestamp of when the trigger was most recently executed
_recentTriggerBodieslist of objects
Details on recent flag trigger requests.
_triggerCountinteger
Number of times the trigger has been executed
triggerURLstring
The unguessable URL for this flag trigger
_linksmap from strings to objects
The location and content type of related resources

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error