Skip to content

Patch project canvas

PATCH
/projects/{projectId}/canvas
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const canva = await client.projects.canvas.update({
projectId: '<projectId>',
diagram: 'graph LR\n source["Product photo (Image)"]\n output["Editorial campaign image (Image)"]\n source --> output',
});
console.log(canva);

Applies a Mermaid flowchart patch to the project canvas using the same create_workflow path as the Fauna agent. The diagram may add nodes, connect nodes, and reference existing canvas nodes by their Mermaid short IDs in edges (e.g. n1 --> out). This endpoint is add-only: re-declaring an existing node id with a label (e.g. n3["..."]) creates a NEW node instead of updating the existing one, and returns a warning. To attach to an existing node, reference its id in an edge without re-declaring its label. Subgraph grouping is not applied (nodes inside a subgraph are added ungrouped) and returns a warning. To place an existing image/video/audio as a static node, set node_params — which is keyed by Mermaid node id, e.g. { "img1": { "content_url": "https://…" } }, NOT a bare { content_url } object. prompt and content_url are mutually exclusive for a node: use prompt (or a label that doubles as the prompt) for generation, or content_url for existing media. When using content_url, give the node a content-free type-only label such as img1["(Image)"] so no prompt is inferred from the label.

Error responses use the standard error body.

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

Media type application/json
object
diagram
required

Mermaid flowchart diagram to apply

string
>= 1 characters
node_params

Optional per-node parameters, keyed by Mermaid node id (a Record<nodeId, NodeParams>), e.g. { “img1”: { “content_url”: “https://…” } }. Pass a map keyed by node id, NOT a bare { content_url } object.

object
key
additional properties
object
prompt
Any of:
string
model
Any of:
string
content_url
Any of:
string format: uri
aspect_ratio
Any of:
string
resolution
Any of:
string
model_parameters
Any of:
object
key
additional properties
any

Project canvas patched.

Media type application/json
object
project_id
required

Project identifier

string
/^prj_\S+$/
canvas_url
required

Project canvas URL

string format: uri
diagram
required

Applied Mermaid flowchart diagram

string
>= 1 characters
created_node_count
required
integer
created_edge_count
required
integer
warnings
Array<string>
Example
{
"project_id": "prj_abc123",
"diagram": "graph LR\n n1[\"Prompt (text)\"]\n n2[\"Result (image)\"]\n n1 --> n2"
}