Workflows

Create a Workflow

Create a new workflow to orchestrate function execution.

Workflows define how functions are connected together to process data through multiple steps. A workflow has a mainFunction as its entry point, and optional relationships that define how data flows between functions.

Workflow Structure

  • mainFunction: The entry point function that receives initial input
  • relationships: Define connections between functions (required for multi-function workflows)

Single Function Workflows

For simple use cases, create a workflow with just a mainFunction and no relationships. The workflow will execute only that function.

Multi-Function Workflows

For complex pipelines, define relationships to connect functions:

  • sourceFunction: The function that produces output
  • destinationName: The named output/route from the source function
  • destinationFunction: The function that receives the output
POST
/v2/workflows
x-api-key<token>

Authenticate using API Key in request header

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.bem.ai/v2/workflows" \  -H "Content-Type: application/json" \  -d '{    "name": "invoice-enrichment-pipeline",    "displayName": "Invoice Enrichment Pipeline",    "mainFunction": {      "name": "invoice-extractor",      "versionNum": 2    },    "relationships": [      {        "sourceFunction": {          "name": "invoice-extractor",          "versionNum": 2        },        "destinationFunction": {          "name": "vendor-enricher",          "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"
}