POST /api/workflows — Define and save a workflow graph with nodes and edges. Supports TRIGGER, DATA_SOURCE, AI, FILTER, and OUTPUT node types.
Creating a workflow in Flowmatic means describing a directed graph of nodes connected by edges. Each node represents a discrete step — triggering the run, loading data, applying a filter, generating AI output, or delivering a result — and edges define the order in which those steps execute. You send the full graph definition in a single request, and Flowmatic validates, saves, and returns the workflow with a unique ID you can use to run or manage it later.
A human-readable display name for the workflow. This name appears in the dashboard and in list/get responses to help you identify the workflow at a glance.
An ordered array of node objects. Each node represents one step in the workflow. Every node must have a unique id within the graph. Supported node types are TRIGGER, DATA_SOURCE, AI, FILTER, and OUTPUT.
A short, unique identifier for this node within the graph (e.g., "t", "ds", "ai"). You reference this ID in edge definitions and in template expressions — for example, a node with id: "ds" exposes its output as {{ds.rows}}.
Configuration specific to the node type. Pass an empty object ({}) for TRIGGER nodes. For all other node types, supply the required fields for that type (e.g., uploadId for DATA_SOURCE, prompt and output for AI, source and expr for FILTER, and forEach/to/subject/body for OUTPUT).
An array of edge objects that define the directed connections between nodes. Edges determine execution order — Flowmatic runs nodes in topological order based on this list.
The two examples below show the most common workflow patterns. The first uses a FILTER node for pure logic-based row selection. The second delegates selection and message composition to an AI node.
FILTER Workflow
AI Workflow
This workflow loads a customer list, keeps only rows where rating is greater than 4, and sends a thank-you email to each qualifying customer — no LLM call required.
This workflow passes the full customer list to an LLM, which selects high-rated customers and generates a personalised message body. The OUTPUT node then sends that message to each selected customer.
A successful request returns HTTP 201 Created with a JSON body representing the saved workflow. Record the id field — you will use it as workflowId when running, updating, or deleting the workflow.