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

# Flows

A *flow* is a reusable block of logic that can be run from [apps](/reference/apps.md) and other flows, exposed as an [API Endpoint](/reference/flows/api-endpoints.md) for external systems to call, or run automatically on a [schedule](/reference/flows/schedules.md). Flows encapsulate integrations and business logic once and let you reuse them across your apps and solutions without rebuilding them each time.

Flows can be thought of as functions at the solution level: they accept inputs, run logic, and return results. A single flow can be invoked from many places, so any change made to the flow propagates everywhere it is used.

A flow can be used to:

* Encapsulate an integration with an external system, such as Brønnøysund, Google Drive, or Visma, so that the same integration logic is shared across your solution.
* Implement shared business logic, such as a customer lookup or a status transition, that would otherwise be duplicated per app.
* Receive requests from external systems, such as webhook callbacks or API calls, via API Endpoints.
* Run unattended work on a schedule, such as a nightly data sync or a periodic cleanup.

{% hint style="info" %}
**Server-side execution**\
Flows run on the server. This makes them well-suited for integrations, data aggregations, and any logic that should not run in the browser.
{% endhint %}

{% hint style="info" %}
**Flows and schemas**\
Flows often send and receive data that does not need to be persisted. To support this, flows are paired with [schemas](/reference/platform-concepts/schemas.md), a way to describe external data structures. Schema data can be used directly as input and output in actions without first being modelled as an object class.
{% endhint %}

### Actions

A flow consists of one or more [actions](/reference/actions.md). An action is the unit of logic within a flow and works in much the same way as an action in an app or service - it is composed of [action nodes](/library/action-nodes.md) that run in sequence.

### Available action nodes

Flows currently support a subset of the platform's action nodes. Action nodes that are specific to apps, such as navigation nodes, are not available in flows.

The following action nodes are available in flows:

**Data:** [Create Object](/library/action-nodes/create-object.md), [Read Objects](/library/action-nodes/read-objects.md), [Update Object](/library/action-nodes/update-object.md), [Delete Objects](/library/action-nodes/delete-objects.md), [Persist Objects](/library/action-nodes/persist-objects.md), [Set Selection](/library/action-nodes/set-selection.md)

**Logic:** [While](/library/action-nodes/while.md), [Foreach](/library/action-nodes/foreach.md), [Next Iteration](/library/action-nodes/next-iteration.md), [Exit Loop](/library/action-nodes/exit-loop.md), [Exit Block](/library/action-nodes/exit-block.md), [If](/library/action-nodes/if.md), [Block](/library/action-nodes/block.md), [Catch Exception](/library/action-nodes/catch-exception.md), [Throw Exception](/library/action-nodes/throw-exception.md), [End Execution](/library/action-nodes/end-execution.md), [Sleep](/library/action-nodes/sleep.md)

**Other:** [Run Action](/library/action-nodes/run-action.md), [Run Flow](/library/action-nodes/run-flow.md), [Web Request](/library/action-nodes/web-request.md), [Send Email](/library/action-nodes/send-email.md), [Send SMS](/library/action-nodes/send-sms.md), Create Shortlink, [Update Secret](/library/action-nodes/update-secret.md)

**Debug:** [Log to Console](/library/action-nodes/log-to-console.md)

### Inputs and outputs

An action inside a flow defines the data it accepts as inputs and the data it returns. Inputs are passed when the flow is called, and outputs are returned to the caller once the flow completes.

**Inputs.** Flow inputs are defined using [action params](/reference/actions/action-params.md). Action params on flows can be simple data types, [enumerated types](/reference/data-model/enumerated-types.md), [object class references](/reference/data-model/object-classes.md) and [schemas](/reference/platform-concepts/schemas.md), the latter allowing structured data to be passed into a flow without first modelling it as an object class.

**Outputs.** A Flow returns output through two mechanisms:

* [**Action Variables**](/reference/actions/action-variables.md) hold simple data types, schemas, or references to enumerated types or object classes.
* [**Action data sources**](/reference/actions/action-data-sources.md) hold collections, similar to [runtime-only data sources](/reference/apps/data/data-sources.md) in apps, but scoped to the action rather than the app.

A flow can return any number of action variables and action data sources as part of its output. Once the flow completes, they are available to the calling action in the same way any action variable or data source would be.

### Triggers

A Flow action can be invoked in three ways. The available triggers for a Flow action are listed in the **Triggers** section at the top of the Flow action editor, and a Flow action can have any number of them.

**Run Flow/Run Action.** Flows are called from an action using the **Run Flow** or **Run Action** action node. Input values are mapped from the calling context — data sources, app variables, or function results — into the Flow's input parameters. Once the Flow completes, its output Action Data are available to subsequent action nodes in the calling action. Flows can be called from actions in apps and from actions in other Flows. Each calling action appears as a reference under the Flow action's Triggers section.

**Schedules.** A schedule runs the Flow action automatically on a cron expression. Schedules are configured per Flow action. See [Schedules](/reference/flows/schedules.md).

**API Endpoints.** A Flow action can be exposed as an HTTP endpoint that external systems can call. This allows a Flow to receive data from third-party integrations, respond to webhook callbacks, or serve as an API for external applications. See [API Endpoints](/reference/flows/api-endpoints.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appfarm.io/reference/flows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
