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

# Integration flow

> The end-to-end shape of a Spiral integration.

A Spiral integration is a thin orchestration layer on top of the API — you own the UX and the signing; Spiral supplies the data and the transactions.

```mermaid theme={null}
sequenceDiagram
    participant U as User
    participant P as Your app
    participant S as Spiral API
    participant W as User wallet
    U->>P: Choose a strategy + amount
    P->>S: POST /v1/partner/leverage/simulate
    S-->>P: positionPreview
    P->>U: Show leverage, LTV, expected APY
    U->>P: Confirm
    P->>S: POST /v1/partner/leverage/build (userAddress)
    S-->>P: { approvals, tx, meta }
    P->>W: Request signature (approvals, then tx)
    W-->>U: Approve in wallet
    W->>W: Broadcast on-chain
```

## Responsibilities

| Spiral                            | You                                 |
| --------------------------------- | ----------------------------------- |
| Strategy data, prices, risk facts | Discovery UX                        |
| Deterministic position previews   | Presenting the preview              |
| Unsigned approvals + transaction  | Prompting the user's wallet to sign |
| Position reads                    | Position UX + tracking              |

## Key rules

* **Simulate before build** — show users the outcome first.
* **Build with the user's wallet address** — `approvals` and `onBehalfOf` are bound to it.
* **Respect `meta.expiresAt`** — rebuild if the \~60s swap-calldata window lapses.
* **Non-custodial** — you never send Spiral a key; Spiral never moves funds.
