Replace a canvas definition
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const canva = await client.projects.canvas.replaceDefinition({ workspaceId: '<workspaceId>', projectId: '<projectId>', definition: { nodes: [ { id: 'node_abc123', type: 'videoBlock', data: {}, }, ], edges: [ { id: 'edge_abc123', source: '<source>', target: '<target>', source_handle: '<source_handle>', target_handle: '<target_handle>', }, ], node_inputs: {}, node_outputs: {}, },});console.log(canva);curl -X PUT 'https://app.flora.ai/api/v1/workspaces/<workspaceId>/projects/<projectId>/canvas/definition' \ -H 'Authorization: Bearer $FLORA_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "definition": { "nodes": [ { "id": "node_abc123", "type": "videoBlock", "data": {} } ], "edges": [ { "id": "edge_abc123", "source": "<source>", "target": "<target>", "source_handle": "<source_handle>", "target_handle": "<target_handle>" } ], "node_inputs": {}, "node_outputs": {} }}'Validates and atomically replaces the complete project canvas definition. Supplied positions are preserved and omitted positions receive deterministic automatic layout. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate.
Error responses use the standard error body.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Workspace identifier
Workspace identifier
Project identifier
Project identifier
Request Body required
Section titled “Request Body required ”object
Complete canvas definition to replace
object
Complete replacement canvas node list
object
Stable canvas node identifier
Flora canvas node type
Durable public node configuration; transient collaboration state is omitted
object
Parent group node identifier
Whether moving the node may expand its parent group
Authored node width
Authored node height
Durable node style properties
object
React Flow node origin
Canvas stacking order
Whether the node is hidden
Node position; omitted positions receive deterministic automatic layout
object
Horizontal canvas coordinate
Vertical canvas coordinate
Complete canvas edge list
object
Stable canvas edge identifier
Source node identifier
Target node identifier
Canvas edge renderer type
Durable edge configuration
object
Complete per-node generation and action input configuration
object
object
Complete current durable output attached to each node
object
object
Portable Layer Editor documents keyed by Layer Editor node identifier; omitted when no Layer Editor nodes exist
object
object
Responses
Section titled “ Responses ”Canvas definition replaced.
object
Project identifier
Project canvas URL
object
Complete ordered canvas node list
object
Stable canvas node identifier
Flora canvas node type
Durable public node configuration; transient collaboration state is omitted
object
Parent group node identifier
Whether moving the node may expand its parent group
Authored node width
Authored node height
Durable node style properties
object
React Flow node origin
Canvas stacking order
Whether the node is hidden
Persisted node position
object
Horizontal canvas coordinate
Vertical canvas coordinate
Complete canvas edge list
object
Stable canvas edge identifier
Source node identifier
Target node identifier
Canvas edge renderer type
Durable edge configuration
object
Complete per-node generation and action input configuration
object
object
Complete current durable output attached to each node
object
object
Portable Layer Editor documents keyed by Layer Editor node identifier; omitted when no Layer Editor nodes exist
object
object
object
Example
{ "project_id": "prj_abc123", "definition": { "nodes": [ { "id": "node_abc123", "type": "videoBlock", "extent": "parent" } ], "edges": [ { "id": "edge_abc123" } ] }}