Canvas

Create a canvas action

Changed on

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/projects/{projectId}/actions

Request

  • Base URL
    https://app.flora.ai/api/v1
  • URL
    https://app.flora.ai/api/v1/projects/{projectId}/actions
  • Auth
    HTTP bearer

Path parameters

projectIdstring required

Project identifier

Example:prj_abc123

Request body

action_id'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'

Prebuilt action identifier. Required unless code is given.

codestring

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.

language'javascript' | 'python'

Language of code. Required with code; ignored with action_id.

runtime'node' | 'python' | 'browser'

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.

labelstring

Node label on the canvas. Defaults to the action's declared name.

paramsobject

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.

Example request

{
  "action_id": "color-grade-image-browser"
}

Response

Canvas action created.

project_idstring required

Project identifier

node_idstring required

Canvas action node identifier

action_id'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' nullable required

Action identifier

canvas_urlstring uri required

Project canvas URL

Example response

{
  "project_id": "prj_abc123",
  "node_id": "node_abc123",
  "action_id": "color-grade-image-browser"
}

Changes

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • warning

      added the new not_configured enum value to the / response property for the response status

    • breaking

      removed the enum value add-shape-to-image of the request property

    • breaking

      removed the enum value add-text-to-image of the request property

    • breaking

      removed the enum value blur-image of the request property

    • breaking

      removed the enum value change-image-ar of the request property

    • breaking

      removed the enum value color-filter-image of the request property

    • breaking

      removed the enum value color-grade-image of the request property

    • breaking

      removed the enum value color-tint-image of the request property

    • breaking

      removed the enum value concat-text of the request property

    • breaking

      removed the enum value duplicate-image of the request property

    • breaking

      removed the enum value filter-color-image of the request property

    • breaking

      removed the enum value find-and-replace-text of the request property

    • breaking

      removed the enum value flip-image of the request property

    • breaking

      removed the enum value generate-shape-image of the request property

    • breaking

      removed the enum value generate-text-image of the request property

    • breaking

      removed the enum value qr-code-generator of the request property

    • breaking

      removed the enum value rotate-image of the request property

    • breaking

      removed the enum value side-by-side-composite of the request property

    • breaking

      removed the enum value split-text of the request property

    • breaking

      response property action_id list-of-types was widened by adding types null to media type application/json of response 201

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new paid_plan_required enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new revision_conflict enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • warning

      added the new temporarily_unavailable enum value to the / response property for the response status

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      request body became optional

    • info

      the request property became optional

    • info

      added the new add-shape-to-image-browser enum value to the request property

    • info

      added the new add-text-to-image-browser enum value to the request property

    • info

      added the new blur-image-browser enum value to the request property

    • info

      added the new change-image-ar-browser enum value to the request property

    • info

      added the new color-filter-image-browser enum value to the request property

    • info

      added the new color-grade-image-browser enum value to the request property

    • info

      added the new color-tint-image-browser enum value to the request property

    • info

      added the new concat-text-browser enum value to the request property

    • info

      added the new crop-image-browser enum value to the request property

    • info

      added the new draw-image-browser enum value to the request property

    • info

      added the new duplicate-image-browser enum value to the request property

    • info

      added the new filter-color-image-browser enum value to the request property

    • info

      added the new find-and-replace-text-browser enum value to the request property

    • info

      added the new magic-eraser-image-browser enum value to the request property

    • info

      added the new overlay-image-browser enum value to the request property

    • info

      added the new pixel-remover-image-browser enum value to the request property

    • info

      added the new qr-code-generator-browser enum value to the request property

    • info

      added the new resize-image-browser enum value to the request property

    • info

      added the new rotate-image-browser enum value to the request property

    • info

      added the new scene-3d-image-browser enum value to the request property

    • info

      added the new shader-effect-browser enum value to the request property

    • info

      added the new side-by-side-composite-browser enum value to the request property

    • info

      added the new split-text-browser enum value to the request property

    • info

      added the non-success response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      removed the add-shape-to-image enum value from the response property for the response status

    • info

      removed the add-text-to-image enum value from the response property for the response status

    • info

      removed the blur-image enum value from the response property for the response status

    • info

      removed the boomerang-video enum value from the response property for the response status

    • info

      removed the change-image-ar enum value from the response property for the response status

    • info

      removed the change-video-ar enum value from the response property for the response status

    • info

      removed the color-filter-image enum value from the response property for the response status

    • info

      removed the color-filter-video enum value from the response property for the response status

    • info

      removed the color-grade-image enum value from the response property for the response status

    • info

      removed the color-grade-video enum value from the response property for the response status

    • info

      removed the color-tint-image enum value from the response property for the response status

    • info

      removed the concat-text enum value from the response property for the response status

    • info

      removed the duplicate-image enum value from the response property for the response status

    • info

      removed the duplicate-video enum value from the response property for the response status

    • info

      removed the extract-video-frames enum value from the response property for the response status

    • info

      removed the filter-color-image enum value from the response property for the response status

    • info

      removed the find-and-replace-text enum value from the response property for the response status

    • info

      removed the flip-image enum value from the response property for the response status

    • info

      removed the generate-shape-image enum value from the response property for the response status

    • info

      removed the generate-text-image enum value from the response property for the response status

    • info

      removed the greenscreen-video enum value from the response property for the response status

    • info

      removed the ken-burns-video enum value from the response property for the response status

    • info

      removed the merge-audio-into-video enum value from the response property for the response status

    • info

      removed the qr-code-generator enum value from the response property for the response status

    • info

      removed the resize-video enum value from the response property for the response status

    • info

      removed the reverse-video enum value from the response property for the response status

    • info

      removed the rotate-image enum value from the response property for the response status

    • info

      removed the side-by-side-composite enum value from the response property for the response status

    • info

      removed the slow-down-video enum value from the response property for the response status

    • info

      removed the speed-up-video enum value from the response property for the response status

    • info

      removed the split-audio-from-video enum value from the response property for the response status

    • info

      removed the split-text enum value from the response property for the response status

    • info

      removed the split-video enum value from the response property for the response status

    • info

      removed the stitch-videos enum value from the response property for the response status

    • info

      removed the video-effect enum value from the response property for the response status

    • info

      removed the video-to-frame-grid enum value from the response property for the response status

    • info

      removed the video-to-long-exposure enum value from the response property for the response status