Skip to content

Replace a canvas definition

PUT
/workspaces/{workspaceId}/projects/{projectId}/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);

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.

workspaceId
required

Workspace identifier

string
/^ws_\S+$/

Workspace identifier

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

Media type application/json
object
definition
required

Complete canvas definition to replace

object
nodes
required

Complete replacement canvas node list

Array<object>
<= 2000 items
object
id
required

Stable canvas node identifier

string
>= 1 characters <= 200 characters
type
required

Flora canvas node type

string
Allowed values: videoBlock textBlock comment group ghost virtualSourceNode emptyImageBlock outpaintImageBlock inpaintImageBlock staticImageBlock staticVideoBlock resultImageBlock resultVideoBlock resultTextBlock audioBlock resultAudioBlock staticAudioBlock techniqueBlock layerEditorNode videoEditorNode collectionNode routerNode switchNode elementNode textLabel notes codeBlock documentNode deckNode exportNode webcamNode model3dNode
data
required

Durable public node configuration; transient collaboration state is omitted

object
key
additional properties
any
parent_id

Parent group node identifier

string
>= 1 characters <= 200 characters
extent
Any of:
Allowed value: parent
expand_parent

Whether moving the node may expand its parent group

boolean
width

Authored node width

number
height

Authored node height

number
style

Durable node style properties

object
key
additional properties
any
origin

React Flow node origin

array
z_index

Canvas stacking order

number
hidden

Whether the node is hidden

boolean
position

Node position; omitted positions receive deterministic automatic layout

object
x
required

Horizontal canvas coordinate

number
y
required

Vertical canvas coordinate

number
edges
required

Complete canvas edge list

Array<object>
<= 10000 items
object
id
required

Stable canvas edge identifier

string
>= 1 characters <= 200 characters
source
required

Source node identifier

string
>= 1 characters <= 200 characters
target
required

Target node identifier

string
>= 1 characters <= 200 characters
source_handle
required
Any of:
string
target_handle
required
Any of:
string
type

Canvas edge renderer type

string
data

Durable edge configuration

object
key
additional properties
any
node_inputs
required

Complete per-node generation and action input configuration

object
key
additional properties
object
key
additional properties
any
node_outputs
required

Complete current durable output attached to each node

object
key
additional properties
object
key
additional properties
any
layer_editor_documents

Portable Layer Editor documents keyed by Layer Editor node identifier; omitted when no Layer Editor nodes exist

object
key
additional properties
object
key
additional properties
any

Canvas definition replaced.

Media type application/json
object
project_id
required

Project identifier

string
/^prj_\S+$/
canvas_url
required

Project canvas URL

string format: uri
definition
required
object
nodes
required

Complete ordered canvas node list

Array<object>
<= 2000 items
object
id
required

Stable canvas node identifier

string
>= 1 characters <= 200 characters
type
required

Flora canvas node type

string
Allowed values: videoBlock textBlock comment group ghost virtualSourceNode emptyImageBlock outpaintImageBlock inpaintImageBlock staticImageBlock staticVideoBlock resultImageBlock resultVideoBlock resultTextBlock audioBlock resultAudioBlock staticAudioBlock techniqueBlock layerEditorNode videoEditorNode collectionNode routerNode switchNode elementNode textLabel notes codeBlock documentNode deckNode exportNode webcamNode model3dNode
data
required

Durable public node configuration; transient collaboration state is omitted

object
key
additional properties
any
parent_id

Parent group node identifier

string
>= 1 characters <= 200 characters
extent
Any of:
Allowed value: parent
expand_parent

Whether moving the node may expand its parent group

boolean
width

Authored node width

number
height

Authored node height

number
style

Durable node style properties

object
key
additional properties
any
origin

React Flow node origin

array
z_index

Canvas stacking order

number
hidden

Whether the node is hidden

boolean
position
required

Persisted node position

object
x
required

Horizontal canvas coordinate

number
y
required

Vertical canvas coordinate

number
edges
required

Complete canvas edge list

Array<object>
<= 10000 items
object
id
required

Stable canvas edge identifier

string
>= 1 characters <= 200 characters
source
required

Source node identifier

string
>= 1 characters <= 200 characters
target
required

Target node identifier

string
>= 1 characters <= 200 characters
source_handle
required
Any of:
string
target_handle
required
Any of:
string
type

Canvas edge renderer type

string
data

Durable edge configuration

object
key
additional properties
any
node_inputs
required

Complete per-node generation and action input configuration

object
key
additional properties
object
key
additional properties
any
node_outputs
required

Complete current durable output attached to each node

object
key
additional properties
object
key
additional properties
any
layer_editor_documents

Portable Layer Editor documents keyed by Layer Editor node identifier; omitted when no Layer Editor nodes exist

object
key
additional properties
object
key
additional properties
any
summary
required
object
node_count
required
integer
edge_count
required
integer
workflow_count
required
integer
isolated_node_count
required
integer
group_count
required
integer
Example
{
"project_id": "prj_abc123",
"definition": {
"nodes": [
{
"id": "node_abc123",
"type": "videoBlock",
"extent": "parent"
}
],
"edges": [
{
"id": "edge_abc123"
}
]
}
}