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

Create a canvas action

Create a canvas action with the FLORA API: POST /projects/{projectId}/actions.

Creates an action node on a project canvas: a prebuilt action by slug (action_id), or a custom action from source (code + language). A custom action's inputs, outputs and parameters come from the annotations in its code; read them back with GET /projects/{projectId}/actions/{nodeId}.

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

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

  • Operation ID: createCanvasAction.

Example

curl -X POST 'https://app.flora.ai/api/v1/projects/prj_abc123/actions' \
  -H "Authorization: Bearer $FLORA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "action_id": "color-grade-image-browser"
}'
import { FloraClient } from '@flora-ai/flora';

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

const action = await client.projects.actions.create({
  projectId: 'prj_abc123',
  action_id: 'color-grade-image-browser',
});
console.log(action);

Path parameters

Name
Type
Required
Description

projectId

string

Yes

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

Request body

Optional.

Field
Type
Required
Description

action_id

string

No

Prebuilt action identifier. Required unless code is given. 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.

code

string

No

Source of a custom action, in place of action_id. Declare its contract in comment annotations the way prebuilt actions do: @flora-name, @flora-description, @flora-inputs (JSON array of {name, type}), @flora-outputs (required, same shape) and @flora-params (JSON array of {key, label, type, default, min, max, step, options, visibleIf}). Read a prebuilt action's code conventions from GET /actions/{actionId}. Requires the workspace plan to include custom actions. 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 code. Required with code; ignored with action_id. 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

Node label on the canvas. Defaults to the action's declared name. 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

201: Canvas action created.

Field
Type
Required
Description

project_id

string

Yes

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

node_id

string

Yes

Canvas action node identifier. At least 1 character. Example: node_abc123.

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.

canvas_url

string (uri)

Yes

Project canvas URL

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?