ConnectCloud Developers

Draft a new personal flow from a description through the ai module (tenant:flows:write|admin)

POST /api/flows/v1/flows/generate

Module: Flows · operationId: generateFlow · Tag: Flows · Auth: access token (Authorization: Bearer <accessToken>)

Picks the catalogue's actions and events the caller holds a permission of, writes the YAML and corrects it with the validator's findings (at most three attempts). The flow is created as the caller's personal flow with the draft – also when it is still invalid (validation lists the findings) – and never published. 6 per minute and caller. 503 ai_unavailable without the ai module, 503 ai_failed when the model did not answer.

Request body

application/json (required)

  • description (string, required): What the flow should do (max length 4000)
  • name (string): The flow's name; default: the description's first words (max length 200)

Example:

{
  "description": "Wenn ein dringendes Ticket angelegt wird, schicke mir eine Mail mit dem Titel.",
  "name": "Dringende Tickets per Mail"
}

Responses

  • 201 The new flow with its generated draft (application/json)
  • 400 Invalid input (invalid); field names the first invalid field, details.fields every one. (application/json)
  • 401 Missing, invalid or expired token (no body).
  • 403 The token lacks the permission or has no active tenant (forbidden). Also: person_required (a service-account key on personal flows or the task inbox), live_test_forbidden, forbidden_grant, starter_excluded. (application/json)
  • 429 Too many generations
  • 503 A dependency is not available: scope_unavailable (the module that owns a flow's scope did not answer who may see and manage it – nothing of a scoped flow is shown or changed), identity_unavailable (HR), ai_unavailable, ai_failed. (application/json)

Fields of the 201 answer:

  • attempts (integer, required): How often the draft was written (corrections included)
  • flow (Flow, required)
    • archived (boolean): Whether the flow is archived
    • canEdit (boolean): Whether the caller may change the draft and publish (a scoped flow: the owning module lets the caller manage the scope and the token holds tenant:flows:write or admin)
    • createdAt (string (date-time)): When the flow was created
    • createdBy (string): E-mail of the creator
    • description (string): Description from the definition
    • enabled (boolean): Whether the published version's triggers start runs
    • id (string (uuid)): Flow id
    • key (string): Unique per tenant; sub-flows call a flow by it
    • name (string): Display name
    • owner (string): personal (acts as its creator) or tenant (acts as its service account) (one of personal, tenant)
    • ownerEmail (string): Personal flows: the owner; tenant flows: who created it
    • pausedReason (string): Why runs stopped by themselves (owner_inactive, permission_lost, tripped)
    • publishedNumber (integer): The live version
    • scope (string): What the flow belongs to – desk:space:<id> or forge:project:<id>; absent for a tenant or personal flow. The owning module decides who sees and manages a scoped flow ("Scoped flows").
    • serviceAccountId (string (uuid)): Tenant flows: the account it acts as
    • updatedAt (string (date-time)): When the flow was changed last
    • updatedBy (string): E-mail of who changed the flow last
    • version (integer): Send it with changes
  • validation (Validation, required)
    • diagnostics (array of Diagnostic, required): Findings of the validator
      • code (string, required): Stable code, e.g. unknown_port, invalid_assignee, mail_option_not_allowed (a mail node sets mandatory or mailChannel in a personal or scoped flow)
      • message (string, required): Human-readable explanation
      • severity (string, required): Errors block publishing (one of error, warning)
      • col (integer): Column in the YAML (1-based)
      • line (integer): Line in the YAML (1-based)
      • nodeId (string): The node the finding is about
      • params (object): mail_option_not_allowed: option (mandatory or mailChannel)
      • path (string): Dotted path in the definition
    • permissions (array of array of string, required): The any-of permission groups of the actions and events the flow uses
    • valid (boolean, required): False when a finding has severity error
    • ports (object): The output ports of every node that parsed, by node id (the builder's handles)

Example 201 answer:

{
  "attempts": 2,
  "flow": {
    "archived": false,
    "canEdit": true,
    "createdAt": "2026-11-18T09:05:40Z",
    "createdBy": "sophie.huber@muster-it.example",
    "enabled": false,
    "id": "7c9e1b3d-5f7a-4b9c-8d0e-2f4a6c8e0b2d",
    "key": "dringende-tickets-per-mail",
    "name": "Dringende Tickets per Mail",
    "owner": "personal",
    "ownerEmail": "sophie.huber@muster-it.example",
    "updatedAt": "2026-11-18T09:05:40Z",
    "updatedBy": "sophie.huber@muster-it.example",
    "version": 1
  },
  "validation": {
    "diagnostics": [],
    "permissions": [
      [
        "desk:read",
        "desk:write",
        "desk:admin"
      ]
    ],
    "valid": true
  }
}

Example request

curl -X POST 'https://api.mbcom.cloud/api/flows/v1/flows/generate' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"description":"Wenn ein dringendes Ticket angelegt wird, schicke mir eine Mail mit dem Titel.","name":"Dringende Tickets per Mail"}'

View as Markdown · Interactive reference · OpenAPI