> For the complete documentation index, see [llms.txt](https://docs.uncodie.com/1.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uncodie.com/1.0/agentbase/api/flow.md).

# Flow

A flow is a process with a sequence of agents and functions

## Overview

A flow consists of actions that are either a Function or an Agent, arranged in a specific sequence.

## Usage

After a flow is created on `/base`, you can call the flow with `/flow/flow-name`

<mark style="color:green;">`POST`</mark> `/flow`

The return, data, logs and code of the function can be passed around through different agents trough the agent sequence you decide.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

<table><thead><tr><th width="218">Name</th><th width="94">Type</th><th width="100" data-type="checkbox">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>true</td><td>Name of the function</td></tr><tr><td><code>data</code></td><td>object</td><td>false</td><td>The data example or parameters for your function to work</td></tr><tr><td><code>version</code></td><td>number</td><td>false</td><td>The version of the function to execute</td></tr><tr><td><code>bearer_token</code></td><td>string</td><td>false</td><td>Auth0 user session token to validate and ACL to database</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "run_id": 1,
  "return": {
    "message" : "message example"
  },
  "error": null
}
```

{% endtab %}

{% tab title="400" %}

```
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

```json
//body example
{
    "name": "create_lead"
    "data" : {
        "email": "user@example.com"
        "subject": "subject example"
        "message": "message example"
    }
}
```
