Skip to content

Update a canvas action

PATCH
/projects/{projectId}/actions/{nodeId}
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const action = await client.projects.actions.update({
projectId: '<projectId>',
nodeId: '<nodeId>',
code: '<code>',
language: 'javascript',
runtime: 'node',
label: '<label>',
params: {},
});
console.log(action);

Changes a canvas action node in place: replacement code for a custom action (fix a broken action without adding a second node), a label, or stored parameter values. Custom code needs the workspace plan to include custom actions. Returns the node’s description after the change.

Error responses use the standard error body.

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

nodeId
required

Canvas action node identifier: the persisted short id (n7) or the node UUID

string
>= 1 characters /^\S+$/

Canvas action node identifier: the persisted short id (n7) or the node UUID

Media type application/json
object
code

Replacement source for a custom action node, annotated like a create. The node keeps its id and wiring; its parameter values survive where the new code still declares them, its preview state is reset. Rejected on a prebuilt node. Limits: at most 1048576 bytes of UTF-8 source; each @flora-inputs, @flora-outputs and @flora-params JSON array at most 131072 bytes, with up to 64 inputs, 64 outputs, 128 params and 256 options per select. A multiple bounds object takes nonnegative integer min and max with min (1 when absent) at most max, and each declared default must be a value its param accepts.

string
>= 1 characters
language

Language of the replacement code; defaults to the node’s current language.

string
Allowed values: javascript python
runtime

Where custom code runs. python code runs on python; javascript runs on node (the harness with getInput/getParam/writeOutput) or browser (an ES module exporting execute and optionally preview, which hosts can mount live). Defaults to browser for JavaScript that exports execute, otherwise the language’s sandbox. Ignored with action_id.

string
Allowed values: node python browser
label

New node label on the canvas.

string
>= 1 characters <= 120 characters
params

Action parameters (snake_case keys). For a prebuilt action the accepted keys depend on action_id; see GET /actions/{actionId} or POST /runs/action for the per-action schema. For a custom action they are the keys its @flora-params annotation declares, as GET /projects/{projectId}/actions/{nodeId} lists them, in at most 262144 bytes of JSON.

object
key
additional properties
any

Canvas action updated.

Media type application/json
object
project_id
required

Project identifier

string
/^prj_\S+$/
node_id
required

Canvas action node UUID

string
>= 1 characters
short_id
required
Any of:
string
action_id
required
Any of:

Action identifier

string
Allowed values: color-grade-image-browser overlay-image-browser draw-image-browser pixel-remover-image-browser magic-eraser-image-browser crop-image-browser scene-3d-image-browser blur-image-browser change-image-ar-browser rotate-image-browser color-filter-image-browser color-tint-image-browser filter-color-image-browser duplicate-image-browser side-by-side-composite-browser add-shape-to-image-browser add-text-to-image-browser qr-code-generator-browser resize-image-browser shader-effect-browser split-text-browser find-and-replace-text-browser concat-text-browser ken-burns-video stitch-videos split-video extract-video-frames color-grade-video video-to-frame-grid boomerang-video reverse-video video-to-long-exposure video-effect color-filter-video speed-up-video slow-down-video duplicate-video greenscreen-video resize-video change-video-ar split-audio-from-video merge-audio-into-video
custom
required

True when the node runs its own code rather than a prebuilt action

boolean
name
required

Action name

string
description
required

Action description

string
language
required

Action source language

string
Allowed values: javascript python
runtime
required

Where the action executes: a server sandbox (node, python) or the browser runtime (browser), which a host can also run live

string
Allowed values: node python browser
has_preview
required

True when the code is a browser-runtime module exporting preview, so a host can mount it live and re-render edits without a run

boolean
code
required
Any of:

The action’s source. For a browser-runtime action, mount it in the FLORA action runtime frame for a live preview; a run replays the same code on the server.

string
tool_state
Any of:
charged_cost
required

Cost per execution in USD

number
locked
required

True when the node is locked and cannot be run or edited

boolean
inputs
required

Action input slots

Array<object>
object
name
required

Action input or output name

string
type
required

Action input or output media type

string
Allowed values: image video text audio model3d
dynamic

Deprecated alias for multiple: true. Mirrors multiple for back-compat.

boolean
optional

Whether the slot allows zero connections in single-input mode. Ignored when multiple is the object form (use min: 0 there instead).

boolean
multiple
Any of:
outputs
required

Action output slots

Array<object>
object
name
required

Action input or output name

string
type
required

Action input or output media type

string
Allowed values: image video text audio model3d
dynamic

Deprecated alias for multiple: true. Mirrors multiple for back-compat.

boolean
optional

Whether the slot allows zero connections in single-input mode. Ignored when multiple is the object form (use min: 0 there instead).

boolean
multiple
Any of:
params
required

Action parameters (snake_case keys)

Array<object>
object
key
required

Action parameter key

string
type
required

Action parameter control type

string
label

Action parameter label

string
info_tooltip

Action parameter description

string
default_value

Default parameter value

available_values

Allowed parameter values

Array<object>
object
value
required
string
label
required
string
description
string
min_number_value

Lowest accepted number

number
max_number_value

Highest accepted number

number
number_step

Step between accepted numbers

number
placeholder

Placeholder shown in an empty text control

string
max_count

For colorList controls: how many colors the value may hold

integer
visible_if

Conditions under which a control is shown, all of which must hold. Keys are the snake_case keys of this same params list.

Array<object>
object
key
required

Key of the parameter this condition reads

string
equals
Any of:
string
not_equals
Any of:
string
point2d_min

Per-axis minimum for point2d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
point2d_max

Per-axis maximum for point2d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
point2d_step

Per-axis step for point2d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
point3d_min

Per-axis minimum for point3d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
point3d_max

Per-axis maximum for point3d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
point3d_step

Per-axis step for point3d values

object
x

Bound on the x axis

number
y

Bound on the y axis

number
z

Bound on the z axis (point3d only)

number
param_values
required

Parameter values stored on the node, keyed like params[].key; defaults apply for missing keys

object
key
additional properties
any
connected_inputs
required

Nodes wired into this action, in edge order

Array<object>
object
node_id
required

Short id (n7) or UUID of the connected node

string
label
required
Any of:
string
type
required
Any of:
string
Allowed values: image video text audio model3d
url
required
Any of:
string
text
required
Any of:
string
canvas_url
required

Project canvas URL

string format: uri
Example
{
"project_id": "prj_abc123",
"node_id": "4d2f7c7e-1b1a-4c7f-9e1d-5b9d1f3b2c10",
"action_id": "color-grade-image-browser",
"name": "Poster palette",
"language": "javascript",
"runtime": "node",
"inputs": [
{
"name": "image",
"type": "image",
"multiple": true
}
],
"outputs": [
{
"name": "image",
"type": "image",
"multiple": true
}
],
"params": [
{
"key": "angle",
"type": "select",
"label": "Angle",
"info_tooltip": "Rotation angle in degrees."
}
],
"connected_inputs": [
{
"node_id": "n3",
"type": "image"
}
]
}