Workflows (beta)

Workflows is an Enterprise feature

Workflows is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

This feature is in beta

To use this feature, pass in a header including the LD-API-Version key with value set to beta. Use this header with each call. To learn more, read Beta resources.

A workflow is a set of actions that you can schedule in advance to make changes to a feature flag at a future date and time. You can also include approval requests at different stages of a workflow. To learn more, read Workflows.

The actions supported are as follows:

  • Turning targeting ON or OFF
  • Setting the default variation
  • Creating a rule to target a group of users by segment
  • Modifying the rollout percentage for rules

You can create multiple stages of a flag release workflow. Unique stages are defined by their conditions: either approvals and/or scheduled changes.

Get workflows

Display workflows associated with a feature flag.

Request
path Parameters
projectKey
required
string <string>

The project key

featureFlagKey
required
string <string>

The feature flag key

environmentKey
required
string <string>

The environment key

Responses
200

Workflows collection response

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows
Request samples
Response samples
application/json
{
  • "items": [
    ]
}

Create workflow

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.

Example request body

{
  "name": "Progressive rollout starting in two days",
  "description": "Turn flag on for 10% of users each day",
  "stages": [
    {
      "name": "10% rollout on day 1",
      "conditions": [
        {
          "kind": "schedule",
          "scheduleKind": "relative",
          "waitDuration": 2,
          "waitDurationUnit": "calendarDay"
        }
      ],
      "action": {
        "instructions": [
          {
            "kind": "turnFlagOn"
          },
          {
            "kind": "updateFallthroughVariationOrRollout",
            "rolloutWeights": {
              "452f5fb5-7320-4ba3-81a1-8f4324f79d49": 90000,
              "fc15f6a4-05d3-4aa4-a997-446be461345d": 10000
            }
          }
        ]
      }
    }
  ]
}

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

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"
            }
        }
    ]
}

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.

Request
path Parameters
projectKey
required
string <string>

The project key

featureFlagKey
required
string <string>

The feature flag key

environmentKey
required
string <string>

The environment key

query Parameters
templateKey
string <string>

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

Request Body schema: application/json
maintainerId
string (ObjectId)
name
string

The workflow name

description
required
string

The workflow description

Array of objects (StageInput)

A list of the workflow stages

templateKey
string

The template key

Responses
201

Workflow response

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

post/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows
Request samples
application/json
{
  • "description": "Turn flag on for 10% of users each day",
  • "name": "Progressive rollout starting in two days",
  • "stages": [
    ]
}
Response samples
application/json
{
  • "_id": "12ab3c4d5ef1a2345bcde67f",
  • "_version": 1,
  • "_conflicts": [
    ],
  • "_creationDate": 0,
  • "_maintainerId": "12ab3c45de678910abc12345",
  • "_links": {
    },
  • "name": "Progressive rollout starting in two days",
  • "description": "Turn flag on for 10% of users each day",
  • "kind": "custom",
  • "stages": [
    ],
  • "_execution": {
    },
  • "meta": {
    },
  • "templateKey": "example-workflow-template"
}

Get custom workflow

Get a specific workflow by ID.

Request
path Parameters
projectKey
required
string <string>

The project key

featureFlagKey
required
string <string>

The feature flag key

environmentKey
required
string <string>

The environment key

workflowId
required
string <string>

The workflow ID

Responses
200

Workflow response

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

get/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows/{workflowId}
Request samples
Response samples
application/json
{
  • "_id": "12ab3c4d5ef1a2345bcde67f",
  • "_version": 1,
  • "_conflicts": [
    ],
  • "_creationDate": 0,
  • "_maintainerId": "12ab3c45de678910abc12345",
  • "_links": {
    },
  • "name": "Progressive rollout starting in two days",
  • "description": "Turn flag on for 10% of users each day",
  • "kind": "custom",
  • "stages": [
    ],
  • "_execution": {
    },
  • "meta": {
    },
  • "templateKey": "example-workflow-template"
}

Delete workflow

Delete a workflow from a feature flag.

Request
path Parameters
projectKey
required
string <string>

The project key

featureFlagKey
required
string <string>

The feature flag key

environmentKey
required
string <string>

The environment key

workflowId
required
string <string>

The workflow id

Responses
204

Action completed successfully

400

Invalid request

401

Invalid access token

403

Forbidden

404

Invalid resource identifier

429

Rate limited

delete/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows/{workflowId}
Request samples
Response samples
application/json
{
  • "code": "invalid_request",
  • "message": "Invalid request body"
}