# Actions

## Create a canvas action

`client.projects.actions.create(stringprojectID, ActionCreateParamsbody, RequestOptionsoptions?): ActionCreateResponse`

**post** `/projects/{projectId}/actions`

Creates a prebuilt action node on a project canvas using a raw action slug.

### Parameters

- `projectID: string`

  Project identifier

- `body: ActionCreateParams`

  - `action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more`

    Action identifier

    - `"split-text"`

    - `"find-and-replace-text"`

    - `"concat-text"`

    - `"ken-burns-video"`

    - `"color-grade-image"`

    - `"change-image-ar"`

    - `"rotate-image"`

    - `"flip-image"`

    - `"color-filter-image"`

    - `"color-tint-image"`

    - `"filter-color-image"`

    - `"blur-image"`

    - `"duplicate-image"`

    - `"side-by-side-composite"`

    - `"add-shape-to-image"`

    - `"generate-shape-image"`

    - `"add-text-to-image"`

    - `"generate-text-image"`

    - `"qr-code-generator"`

    - `"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"`

  - `params?: Record<string, unknown>`

    Action parameters

### Returns

- `ActionCreateResponse`

  - `action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more`

    Action identifier

    - `"split-text"`

    - `"find-and-replace-text"`

    - `"concat-text"`

    - `"ken-burns-video"`

    - `"color-grade-image"`

    - `"change-image-ar"`

    - `"rotate-image"`

    - `"flip-image"`

    - `"color-filter-image"`

    - `"color-tint-image"`

    - `"filter-color-image"`

    - `"blur-image"`

    - `"duplicate-image"`

    - `"side-by-side-composite"`

    - `"add-shape-to-image"`

    - `"generate-shape-image"`

    - `"add-text-to-image"`

    - `"generate-text-image"`

    - `"qr-code-generator"`

    - `"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"`

  - `canvas_url: string`

    Project canvas URL

  - `node_id: string`

    Canvas action node identifier

  - `project_id: string`

    Project identifier

### Example

```typescript
import FLORA from '@flora-ai/flora';

const client = new FLORA({
  apiKey: process.env['FLORA_API_KEY'], // This is the default and can be omitted
});

const action = await client.projects.actions.create('prj_abc123', { action_id: 'split-text' });

console.log(action.action_id);
```

#### Response

```json
{
  "action_id": "split-text",
  "canvas_url": "https://example.com",
  "node_id": "node_abc123",
  "project_id": "prj_abc123"
}
```

## Run a canvas action

`client.projects.actions.run(stringnodeID, ActionRunParamsparams, RequestOptionsoptions?): ActionRunResponse`

**post** `/projects/{projectId}/actions/{nodeId}/run`

Runs an existing canvas action node through the action execution workflow.

### Parameters

- `nodeID: string`

  Canvas action node identifier

- `params: ActionRunParams`

  - `projectId: string`

    Project identifier

### Returns

- `ActionRunResponse`

  - `charged_cost: number`

    Cost charged in USD

  - `estimated_seconds: number | null`

  - `run_id: string`

    Run identifier

  - `type: "generation" | "technique" | "action"`

    Run type

    - `"generation"`

    - `"technique"`

    - `"action"`

  - `action?: Action | null`

    - `action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more`

      Action identifier

      - `"split-text"`

      - `"find-and-replace-text"`

      - `"concat-text"`

      - `"ken-burns-video"`

      - `"color-grade-image"`

      - `"change-image-ar"`

      - `"rotate-image"`

      - `"flip-image"`

      - `"color-filter-image"`

      - `"color-tint-image"`

      - `"filter-color-image"`

      - `"blur-image"`

      - `"duplicate-image"`

      - `"side-by-side-composite"`

      - `"add-shape-to-image"`

      - `"generate-shape-image"`

      - `"add-text-to-image"`

      - `"generate-text-image"`

      - `"qr-code-generator"`

      - `"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"`

  - `model?: Model | null`

    - `model_id: string`

      Model identifier

  - `poll_url?: string | null`

    URL to poll pending/running runs or fetch completed/failed run details.

  - `project_id?: string | null`

    Project identifier

  - `technique?: Technique | null`

    - `name: string`

      Technique name

    - `technique_id: string`

      Technique identifier

### Example

```typescript
import FLORA from '@flora-ai/flora';

const client = new FLORA({
  apiKey: process.env['FLORA_API_KEY'], // This is the default and can be omitted
});

const response = await client.projects.actions.run('nodeId', { projectId: 'prj_abc123' });

console.log(response.run_id);
```

#### Response

```json
{
  "charged_cost": 0,
  "estimated_seconds": 0,
  "run_id": "run_abc123",
  "type": "generation",
  "action": {
    "action_id": "split-text"
  },
  "model": {
    "model_id": "t2i-flux-2-pro"
  },
  "poll_url": "https://example.com",
  "project_id": "prj_abc123",
  "technique": {
    "name": "name",
    "technique_id": "tech_abcd1234"
  }
}
```

## Domain Types

### Action Create Response

- `ActionCreateResponse`

  - `action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more`

    Action identifier

    - `"split-text"`

    - `"find-and-replace-text"`

    - `"concat-text"`

    - `"ken-burns-video"`

    - `"color-grade-image"`

    - `"change-image-ar"`

    - `"rotate-image"`

    - `"flip-image"`

    - `"color-filter-image"`

    - `"color-tint-image"`

    - `"filter-color-image"`

    - `"blur-image"`

    - `"duplicate-image"`

    - `"side-by-side-composite"`

    - `"add-shape-to-image"`

    - `"generate-shape-image"`

    - `"add-text-to-image"`

    - `"generate-text-image"`

    - `"qr-code-generator"`

    - `"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"`

  - `canvas_url: string`

    Project canvas URL

  - `node_id: string`

    Canvas action node identifier

  - `project_id: string`

    Project identifier

### Action Run Response

- `ActionRunResponse`

  - `charged_cost: number`

    Cost charged in USD

  - `estimated_seconds: number | null`

  - `run_id: string`

    Run identifier

  - `type: "generation" | "technique" | "action"`

    Run type

    - `"generation"`

    - `"technique"`

    - `"action"`

  - `action?: Action | null`

    - `action_id: "split-text" | "find-and-replace-text" | "concat-text" | 34 more`

      Action identifier

      - `"split-text"`

      - `"find-and-replace-text"`

      - `"concat-text"`

      - `"ken-burns-video"`

      - `"color-grade-image"`

      - `"change-image-ar"`

      - `"rotate-image"`

      - `"flip-image"`

      - `"color-filter-image"`

      - `"color-tint-image"`

      - `"filter-color-image"`

      - `"blur-image"`

      - `"duplicate-image"`

      - `"side-by-side-composite"`

      - `"add-shape-to-image"`

      - `"generate-shape-image"`

      - `"add-text-to-image"`

      - `"generate-text-image"`

      - `"qr-code-generator"`

      - `"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"`

  - `model?: Model | null`

    - `model_id: string`

      Model identifier

  - `poll_url?: string | null`

    URL to poll pending/running runs or fetch completed/failed run details.

  - `project_id?: string | null`

    Project identifier

  - `technique?: Technique | null`

    - `name: string`

      Technique name

    - `technique_id: string`

      Technique identifier
