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

# Overview

## What is a Workflow?

A Workflow is a named template that chains multiple Flows into a sequence of steps. Workflows are used by the Activity feature — when an Activity is created from a Workflow, MileApp creates one parent task (`taskType = activityMaster`) plus one child task (`taskType = activityChild`) per Workflow step.

Each Workflow step references a Flow and can optionally define:

* An **assignee** that becomes the default user for tasks created at that step.
* A **status mapping** that maps the step's task to a status label (such as the Workflow's custom statuses).
* **Field mappings** that copy field values from earlier steps' completed tasks into the current step's new task (step 2 and later), or set manual default values (step 1).

To see the details of the Workflow object, please follow [this link](/api-reference/objects/workflow-object).

## Endpoints

| Method | Path                                                       | Description                                                          |
| ------ | ---------------------------------------------------------- | -------------------------------------------------------------------- |
| GET    | `/internal/workflows`                                      | List Workflows in your organization.                                 |
| POST   | `/internal/workflows`                                      | Create a new Workflow template.                                      |
| GET    | `/internal/workflows/search`                               | Search Workflows by name or step Flow name.                          |
| GET    | `/workflow/{id}`                                           | Get a single Workflow by ID.                                         |
| PUT    | `/workflow/{id}`                                           | Update an existing Workflow's name, steps, or custom statuses.       |
| DELETE | `/workflow/{id}`                                           | Delete a Workflow (rejected if there are Activities still using it). |
| GET    | `/workflow/{id}/steps/{stepOrder}/field-mapping-data`      | Get the fields available for mapping at a specific step.             |
| POST   | `/workflow/{id}/steps/{stepOrder}/validate-field-mappings` | Validate a step's field mapping configuration before saving.         |

## Constraints

* Workflow name must be **unique within your organization** and **between 2 and 100 characters**.
* A Workflow can have **between 1 and 10 steps**.
* Each step must reference a **different Flow** — no duplicate `flowId` within the same Workflow.
* Step **count cannot change** after the Workflow is created — updates that change the number of steps are rejected with HTTP 400.
* A Workflow **cannot be deleted** while there are Activity tasks still referencing it.

## Related

* [Workflow object](/api-reference/objects/workflow-object)
* [Activity overview](/api-reference/activity/overview)
* [Introduction to Workflow](/pages/workflow/introduction-to-workflow)
* [Building Workflow](/pages/workflow/building-workflow)
* [Managing Workflow](/pages/workflow/managing-workflow)
