Skip to main content
POST
/
api
/
v2
/
projects
/
{projectKey}
/
flags
/
{featureFlagKey}
/
environments
/
{environmentKey}
/
workflows
Create workflow
curl --request POST \
  --url https://app.launchdarkly.com/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "description": "Turn flag on for 10% of customers each day",
  "name": "Progressive rollout starting in two days",
  "stages": [
    {
      "action": {
        "instructions": [
          {
            "kind": "turnFlagOn"
          },
          {
            "kind": "updateFallthroughVariationOrRollout",
            "rolloutWeights": {
              "452f5fb5-7320-4ba3-81a1-8f4324f79d49": 90000,
              "fc15f6a4-05d3-4aa4-a997-446be461345d": 10000
            }
          }
        ]
      },
      "conditions": [
        {
          "kind": "schedule",
          "scheduleKind": "relative",
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        }
      ],
      "name": "10% rollout on day 1"
    }
  ]
}
'
{
  "_id": "12ab3c4d5ef1a2345bcde67f",
  "_version": 1,
  "_conflicts": [
    {
      "stageId": "12ab3c4d5ef1a2345bcde67f",
      "message": "<string>"
    }
  ],
  "_creationDate": "1654104600000",
  "_maintainerId": "12ab3c45de678910abc12345",
  "_links": {},
  "name": "Progressive rollout starting in two days",
  "_execution": "{\"status\": \"completed\"}",
  "description": "Turn flag on for 10% of customers each day",
  "kind": "custom",
  "stages": [
    {
      "_id": "12ab3c45de678910abc12345",
      "conditions": [
        {
          "_execution": {
            "status": "completed"
          },
          "id": "12ab3c45de678910abc12345",
          "kind": "schedule",
          "scheduleKind": "relative",
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        }
      ],
      "action": "{ \"kind\": \"patch\", \"instructions\": [{ \"kind\": \"turnFlagOn\"}] }",
      "_execution": "{ \"status\": \"completed\" }",
      "name": "10% rollout on day 1"
    }
  ],
  "meta": {
    "parameters": [
      {
        "_id": "<string>",
        "path": "<string>",
        "default": {
          "value": "<unknown>",
          "booleanVariationValue": true,
          "ruleClause": {
            "attribute": "<string>",
            "op": "in",
            "negate": true
          }
        },
        "valid": true
      }
    ]
  },
  "templateKey": "example-workflow-template"
}

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

featureFlagKey
string<string>
required

The feature flag key

environmentKey
string<string>
required

The environment key

Query Parameters

templateKey
string<string>

The template key to apply as a starting point for the new workflow

dryRun
boolean

Whether to call the endpoint in dry-run mode

Body

application/json
name
string
required

The workflow name

Example:

"Progressive rollout starting in two days"

maintainerId
string

The ID of the workflow maintainer. Defaults to the workflow creator.

Example:

"12ab3c45de678910abc12345"

description
string

The workflow description

Example:

"Turn flag on for 10% of users each day"

stages
object[]

A list of the workflow stages

templateKey
string

The template key

Response

Workflow response

_id
string
required

The ID of the workflow

Example:

"12ab3c4d5ef1a2345bcde67f"

_version
integer
required

The version of the workflow

Example:

1

_conflicts
object[]
required

Any conflicts that are present in the workflow stages

_creationDate
integer<int64>
required

Timestamp of when the workflow was created

Example:

"1654104600000"

_maintainerId
string
required

The member ID of the maintainer of the workflow. Defaults to the workflow creator.

Example:

"12ab3c45de678910abc12345"

The location and content type of related resources

name
string
required

The name of the workflow

Example:

"Progressive rollout starting in two days"

_execution
object
required

The current execution status of the workflow

Example:

"{\"status\": \"completed\"}"

description
string

A brief description of the workflow

Example:

"Turn flag on for 10% of customers each day"

kind
string

The kind of workflow

Example:

"custom"

stages
object[]

The stages that make up the workflow. Each stage contains conditions and actions.

meta
object

For workflows being created from a workflow template, this value holds any parameters that could potentially be incompatible with the current project, environment, or flag

templateKey
string

For workflows being created from a workflow template, this value is the template's key

Example:

"example-workflow-template"