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

# Set up flow control hooks

> Create your flow control hooks with the setup wizard in the Portal Admin Dashboard.

The setup wizard creates your flow control configuration in four steps: **Kind**, **Base URL**, **Hooks**, and **Test**. Each environment has one flow control configuration, so the wizard is only available until you finish it.

Before you start, deploy an HTTPS endpoint that handles the hooks you plan to turn on. See [Flow control hooks](/resources/flow-control-hooks/overview) for the request and response contract of each hook.

## Step 1: Choose the kind

1. In the [Portal Admin Dashboard](https://app.portalhq.io), select the environment you want to configure.
2. Under **Webhooks** in the sidebar, click **Flow control**. If the environment has no flow control configuration, Portal opens **Add a webhook**.
3. Under **What kind of webhook do you need?**, select **Flow control hooks** if it isn't already selected.
4. Click **Continue**.

If flow control hooks are already configured for the environment, the page only offers the informational kind.

## Step 2: Enter the base URL

Under **Where should Portal send flow control hooks?**, enter your **Base URL**, for example `https://api.example.com/portal`. Portal appends a fixed path to it for each hook:

* `/sign-approval`
* `/backup`
* `/backup/fetch`

The URL must start with `https://`. Portal removes any trailing `/`. Click **Continue**.

<Note>
  You can't change the base URL from the dashboard after the wizard creates the configuration. Double-check it before you continue.
</Note>

## Step 3: Choose the hooks

Under **Which hooks should Portal call?**, select the hooks you want to turn on. Both are selected by default.

* **Signature approvals** (`POST /sign-approval`): Portal calls it before every signature. Return `2xx` to approve or `400` to reject. A timeout of 10 seconds counts as an error, and the signature fails.
* **Self-managed backups** (`POST /backup` and `POST /backup/fetch`): Portal calls them when a wallet is backed up or recovered. `/backup` must return a `2xx` to store the share, or the backup fails. `/backup/fetch` must return `200` with the shares, or the recovery fails.

If your environment uses Portal-managed backups, only **Signature approvals** is shown.

Click **Create hook**. Portal shows a confirmation, because it starts calling your server as soon as you confirm:

* With **Signature approvals** selected, every signature in the environment waits on `/sign-approval`.
* With **Self-managed backups** selected, every backup and recovery in the environment depends on `/backup` and `/backup/fetch`.

Click **Create hook** in the confirmation to create the configuration.

If you didn't select any hook, the wizard creates the configuration with every hook off and skips the test step. Portal doesn't call your URL until you turn a hook on from the **Flow control** page.

## Step 4: Test your hooks

The **Test your hooks** step shows the secret Portal sends in the `X-Webhook-Secret` header. Copy it and configure your server to check it.

Click **Test all hooks**. Portal sends a [test call](/resources/flow-control-hooks/overview#recognizing-test-calls) to each hook you turned on and shows the status code, the response time, and a **Show response** link for each one.

If a hook doesn't respond, the wizard tells you which operations will fail while it's down. Fix your server and click **Test again**, or click **Skip and finish** to test later from the **Flow control** page. The hooks are already live at this point.

Click **Finish**.

## Done

The last screen confirms that the hooks are live and shows your base URL, the hooks you turned on, and the secret. If a hook failed the test, it reminds you that calls to it will fail until your server responds.

* Click **View requests** to open the [flow control event log](/resources/flow-control-hooks/overview#flow-control-events).
* Click **Test hooks again** to run the tests again.
* Click **Done** to go to the **Flow control** page.

## Next steps

* [Manage your flow control hooks](/resources/flow-control-hooks/overview#manage-in-the-dashboard): turn hooks on or off, reveal your secrets, and turn on email alerts.
* [Set up informational webhooks](/resources/informational-webhooks/set-up) to get notified about transactions and wallet lifecycle events.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.