> For the complete documentation index, see [llms.txt](https://docs.fastn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastn.ai/tutorials-1/understanding-flow-types/how-to-set-up-an-activation-flow.md).

# How to Set Up an Activation Flow?

### Overview

The **Activation Flow** is a foundational template used to automate project or tenant activation. You can use it as-is for testing or customize it for your own setup. It’s available in the **Templates** section of your workspace.

This guide provides a conceptual overview of each step so you can understand the logic and modify it as needed.

### 1. Flow Initialization

The flow begins with a **Request step**, which acts as the entry point for the activation flow. This step captures the headers and the input payload that will be passed along to the subsequent steps.

<figure><img src="/files/EU95M7oMRakKdtg5M0CJ" alt=""><figcaption></figcaption></figure>

By default, this template is designed to start on a **new API request**, but you can configure the starting point differently depending on your use case.

{% hint style="info" %}
For more details, see [Flow Types – Choosing a Starting Point](/flow-setup-essentials.md#flow-types)
{% endhint %}

### 2. Initialize Your Flow Variables

The second step is a **Variable step** named **“initiate your flow variables.”**

This sets up key reusable values such as:

* **Project ID** – identifies which project or tenant the activation applies to.
* **Organization ID** – used to associate imported templates or configurations.
* **Template and Webhook objects** – used later in the loop steps for flow creation or validation.

<figure><img src="/files/HEavLwKbxFWMAr3Evd6U" alt=""><figcaption></figcaption></figure>

> By standardizing these variables early on, the rest of the flow can reference them consistently without redefining values.

### 3. Switch Step: *Tenant Exists?*

Before moving into template and webhook loops, the flow checks if the **tenant exists**.

<figure><img src="/files/gtFK8DH380oTEM29LEmK" alt=""><figcaption></figcaption></figure>

* **If the tenant does not exist →** return an **error message** response immediately.
* **If a tenant exists →** continue into the next stages (looping through templates and webhooks).

This ensures the flow only proceeds when a valid project/tenant is present.

### 4. Loop Over Templates

If your setup includes templates, the flow loops through each one to check whether a corresponding flow already exists.

<figure><img src="/files/rZswvsXUALoiQatgOCdP" alt=""><figcaption></figcaption></figure>

#### **Inside the loop**

* **Get API step** → checks if a flow already exists.

<figure><img src="/files/ML7WVjPohKRH8GfIbFj6" alt=""><figcaption></figcaption></figure>

* If it does not exist, the flow imports it using the defined project and template IDs.

<figure><img src="/files/akEGzAU0hTHZK2aihndP" alt=""><figcaption></figcaption></figure>

* This ensures that all required templates for the tenant are created and deployed.

> You can omit this section entirely if your activation doesn’t require template imports.

### 5. Loop Over Webhooks

Once templates are processed, the flow iterates through **webhooks**.

<figure><img src="/files/u2CmZ1e6YifXTTDZtPMO" alt=""><figcaption></figcaption></figure>

#### **Inside the loop**

* **Get Webhook step** → checks if the webhook exists.

<figure><img src="/files/IBRz1jssEKarspg0gSyz" alt=""><figcaption></figcaption></figure>

* **Switch step** → if the webhook does not exist, create it with schedules and routes:

<figure><img src="/files/syRV9HpF9cg4dSAG1HiG" alt=""><figcaption></figcaption></figure>

Each webhook can include:

* Schedule details (frequency, unit, flow association).

<figure><img src="/files/kdemNx1J7Sh2fOVEGxaR" alt=""><figcaption></figcaption></figure>

#### **Routes configuration**

* Route configurations (headers, flow IDs, routes).

<figure><img src="/files/V0IvLZbZlTEOPjWFsTLP" alt=""><figcaption></figcaption></figure>

#### **Additional configurations**

* Optional settings like auto-generated API keys, retries, and authentication.

<figure><img src="/files/d0QtSx2LAuJnY6YLLgn8" alt=""><figcaption></figcaption></figure>

> If your project doesn’t use webhooks, you can remove these steps and keep only the relevant logic for your activation.

### 6. Success Response

The final step is a **Response step**, which returns a success message.

* This confirms that templates have been imported (if needed) and webhooks have been created or validated.
* You can fully customize this response.

<figure><img src="/files/k0qTc9Wuv1QOXG7ntt21" alt=""><figcaption></figcaption></figure>

### When to Use This Flow?

This is a **basic activation flow** typically used in multi-tenant setups. It ensures that each tenant’s templates and webhooks are properly initialized.

You can also adapt this structure for other activation scenarios:

* Use it without templates or webhooks by removing those loops.
* Treat any flow connected through a widget’s **“activate”** function as an activation flow.

> This template helps you structure any activation process, whether for tenants, projects, or custom configurations.


---

# 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.fastn.ai/tutorials-1/understanding-flow-types/how-to-set-up-an-activation-flow.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.
