Workflows

Update a Workflow

Update an existing workflow's configuration.

Updates create a new version of the workflow. The previous version remains available for reference. You can update metadata (name, displayName, tags) or the workflow structure (mainFunction, relationships).

Update Behavior

  • Metadata updates: Change name, displayName, or tags without affecting workflow structure
  • Structure updates: Modify mainFunction and/or relationships to change how functions are connected

Important Notes

  • The mainFunction and relationships fields must be provided together if updating workflow structure
  • If only mainFunction is provided, relationships defaults to an empty array
  • If relationships is provided, mainFunction must also be provided
  • Each update increments the version number automatically
PATCH
/v2/workflows/{workflowName}
x-api-key<token>

Authenticate using API Key in request header

In: header

Path Parameters

workflowName*string

Request Body

application/json

name?string

Name of workflow. Can be updated to rename the workflow. Must be unique within the environment and match the pattern ^[a-zA-Z0-9_-]{1,128}$.

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

Display name of workflow.

tags?array<>

Array of tags to categorize and organize workflows.

mainFunction?

Main function for the workflow. The mainFunction and relationships fields act as a unit and must be provided together, or neither provided.

  • If mainFunction is provided without relationships, relationships will default to an empty array.
  • If relationships is provided, mainFunction must also be provided (validation error if missing).
  • If neither is provided, both mainFunction and relationships remain unchanged from the current workflow version.
relationships?array<>

Relationships between functions in the workflow. The mainFunction and relationships fields act as a unit and must be provided together, or neither provided.

  • If relationships is provided, mainFunction must also be provided (validation error if missing).
  • If mainFunction is provided without relationships, relationships will default to an empty array.
  • If neither is provided, both mainFunction and relationships remain unchanged from the current workflow version.

Response Body

application/json

curl -X PATCH "https://api.bem.ai/v2/workflows/string" \  -H "Content-Type: application/json" \  -d '{    "mainFunction": {      "name": "document-router",      "versionNum": 1    },    "relationships": [      {        "sourceFunction": {          "name": "document-router",          "versionNum": 1        },        "destinationName": "invoices",        "destinationFunction": {          "name": "invoice-extractor",          "versionNum": 2        }      },      {        "sourceFunction": {          "name": "document-router",          "versionNum": 1        },        "destinationName": "receipts",        "destinationFunction": {          "name": "receipt-extractor",          "versionNum": 1        }      },      {        "sourceFunction": {          "name": "document-router",          "versionNum": 1        },        "destinationName": "contracts",        "destinationFunction": {          "name": "contract-extractor",          "versionNum": 1        }      }    ]  }'
{
  "workflow": {
    "id": "string",
    "name": "string",
    "versionNum": 0,
    "displayName": "string",
    "emailAddress": "string",
    "tags": [
      "string"
    ],
    "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",
    "audit": {
      "workflowCreatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      },
      "workflowLastUpdatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      },
      "versionCreatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      }
    }
  },
  "error": "string"
}