Workflows

Create a new workflow

POST
/api/workflows

Creates a new Workflow owned by the caller user and organization. Stores the visual builder canvas (nodes + edges + viewport) and metadata. Names must be unique within the organization.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/workflows" \  -H "Content-Type: application/json" \  -d '{    "commandKey": "workflow-create-01J2YQ6P0M9M4J6YBZ8QJX7B9Q",    "name": "New Lead Welcome",    "description": "Greet new leads and assign them to a leasing agent.",    "nodes": [      {        "id": "n1",        "type": "trigger",        "position": {          "x": 50,          "y": 50        },        "data": {          "event": "application.created"        }      },      {        "id": "n2",        "type": "sendMessage",        "position": {          "x": 250,          "y": 50        },        "data": {          "template": "welcome-sms"        }      }    ],    "edges": [      {        "id": "e1",        "source": "n1",        "target": "n2"      }    ],    "viewport": {      "x": 0,      "y": 0,      "zoom": 1    },    "enabled": true  }'
{  "success": true,  "message": "Workflow created successfully",  "data": {    "_id": "64d2f9c5e8a1d4e001a0b1c2",    "name": "New Lead Welcome",    "description": "Greet new leads and assign them to a leasing agent.",    "organizationId": "64a1b2c3d4e5f60012345678",    "userId": "64a1b2c3d4e5f60012345679",    "nodes": [],    "edges": [],    "viewport": {      "x": 0,      "y": 0,      "zoom": 1    },    "enabled": false,    "createdAt": "2026-04-12T14:22:10.000Z",    "updatedAt": "2026-04-12T14:22:10.000Z"  }}