For the complete documentation index, see llms.txt. This page is also available as Markdown.

Update a canvas action

Update a canvas action with the FLORA API: PATCH /projects/{projectId}/actions/{nodeId}.

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.

PATCH https://app.flora.ai/api/v1/projects/{projectId}/actions/{nodeId}
  • Auth: API key as a bearer token, Authorization: Bearer $FLORA_API_KEY. See Authentication.

  • TypeScript SDK: client.projects.actions.update().

  • Operation ID: updateCanvasAction.

Example

curl -X PATCH 'https://app.flora.ai/api/v1/projects/prj_abc123/actions/<nodeId>' \
  -H "Authorization: Bearer $FLORA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "code": "<code>"
}'
import { FloraClient } from '@flora-ai/flora';

const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });

const action = await client.projects.actions.update({
  projectId: 'prj_abc123',
  nodeId: '<nodeId>',
  code: '<code>',
});
console.log(action);

Path parameters

Name
Type
Required
Description

projectId

string

Yes

Project identifier. Pattern: ^prj_\S+$. Example: prj_abc123.

nodeId

string

Yes

Canvas action node identifier: the persisted short id (n7) or the node UUID. At least 1 character. Pattern: ^\S+$.

Request body

Optional.

Field
Type
Required
Description

code

string

No

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. At least 1 character.

language

string

No

Language of the replacement code; defaults to the node's current language. One of: javascript, python.

runtime

string

No

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. One of: node, python, browser.

label

string

No

New node label on the canvas. 1 to 120 characters.

params

object

No

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.

Responses

200: Canvas action updated.

Field
Type
Required
Description

project_id

string

Yes

Project identifier. Pattern: ^prj_\S+$. Example: prj_abc123.

node_id

string

Yes

Canvas action node UUID. At least 1 character. Example: 4d2f7c7e-1b1a-4c7f-9e1d-5b9d1f3b2c10.

short_id

string or null

Yes

Persisted short id (n7) of the node, when settled

action_id

string or null

Yes

Prebuilt action identifier, or null for a custom action created from code. One of: 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, and 2 more.

custom

boolean

Yes

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

name

string

Yes

Action name. Example: Poster palette.

description

string

Yes

Action description

language

string

Yes

Action source language. One of: javascript, python.

runtime

string

Yes

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

has_preview

boolean

Yes

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

code

string or null

Yes

The node's source: registry code for a prebuilt action, the saved snippet for a custom one. Null when the snippet could not be read.

tool_state

any or null

No

Interaction state the node's live preview last committed (JSON), replayed by its runs; null when none

charged_cost

number

Yes

Cost per execution in USD. At least 0.

locked

boolean

Yes

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

inputs

array of objects

Yes

Action input slots

inputs[].name

string

Yes

Action input or output name. Example: image.

inputs[].type

string

Yes

Action input or output media type. One of: image, video, text, audio, model3d.

inputs[].dynamic

boolean

No

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

inputs[].optional

boolean

No

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

inputs[].multiple

boolean or object

No

Many-connections form. true is unbounded shorthand; the object form sets explicit min/max bounds. See the inputs[].multiple shapes below.

outputs

array of objects

Yes

Action output slots

outputs[].name

string

Yes

Action input or output name. Example: image.

outputs[].type

string

Yes

Action input or output media type. One of: image, video, text, audio, model3d.

outputs[].dynamic

boolean

No

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

outputs[].optional

boolean

No

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

outputs[].multiple

boolean or object

No

Many-connections form. true is unbounded shorthand; the object form sets explicit min/max bounds. Same shape as inputs[].multiple.

params

array of objects

Yes

Action parameters (snake_case keys)

params[].key

string

Yes

Action parameter key. Example: angle.

params[].type

string

Yes

Action parameter control type. Example: select.

params[].label

string

No

Action parameter label. Example: Angle.

params[].info_tooltip

string

No

Action parameter description. Example: Rotation angle in degrees..

params[].default_value

any

No

Default parameter value

params[].available_values

array of objects

No

Allowed parameter values

params[].available_values[].value

string

Yes

params[].available_values[].label

string

Yes

params[].available_values[].description

string

No

params[].min_number_value

number

No

Lowest accepted number

params[].max_number_value

number

No

Highest accepted number

params[].number_step

number

No

Step between accepted numbers

params[].placeholder

string

No

Placeholder shown in an empty text control

params[].max_count

integer

No

For colorList controls: how many colors the value may hold. At least 0.

params[].visible_if

array of objects

No

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

params[].visible_if[].key

string

Yes

Key of the parameter this condition reads

params[].visible_if[].equals

string or number or boolean

No

Show this parameter only when the other parameter equals this value

params[].visible_if[].not_equals

string or number or boolean

No

Show this parameter only when the other parameter differs from this value

params[].point2d_min

object

No

Per-axis minimum for point2d values

params[].point2d_min.x

number

No

Bound on the x axis

params[].point2d_min.y

number

No

Bound on the y axis

params[].point2d_min.z

number

No

Bound on the z axis (point3d only)

params[].point2d_max

object

No

Per-axis maximum for point2d values

params[].point2d_max.x

number

No

Bound on the x axis

params[].point2d_max.y

number

No

Bound on the y axis

params[].point2d_max.z

number

No

Bound on the z axis (point3d only)

params[].point2d_step

object

No

Per-axis step for point2d values

params[].point2d_step.x

number

No

Bound on the x axis

params[].point2d_step.y

number

No

Bound on the y axis

params[].point2d_step.z

number

No

Bound on the z axis (point3d only)

params[].point3d_min

object

No

Per-axis minimum for point3d values

params[].point3d_min.x

number

No

Bound on the x axis

params[].point3d_min.y

number

No

Bound on the y axis

params[].point3d_min.z

number

No

Bound on the z axis (point3d only)

params[].point3d_max

object

No

Per-axis maximum for point3d values

params[].point3d_max.x

number

No

Bound on the x axis

params[].point3d_max.y

number

No

Bound on the y axis

params[].point3d_max.z

number

No

Bound on the z axis (point3d only)

params[].point3d_step

object

No

Per-axis step for point3d values

params[].point3d_step.x

number

No

Bound on the x axis

params[].point3d_step.y

number

No

Bound on the y axis

params[].point3d_step.z

number

No

Bound on the z axis (point3d only)

param_values

object

Yes

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

connected_inputs

array of objects

Yes

Nodes wired into this action, in edge order

connected_inputs[].node_id

string

Yes

Short id (n7) or UUID of the connected node. Example: n3.

connected_inputs[].label

string or null

Yes

Connected node label

connected_inputs[].type

string or null

Yes

Media type the connected node currently supplies, null until it has an output. One of: image, video, text, audio, model3d.

connected_inputs[].url

string or null

Yes

Current output URL of the connected node

connected_inputs[].text

string or null

Yes

Current text output of the connected node

canvas_url

string (uri)

Yes

Project canvas URL

inputs[].multiple shapes

Field paths in this block are relative to inputs[].multiple.

inputs[].multiple takes one of 2 shapes.

Shape 1: Boolean. Always true.

Shape 2: Object.

Field
Type
Required
Description

min

integer

No

At least 0.

max

integer

No

At least 0.

Errors

Every error has the same body: error.code, error.message, and error.fields on validation errors. See Errors for how to recover from each code.

Status
Code
Meaning

400

invalid_json, input_validation_error

The body isn't valid JSON, or an input failed validation (fields lists each one).

401

unauthorized, invalid_api_key

The API key is missing, invalid or revoked.

402

insufficient_credits

The workspace balance is too low for this request.

403

forbidden, paid_plan_required

The key can't do this, or the workspace plan doesn't include it.

404

not_found

The resource doesn't exist or isn't visible to this key.

409

idempotency_duplicate, revision_conflict

Duplicate Idempotency-Key or a stale base_revision.

429

rate_limited

Too many requests. Back off and retry.

500

unknown_error, internal_error

Something failed on FLORA's side. Retry with backoff.

503

temporarily_unavailable

Authorization is temporarily unavailable. Retry later.

Last updated

Was this helpful?