Workflows

Copy a Workflow

Copy a workflow to a new workflow with a different name. Can optionally copy to a different environment or copy a specific version of the workflow. When copying to a different environment, all functions used in the workflow will also be copied.

POST
/v2/workflows/copy
x-api-key<token>

Authenticate using API Key in request header

In: header

sourceWorkflowNamestring

Name of the source workflow to copy from.

Match^[a-zA-Z0-9_-]{1,128}$
Length1 <= length <= 128
sourceWorkflowVersionNum?integer

Optional version number of the source workflow to copy. If not provided, copies the current version.

Formatuint
Range1 <= value
targetEnvironment?string

Optional target environment name. If provided, copies the workflow to a different environment. When copying to a different environment, all functions used in the workflow will also be copied.

targetWorkflowNamestring

Name for the new copied workflow. Must be unique within the target environment.

Match^[a-zA-Z0-9_-]{1,128}$
Length1 <= length <= 128
targetDisplayName?string

Optional display name for the copied workflow. If not provided, uses the source workflow's display name with " (Copy)" appended.

tags?array<string>

Optional tags for the copied workflow. If not provided, uses the source workflow's tags.

Response Body

curl -X POST "https://api.bem.ai/v2/workflows/copy" \  -H "Content-Type: application/json" \  -d '{    "sourceWorkflowName": "string",    "targetWorkflowName": "string"  }'
{
  "environment": "string",
  "workflow": {
    "id": "string",
    "name": "string",
    "versionNum": 0,
    "displayName": "string",
    "emailAddress": "string",
    "tags": [
      "billing",
      "finance",
      "automated"
    ],
    "mainFunction": {
      "id": "string",
      "name": "string",
      "versionNum": 0
    },
    "relationships": [
      {
        "sourceFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        },
        "destinationName": "string",
        "destinationFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        }
      }
    ],
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "copiedFunctions": [
    {
      "sourceFunctionName": "string",
      "sourceFunctionID": "string",
      "sourceVersionNum": 1,
      "targetFunctionName": "string",
      "targetFunctionID": "string",
      "targetVersionNum": 1
    }
  ],
  "error": "string"
}
{
  "environment": "string",
  "workflow": {
    "id": "string",
    "name": "string",
    "versionNum": 0,
    "displayName": "string",
    "emailAddress": "string",
    "tags": [
      "billing",
      "finance",
      "automated"
    ],
    "mainFunction": {
      "id": "string",
      "name": "string",
      "versionNum": 0
    },
    "relationships": [
      {
        "sourceFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        },
        "destinationName": "string",
        "destinationFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        }
      }
    ],
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "copiedFunctions": [
    {
      "sourceFunctionName": "string",
      "sourceFunctionID": "string",
      "sourceVersionNum": 1,
      "targetFunctionName": "string",
      "targetFunctionID": "string",
      "targetVersionNum": 1
    }
  ],
  "error": "string"
}
{
  "environment": "string",
  "workflow": {
    "id": "string",
    "name": "string",
    "versionNum": 0,
    "displayName": "string",
    "emailAddress": "string",
    "tags": [
      "billing",
      "finance",
      "automated"
    ],
    "mainFunction": {
      "id": "string",
      "name": "string",
      "versionNum": 0
    },
    "relationships": [
      {
        "sourceFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        },
        "destinationName": "string",
        "destinationFunction": {
          "id": "string",
          "name": "string",
          "versionNum": 0
        }
      }
    ],
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "copiedFunctions": [
    {
      "sourceFunctionName": "string",
      "sourceFunctionID": "string",
      "sourceVersionNum": 1,
      "targetFunctionName": "string",
      "targetFunctionID": "string",
      "targetVersionNum": 1
    }
  ],
  "error": "string"
}