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

# How Compass Works

> One flow for every product: your app asks for an action, Compass builds the transaction, and your user signs it with their own wallet.

Compass sits between your app and the blockchain. You tell the API what your user wants to do, Compass prepares it, and your user signs it with their own wallet. Every product (Earn, Credit, Tokenized Assets and Perpetual Trading) follows this pattern.

## The flow

```mermaid actions={false} theme={"system"}
sequenceDiagram
    autonumber
    participant App as Your backend
    participant API as Compass API
    participant User as User's wallet
    participant Chain as Blockchain
    App->>API: Ask for an action (e.g. deposit 100 USDC)
    API-->>App: Unsigned transaction
    App->>User: Ask the user to sign
    User->>Chain: Signed transaction
    Note over Chain: The user's product account<br/>deposits into the protocol
```

1. **Your backend calls the Compass API** with your API key and says what the user wants to do.
2. **Compass builds the transaction.** It handles approvals, routing, bundling and your fees, then returns the transaction unsigned.
3. **Your user signs it** in their own wallet: a browser wallet, an embedded wallet, or a signing service.
4. **The transaction runs on-chain** from the user's product account, straight into the protocol.

The user needs a product account on a chain before their first action there. [Account Lifecycle](/v2/Products/Accounts) covers how to create one, fund it, track it and withdraw. Perpetual Trading is the exception: it uses the user's own Hyperliquid account instead.

## Who does what

| | What it does | Can it move funds? |
| - | - | - |
| **Your backend** | Holds your API key and calls the Compass API. | No. An API key can read data and build transactions, but it can't sign them. |
| **Your user's wallet** | Owns the product account and signs every action. | Yes. Nothing moves without its signature. |
| **Product account** | A smart account for each user and product. The user is its only owner, and it has the same address on every chain. | Only when the owner signs. |
| **Compass** | Reads market data and builds each transaction for you. | No. Compass never signs, never holds funds, and has no admin rights over product accounts. |
| **Gas sponsor** (optional) | Your own wallet, paying gas so users don't need to hold ETH. | No. It only sends transactions the user has already signed. |

<Info>
  Compass never holds private keys, never takes custody of funds, and can't move anything without the owner's signature. Funds always sit in the user's own [product account](/v2/Products/Accounts).
</Info>

## Three ways to sign

1. **Your user pays gas.** Compass returns a normal transaction. The user signs and sends it from their wallet and pays the gas.
2. **You sponsor gas.** Add `gas_sponsorship: true` to the request. Compass returns EIP-712 data for the user to sign, which costs nothing. You send that signature to [`/v2/gas_sponsorship/prepare`](/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction), which returns a transaction for your sponsor wallet to send. To sponsor account creation, set `sender` to your sponsor wallet instead. Sponsored flows need the owner to be a regular wallet (EOA). See [Gas Sponsorship](/v2/Products/gas-sponsorship).
3. **Signed orders and actions.** Some flows aren't transactions at all. Tokenized equities use a signed order that fills asynchronously, and Perpetual Trading uses signed Hyperliquid actions. The user signs, you submit through the API, then you check the status.

## Works across products

* **[Bundling](/v2/Products/Bundling):** run several steps, such as a swap followed by a deposit, as one transaction that either fully succeeds or does nothing.
* **[Embedded fees](/v2/Products/Embedded-fees):** add your own fee to deposits, withdrawals, loans and trades, paid to your address.
* **[Gas sponsorship](/v2/Products/gas-sponsorship):** let users transact without holding gas tokens.
* **[Bridging](/v2/Products/Bridging):** move USDC between product accounts on Ethereum, Arbitrum and Base.

## Ways to integrate

Use the REST API directly, the Python and TypeScript SDKs, drop-in [React widgets](/v2/Products/Widgets), or let an AI agent work through the [MCP server](/v2/Agents/MCP-Server) or the [CLI](/v2/Agents/CLI). All of them follow the same flow. See [Choose a Tool](/v2/Agents/Overview) to compare them.

## Next steps

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/v2/get_started/get-started">
    Get an API key and make your first call.
  </Card>

  <Card title="Earn" icon="piggy-bank" href="/v2/Products/Earn">
    Offer yield on stablecoins and crypto.
  </Card>

  <Card title="Crypto-Backed Loans" icon="hand-holding-dollar" href="/v2/Products/Credit">
    Let users borrow against their assets.
  </Card>

  <Card title="Tokenized Assets" icon="chart-line" href="/v2/Products/Tokenized-Assets">
    Trade tokenized stocks and real-world assets.
  </Card>
</CardGroup>
