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);fieldnames the first invalid field,details.fieldsevery 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 archivedcanEdit(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 createdcreatedBy(string): E-mail of the creatordescription(string): Description from the definitionenabled(boolean): Whether the published version's triggers start runsid(string (uuid)): Flow idkey(string): Unique per tenant; sub-flows call a flow by itname(string): Display nameowner(string):personal(acts as its creator) ortenant(acts as its service account) (one ofpersonal,tenant)ownerEmail(string): Personal flows: the owner; tenant flows: who created itpausedReason(string): Why runs stopped by themselves (owner_inactive, permission_lost, tripped)publishedNumber(integer): The live versionscope(string): What the flow belongs to –desk:space:<id>orforge: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 asupdatedAt(string (date-time)): When the flow was changed lastupdatedBy(string): E-mail of who changed the flow lastversion(integer): Send it with changes
validation(Validation, required)diagnostics(array of Diagnostic, required): Findings of the validatorcode(string, required): Stable code, e.g.unknown_port,invalid_assignee,mail_option_not_allowed(a mail node setsmandatoryormailChannelin a personal or scoped flow)message(string, required): Human-readable explanationseverity(string, required): Errors block publishing (one oferror,warning)col(integer): Column in the YAML (1-based)line(integer): Line in the YAML (1-based)nodeId(string): The node the finding is aboutparams(object):mail_option_not_allowed:option(mandatoryormailChannel)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 usesvalid(boolean, required): False when a finding has severityerrorports(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"}'