> For the complete documentation index, see [llms.txt](https://guides.getalby.com/user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.getalby.com/user-guide/alby-hub/node/auto-swaps.md).

# Auto-Swaps

Auto-Swaps in Alby Hub allow you to automatically convert funds on Lightning into on-chain Bitcoin once a certain threshold is met.

### Why you should use it

* **Reduce exposure** to hot wallet balances
* **Automatically secure funds** in a on‑chain wallet (Hub on-chain wallet or cold storage)
* **Maintain receiving capacity** without manual intervention

{% hint style="info" %}
You define rules (threshold, swap amount and destination) and Alby Hub takes care of performing the swaps when the conditions are met.
{% endhint %}

### Use cases

* **Liquidity Management**\
  If you have very one-sided flows (mostly incoming, e.g. merchants) and want to maintain your receiving capacity (i.e. inbound liquidity)
* **Security & Risk management**\
  Automatically sweep exceeding funds to cold storage

### Example

1. Open the wallet page of Alby Hub and click the "Swaps" button
2. Switch to the "Swap out" tab and click the button "Auto-Swaps" at the top right
3. Configure auto-swap
   1. Destination (bitcoin address or xpub)
   2. Lightning Balance Threshold (the swap will be triggered by exceeding this amount)
   3. Swap Amount
4. Auto-Swaps will now be automatically performed, you'll see them show up in the transaction list

<figure><img src="https://2706948649-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWIUBf3ZZaBGu2ee6Y8lU%2Fuploads%2FuVGSTzACmcbIxZNmla7n%2FScreen%20Shot%202025-08-27%20at%2013.05.49.png?alt=media&amp;token=4de68dff-26b7-4416-bce2-c35d9ff5f018" alt=""><figcaption></figcaption></figure>

* **Threshold**: 3M sats
* **Swap amount:** 2.5M sats
* **Destination**: Cold storage wallet (bitcoin address or xpub)

{% hint style="success" %}
Every time Lightning balance exceeds 3M sats, a new auto-swap is attempted with 2.5M sent to a bitcoin on-chain address, keeping a minimum of 0.5M sats in the hub for day-to-day usage
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guides.getalby.com/user-guide/alby-hub/node/auto-swaps.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
