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

# Workflows

> Create, list, run, and manage workflows (agents) via the API

## What are workflows?

**Workflows** are the automations you build in Flowra: they combine an AI agent (which can chat and decide what to do) with **tools** (Slack, Gmail, your custom code, etc.) and optional **knowledge** (RAG). A workflow might be “customer support bot” or “summarize my emails and post to Slack”. You define the system prompt, pick the model and tools, and optionally attach knowledge collections. Then you **run** the workflow (manually or via a [trigger](/guides/triggers)) — it gets an input, the agent reasons and calls tools, and you get an output or a stream of messages.

In short: a **workflow** is the “recipe” (name, prompt, model, tools, connections); an **agent** is the AI that runs inside it. For the canonical distinction (`workflowType: static` vs `agent`), when to use each, and how runs differ, see [Workflows and agents](/guides/workflows-and-agents).

### Example use cases

* **Support bot** — Create a workflow with a friendly system prompt, Slack + knowledge base tools. Run it when a user sends a message; the agent answers using your docs and can create tickets or escalate.
* **Scheduled summary** — A trigger runs the workflow every morning; the workflow uses Gmail and Slack tools to summarize unread emails and post to a channel.
* **Run from your app** — Your backend calls `POST /workflow/manager/execute/{id}` with a payload; you get a thread ID, poll for status, and optionally resume if the workflow pauses for user input.

### How it works

* **Create / update** — Set name, system prompt, model (from [AI models](/guides/ai-models-and-llm)), tools, knowledge collections, and connection settings. You can do this in the [Dashboard](https://flowra.dev) chat or via the API.
* **Run** — `POST /workflow/manager/execute/{id}` starts a run. You get a **thread ID**; use it to poll status, get the result, or resume if the run is paused.
* **Executions** — List runs, get one run’s details (inputs, outputs, steps), cancel or resume. Useful for dashboards and debugging.

The API gives you full control: list workflows, create, update, delete, change active status, switch which [connected account](/guides/connected-accounts) is used for a toolkit, run, and inspect executions.

***

## API endpoints

### List workflows

**GET** `/api/v1/workflow/manager/list` returns a paginated list of your workflows with optional filters.

| Query parameter           | Description                     |
| ------------------------- | ------------------------------- |
| `page`, `limit`, `offset` | Pagination                      |
| `sortBy`, `sortOrder`     | Sort (e.g. `createdAt`, `DESC`) |
| `q`                       | Search by name                  |
| `activeStatus`            | Filter by active/inactive       |
| `cursor`                  | Cursor-based pagination         |

<CodeGroup>
  ```bash theme={null}
  curl -X GET "https://flowra.dev/api/v1/workflow/manager/list?limit=20" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

### Create workflow

**POST** `/api/v1/workflow/manager/create` creates a new workflow (agent) with name, tools, system prompt, and model. Request body: **CreateAgentDto** (see [API reference](/api-reference)). The workflow runs in your project’s workspace.

### Get workflow detail

**GET** `/api/v1/workflow/manager/detail/{id}` returns full configuration for one workflow: name, tools, prompt, model, and connection settings.

### Update and delete

* **PATCH** `/api/v1/workflow/manager/update/{id}` — Update name, tools, prompt, or model. Send only the fields you want to change.
* **DELETE** `/api/v1/workflow/manager/delete/{id}` — Permanently remove a workflow.
* **PATCH** `/api/v1/workflow/manager/activeStatus/{id}` — Turn a workflow on (active) or off (inactive). Inactive workflows cannot be run or triggered.
* **PATCH** `/api/v1/workflow/manager/change-connection/{id}` — Change which connected account (OAuth) is used for a toolkit in this workflow. Body: `{ "toolkitSlug": "...", "connectionId": "..." }`.

### Run a workflow

**POST** `/api/v1/workflow/manager/execute/{id}` starts a workflow run with an optional input payload. Request body: **TriggerWorkflowDto**. The response includes a **thread ID** you can use to poll status or resume if the workflow pauses.

### Executions

* **GET** `/api/v1/workflow/manager/executions` — List past runs of any workflow with filters (status, date, workflow ID) and pagination.
* **GET** `/api/v1/workflow/manager/executions/{id}` — Full details of one execution: inputs, outputs, steps, status.
* **GET** `/api/v1/workflow/manager/executions/thread/{threadId}/status` — Check if a run is in progress, completed, or failed.
* **POST** `/api/v1/workflow/manager/executions/thread/{threadId}/resume` — Resume a paused run (e.g. after user input). Body: **ResumeWorkflowExecutionDto**.
* **GET** `/api/v1/workflow/manager/{id}/executions` — List executions for one specific workflow.

## Related

* [Workflows and agents](/guides/workflows-and-agents) — Static vs agent concepts
* [Human in the loop](/guides/human-in-the-loop) — Pause and resume
* [Triggers](/guides/triggers) — Run workflows on a schedule or event
* [Connected accounts](/guides/connected-accounts) — OAuth connections used by workflows
* [Tools](/guides/tools) — Tools attached to workflows
* [Recipe: Run a workflow](/recipes/run-a-workflow)
* [API reference: workflow/manager](/api-reference) — Full request/response schemas
