> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a PowerFlow


PowerFlows consist of a set of functional **blocks** that are connected together, enabling you to create step-by-step actions for execution. Each block performs a specific function. By combining different blocks, you can develop a customized application to address your media use case effectively. 

Blocks are grouped into different **categories** such as Triggers, Flow Logic, and Developer Tools, to make them more accessible. For more in-depth information on each block, refer to the [PowerFlow block reference](mediaflows_block_reference).

![Blocks connected together](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/connected-blocks-simple "thumb:c_scale,w_800,dpr_2.0, width: 800, popup:true")

## Create a new PowerFlow

From the [Home](https://console.cloudinary.com/mediaflows/home) page, you can select one of the given flow starting templates, or you can create your own flow from scratch by clicking **New PowerFlow**.

You can also try using the natural-language interface to create a new flow. Enter your prompt in the dialog box at the top of the page.

![Create flow](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/create-a-new-powerflow.png "thumb:c_scale,w_800,dpr_2.0, width: 800, popup:true")

## The canvas

The canvas is your visual development environment. It allows you to view, edit, test, debug, and deploy your application.

From the **Navigation Bar** on the left you can add blocks and view logs.  Live logs open in a sidebar on the right.

![Canvas](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/sidebar-logs-canvas "thumb:c_scale,w_800,dpr_2.0, width: 800, popup:true")

## Changing the trigger

When you create a PowerFlow from scratch, you must choose a trigger before the flow is created. This ensures your flow has a defined starting point from the beginning.

If you need to change the trigger after creating a flow, hover over the trigger block and click the **Change trigger** option that appears.

![Trigger block options on hover](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/rn_change_trigger "thumb:c_scale,w_300,dpr_2.0, width: 300, popup:true")

## Adding blocks

To add blocks:

1. From the **Navigation Bar** on the left, click **Blocks** to open the **Select a block** dialog.
2. Select the block you want to use. It will be automatically connected to the last block in your flow.

![The select a block dialog](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/select-a-block "thumb:c_scale,w_500,dpr_2.0, width: 500, popup:true")

> **TIP**: There's a search field at the top of the dialog that you can use to search for a particular block. 

You can also add blocks by clicking a connection node on an existing block. This opens the same **Select a block** dialog and automatically connects the selected block to this node.

![Add a block by clicking a connection node on an existing block](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/add-block-to-node "thumb:c_scale,w_500,dpr_2.0, width: 500, popup:true")

## Disconnecting blocks

You can disconnect blocks by hovering over the line joining the blocks and then clicking on the little **x** that appears.

![Disconnect blocks](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/disconnecting-two-blocks "thumb:c_scale,w_500,dpr_2.0, width: 500, popup:true")

You can remove blocks from the canvas by clicking the **Delete** icon that appears when you hover over a block.

![Remove blocks](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/remove-block "thumb:c_scale,w_300,dpr_2.0, width: 300, popup:true")

## Reconnecting blocks

Reconnect blocks by selecting one output node and dragging it to the input node of the next block.

![Reconnect blocks](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/reconnect-blocks "thumb:c_scale,w_700,dpr_2.0, width: 700, popup:true")

A block can be connected to multiple blocks. In the example below, once the **Manual Moderation** block executes successfully, both the **Move To Folder** and **Send Email Using SendGrid** blocks are executed in parallel.

![Connect multiple blocks to an output](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/parallel-connection "thumb:c_scale,w_700,dpr_2.0, width: 700, popup:true")

> **READING**: : :title=See also

[Error paths](#error_paths) - Add error handling paths to blocks for graceful failure handling.

## Configuring a block

Click a block to open its configuration sidebar where you can configure all the input fields for the block.

![Configuring a block](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/configure-metadata-block-example "thumb:c_scale,w_400,dpr_2.0, width: 400, popup:true")

> **TIP**: To make your flows easier to understand, you can edit the display name of a block.

### Inserting variables

You can set a block's input field using a fixed value or a variable. A variable can be an [environment variable](mediaflows_powerflows#environment_variables), a [flow variable](mediaflows_powerflows#flow_variables), a [flow secret](mediaflows_powerflows#flow_secrets), or a response value from a previous block in the flow.

In the example below, the **Metadata key** field is a fixed value while the **Metadata value** field gets its value from the response of the **On Asset Upload** trigger block.

![Insert a variable](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/insert-variable-config "thumb:c_scale,w_400,dpr_2.0, width: 400, popup:true")

**To set an input field with a variable:**

1. Click the `+` button in an input field to find a variable.
      ![Select a variable](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/search-for-a-variable-config "thumb:c_scale,w_300,dpr_2.0, width: 300, popup:true") 
2. Either search for the variable, or navigate the blocks and variable types to select the variable you want to use. The list of suggested block variables isn't comprehensive and only displays some of the more popular response values. If the response value you want doesn't appear in the list, you can add a variable manually.
      ![Select a variable](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/custom-variable-colorspace-config "thumb:c_scale,w_300,dpr_2.0, width: 300, popup:true") 

> **NOTE**: To access nested response values, use dot notation, e.g. `metadata.status`.

## Testing a flow

You can trigger a flow programmatically based on its trigger block. Additionally, you can manually trigger a flow directly from within the canvas in order to test it. This is extremely helpful while building or debugging a flow.

To manually trigger the flow, click the **Test** button above the canvas.

![Test a flow](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/enable-disable-deploy.png "thumb:c_scale,w_800,dpr_2.0, width: 400, popup:true")

You can configure the trigger by clicking on the three dots in the **Test** button. For each type of trigger you'll see the available configuration settings (if any).

Customize the trigger for your flow.

![Setting flow secrets](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/flow-settings-test-config-upload.png "thumb:c_scale,w_600,dpr_2.0, width: 600, popup:true")

## Logs

Once a flow is executed, you can view the logs of the execution in the Logs sidebar:

1. From the **Navigation Bar** on the left, open the **Logs** sidebar. All executions will appear in the sidebar, including their execution time and status.
2. Click an execution to see the blocks that were executed.
3. Click any block to see the output of the block in that execution. 

> **TIP**: A red dot will appear next to the Execution Logs button on the Navigation Bar to indicate that a flow was executed while the sidebar was closed. Click the button to open the sidebar and see the new execution.

You can also review all past executions by clicking on the History logs icon at the top of the Logs sidebar.

## Error notifications

For each flow you build, you can request the flow to send a notification to a URL if an error occurs. 

To set up an error notification, in the canvas, click the drop-down on the right side of your Flow name and click the **Error Notification** option (you can also find this option in the (3-dots) menu for the flow in the [Flows](https://console.cloudinary.com/mediaflows/list) page).

![The error notification option in the kebab menu](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/more-flow-options "thumb:c_scale,w_150,dpr_2.0, width: 150, popup:true")

The **Error Notification Manager** form opens, where you can set the URL address to send the HTTP request to, and any request headers required.

The notification includes fields such as `flow_name`, `flow_external_id`, `block_name` and `block_error` to help you to track down the error and quickly resolve the issue.

Errors fall into three categories:

* **Runtime errors**: For example, when specifying a non-existent variable for a block. The flow will crash at runtime and will throw an error.
* **Timeout errors**: A flow times out when it runs for more than five minutes. This may happen, for example, if you have multiple HTTP requests to slow services.
* **General errors**: For example, an HTTP request can run into a 500/401 error and fail, which in turn causes the flow to fail with a general error.

Setting up error notifications for your flows is a critical best practice that ensures you're alerted immediately when a flow fails to complete. This is especially important for production environments and large-scale automations where silent failures could lead to:

* **Missed business-critical operations**: Such as failed product uploads, unprocessed orders, or incomplete data synchronizations
* **Data inconsistencies**: When only part of a multi-step process completes successfully
* **Difficult troubleshooting**: The longer an error goes unnoticed, the harder it becomes to identify the root cause and assess its impact

By configuring error notifications, you can respond quickly to issues, minimize downtime, and maintain the reliability of your automated workflows.

> **TIP**: For more granular error handling within your flow, you can also configure [error paths](#error_paths) on individual blocks to handle recoverable errors without stopping the entire flow.

## Error paths

In addition to flow-level [error notifications](#error_notifications), you can add error paths to individual blocks to handle recoverable errors within your flow.

When a block with an error path encounters a recoverable error (for example, a 400 error response from an API call), the flow continues along the error path instead of stopping. This enables you to handle errors gracefully by logging them, sending notifications, or taking alternative actions.

If a block encounters an unrecoverable error (for example, the block can't resolve an input variable), the flow stops completely, regardless of whether an error path is configured. 

To be notified of unrecoverable errors, configure [error notifications](#error_notifications) at the flow level.

Error paths are available for all blocks except Triggers and Flow Logic blocks.

**To add an error path:**

1. Select the error path icon (tooltip: **Add error path**) on the block you want to add error handling to.
2. A red error output appears on the block. You can then connect it to the block(s) you want to execute when an error occurs by dragging from the error output to the target block's input.

**To remove an error path:**

1. Select the same error path icon (tooltip: **Remove error path**).

> **TIP**:
>
> Use error paths together with the **Add To Logs** block to capture and record error details for debugging purposes.

## Enable and disable PowerFlows

In the [Flows](https://console.cloudinary.com/mediaflows/list) page you'll see an indication of which of your flows are enabled or disabled under the **Status** column.

![Flows listed in the flows page](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/active-indications-triggers.png "thumb:c_scale,w_800,dpr_2.0, width: 800, popup:true")

To enable a flow, open the flow  and click the **Enable Flow** button at the top right of the canvas: 

![Enable a flow](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/enable-flow-in-canvas.png "thumb:c_scale,w_400,dpr_2.0, width: 400, popup:true")

Enabling a flow also sets any necessary webhooks for the flow. You can see the webhooks that are set for your product environment in the [Webhook Notifications](https://console.cloudinary.com/app/settings/webhooks) settings page.

If you accidentally delete a webhook that's set for an active flow, you'll need to go back and fix the flow, which will create a new webhook. Simply click the **Fix Flow** button:

![Fix a flow](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/fix-flow-in-canvas.png "thumb:c_scale,w_400,dpr_2.0, width: 400, popup:true")

To disable a flow, click the **Disable Flow** button:

![Enable and disable flows](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/disable-flow-in-canvas.png "thumb:c_scale,w_400,dpr_2.0, width: 400, popup:true")

## Share a flow

You can share flows with colleagues in different accounts, allowing them to reuse or extend your workflow. You can also use sharing to copy flows between different product environments within your own account. This is useful when you want to promote a flow from development to production, or replicate it across different environments.

Changes made to the imported flow don't impact the originally shared flow.

To share a flow, in the canvas, click the drop-down menu on the right side of your flow name and click the **Share** option (you can also find this option in the (3-dots) menu for the flow in the [Flows](https://console.cloudinary.com/mediaflows/list) page).

![The share option in the kebab menu](https://cloudinary-res.cloudinary.com/image/upload/bo_1px_solid_gray/f_auto/q_auto/docs/mediaflows/more-flow-options "thumb:c_scale,w_150,dpr_2.0, width: 150, popup:true")

The shareable URL is copied to your clipboard, ready for you to send to a colleague, which they can then use to [import the flow](#import_a_flow) into their environment.

> **INFO**:
>
> For security reasons, the link is valid only for 14 days. If you need to share the flow after this time, click the **Share** option again to generate a new link.

## Import a flow

To import a flow, enter the shared URL in your browser, select the product environment into which you want to import this flow, and click the **Try This Flow** button.

