Update a canvas action
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);curl -X PATCH 'https://app.flora.ai/api/v1/projects/<projectId>/actions/<nodeId>' \ -H 'Authorization: Bearer $FLORA_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "code": "<code>", "language": "javascript", "runtime": "node", "label": "<label>", "params": {}}'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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Project identifier
Project identifier
Canvas action node identifier: the persisted short id (n7) or the node UUID
Canvas action node identifier: the persisted short id (n7) or the node UUID
Request Body
Section titled “Request Body ”object
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.
Language of the replacement code; defaults to the node’s current language.
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.
New node label on the canvas.
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
Responses
Section titled “ Responses ”Canvas action updated.
object
Project identifier
Canvas action node UUID
True when the node runs its own code rather than a prebuilt action
Action name
Action description
Action source language
Where the action executes: a server sandbox (node, python) or the browser runtime (browser), which a host can also run live
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
Cost per execution in USD
True when the node is locked and cannot be run or edited
Action input slots
object
Action input or output name
Action input or output media type
Deprecated alias for multiple: true. Mirrors multiple for back-compat.
Whether the slot allows zero connections in single-input mode. Ignored when multiple is the object form (use min: 0 there instead).
Action output slots
object
Action input or output name
Action input or output media type
Deprecated alias for multiple: true. Mirrors multiple for back-compat.
Whether the slot allows zero connections in single-input mode. Ignored when multiple is the object form (use min: 0 there instead).
Action parameters (snake_case keys)
object
Action parameter key
Action parameter control type
Action parameter label
Action parameter description
Default parameter value
Allowed parameter values
object
Lowest accepted number
Highest accepted number
Step between accepted numbers
Placeholder shown in an empty text control
For colorList controls: how many colors the value may hold
Conditions under which a control is shown, all of which must hold. Keys are the snake_case keys of this same params list.
Per-axis minimum for point2d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Per-axis maximum for point2d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Per-axis step for point2d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Per-axis minimum for point3d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Per-axis maximum for point3d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Per-axis step for point3d values
object
Bound on the x axis
Bound on the y axis
Bound on the z axis (point3d only)
Parameter values stored on the node, keyed like params[].key; defaults apply for missing keys
object
Nodes wired into this action, in edge order
Project canvas URL
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" } ]}