v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
Workflows

Create workflow

Workflows are in maintenance mode

The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified. We will work with existing customers using workflows to migrate to a replacement solution when deprecation occurs.

Create a workflow for a feature flag. You can create a workflow directly, or you can apply a template to create a new workflow.

Creating a workflow

You can use the create workflow endpoint to create a workflow directly by adding a stages array to the request body.

For each stage, define the name, conditions when the stage should be executed, and action that describes the stage. For approval stages, only standard LaunchDarkly approvals are permitted. Workflows of kind integration-approval cannot be used for custom workflows.

<details> <summary>Click to expand example</summary>

Example request body

{
  "name": "Progressive rollout starting in two days",
  "description": "Turn flag targeting on and increase feature rollout in 10% increments each day",
  "stages": [
    {
      "name": "10% rollout on day 1",
      "conditions": [
        {
          "kind": "schedule",
          "scheduleKind": "relative", // or "absolute"
              //  If "scheduleKind" is "absolute", set "executionDate";
              // "waitDuration" and "waitDurationUnit" will be ignored
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        },
        {
          "kind": "ld-approval",
          "notifyMemberIds": [ "507f1f77bcf86cd799439011" ],
          "notifyTeamKeys": [ "team-key-123abc" ]
        }
      ],
      "action": {
        "instructions": [
          {
            "kind": "turnFlagOn"
          },
          {
            "kind": "updateFallthroughVariationOrRollout",
            "rolloutWeights": {
              "452f5fb5-7320-4ba3-81a1-8f4324f79d49": 90000,
              "fc15f6a4-05d3-4aa4-a997-446be461345d": 10000
            }
          }
        ]
      }
    }
  ]
}
</details>

Creating a workflow by applying a workflow template

You can also create a workflow by applying a workflow template. If you pass a valid workflow template key as the templateKey query parameter with the request, the API will attempt to create a new workflow with the stages defined in the workflow template with the corresponding key.

Applicability of stages

Templates are created in the context of a particular flag in a particular environment in a particular project. However, because workflows created from a template can be applied to any project, environment, and flag, some steps of the workflow may need to be updated in order to be applicable for the target resource.

You can pass a dryRun query parameter to tell the API to return a report of which steps of the workflow template are applicable in the target project/environment/flag, and which will need to be updated. When the dryRun query parameter is present the response body includes a meta property that holds a list of parameters that could potentially be inapplicable for the target resource. Each of these parameters will include a valid field. You will need to update any invalid parameters in order to create the new workflow. You can do this using the parameters property, which overrides the workflow template parameters.

Overriding template parameters

You can use the parameters property in the request body to tell the API to override the specified workflow template parameters with new values that are specific to your target project/environment/flag.

<details> <summary>Click to expand example</summary>

Example request body

{
	"name": "workflow created from my-template",
	"description": "description of my workflow",
	"parameters": [
		{
			"_id": "62cf2bc4cadbeb7697943f3b",
			"path": "/clauses/0/values",
			"default": {
				"value": ["updated-segment"]
			}
		},
		{
			"_id": "62cf2bc4cadbeb7697943f3d",
			"path": "/variationId",
			"default": {
				"value": "abcd1234-abcd-1234-abcd-1234abcd12"
			}
		}
	]
}
</details>

If there are any steps in the template that are not applicable to the target resource, the workflow will not be created, and the meta property will be included in the response body detailing which parameters need to be updated.

post/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows

Path parameters

projectKeystring string required

The project key

The project key

featureFlagKeystring string required

The feature flag key

The feature flag key

environmentKeystring string required

The environment key

The environment key

Query parameters

templateKeystring string

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

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

dryRunboolean

Whether to call the endpoint in dry-run mode

Whether to call the endpoint in dry-run mode

Request body

maintainerIdstring
namestring required

The workflow name

descriptionstring

The workflow description

templateKeystring

The template key

Example request

{
  "name": "Progressive rollout starting in two days",
  "description": "Turn flag on for 10% of users each day",
  "stages": [
    {
      "name": "10% rollout on day 1",
      "executeConditionsInSequence": true,
      "conditions": [
        {
          "kind": "schedule",
          "scheduleKind": "relative",
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        }
      ],
      "action": {
        "instructions": "{\"instructions\": [{ \"kind\": \"turnFlagOn\"}]}"
      }
    }
  ]
}

Response

Workflow response

_idstring required

The ID of the workflow

_versioninteger required

The version of the workflow

_creationDateinteger required
_maintainerIdstring required

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

_linksobject required

The location and content type of related resources

namestring required

The name of the workflow

descriptionstring

A brief description of the workflow

kindstring

The kind of workflow

templateKeystring

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

Example response

{
  "_id": "12ab3c4d5ef1a2345bcde67f",
  "_version": 1,
  "_conflicts": [
    {
      "stageId": "12ab3c4d5ef1a2345bcde67f"
    }
  ],
  "_maintainerId": "12ab3c45de678910abc12345",
  "name": "Progressive rollout starting in two days",
  "description": "Turn flag on for 10% of customers each day",
  "kind": "custom",
  "stages": [
    {
      "_id": "12ab3c45de678910abc12345",
      "name": "10% rollout on day 1",
      "conditions": [
        {
          "_execution": {
            "status": "completed"
          },
          "id": "12ab3c45de678910abc12345",
          "kind": "schedule",
          "scheduleKind": "relative",
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        }
      ],
      "action": {
        "kind": "patch"
      },
      "_execution": {
        "status": "completed"
      }
    }
  ],
  "_execution": {
    "status": "completed"
  },
  "templateKey": "example-workflow-template"
}