> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/examples-how-to/reusable-flows-subflows.md).

# Reusable Flows - SubFlows

Many a times we need a common business logic to be implemented in multiple APIs and places, and we do not want to build this common logic from scratch every single time.

That's where [SubFlows](/resources/subflows.md) come into the picture, allowing you to define your custom common logic **just once** and then reuse it in multiple APIs or other SubFlows (just like a reusable function).

## Building SubFlows

You can build SubFlows in Cosmocloud, which accepts multiple **arguments** and can return a single **JSON** object - you can use different keys in the JSON object to return multiple objects at once.

{% hint style="info" %}
Checkout how to [create SubFlows here](/resources/subflows.md).
{% endhint %}

## Using [Execute SubFlow](/flow-builder/node-types/external-nodes/execute-subflow.md) Node

You can then use the `Execute SubFlow` node in Cosmocloud's Flow Builder, to call any created SubFlow in the system. You can also pass your arguments to this SubFlow call, as mentioned in the SubFlow documentation.

{% hint style="info" %}
Checkout how to use [Execute SubFlow node](/resources/subflows.md#how-to-use-subflow).
{% endhint %}
