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

# Use cases

> What teams build with the Lean API, and the exact calls behind each one.

Each use case covers who it's for, what you build, the call sequence, a starter you can run, and
the guardrails that keep it safe. Every operation links to its page in the
[API reference](https://docs.lean.xyz/api-reference/markets/list-markets.md), where you can try it.

> [card] [Best price execution across venues](https://docs.lean.xyz/use-cases/best-price-execution.md)
>
> One order, filled at the best combined price across Polymarket and Hyperliquid, without
> integrating either venue.

> [card] [Model driven trading with hard limits](https://docs.lean.xyz/use-cases/model-driven-trading.md)
>
> A bot that turns model edge into orders, with spending caps the API enforces.

> [card] [An AI agent that trades within a budget](https://docs.lean.xyz/use-cases/ai-agent-trading.md)
>
> A research agent on a read only key proposes trades; an execution key with tight limits
> places them after approval.

> [card] [Hedging sportsbook exposure](https://docs.lean.xyz/use-cases/hedging-exposure.md)
>
> Buy the other side on prediction market liquidity when liability crosses a threshold.

> [card] [Price monitoring and alerts](https://docs.lean.xyz/use-cases/price-monitoring.md)
>
> Dashboards and alerts on a read only key, with no trading permission at all.

> [card] [Funding and treasury automation](https://docs.lean.xyz/use-cases/funding-automation.md)
>
> Find deposit assets and addresses, then watch balances arrive.

## Guardrails built into every key

Every use case runs on the same controls:

* **Spending caps on every key.** A per order limit and a rolling 24 hour limit, checked before
  anything reaches a venue. A key can lower its own limits, never raise them.
* **Idempotent orders.** Your `client_order_id` makes every retry return the original order,
  never a second one.
* **Read only keys.** A key with only the `read` scope can see markets, quotes and previews, and
  can never place an order.
* **Kill switch.** One call pauses a key or its whole trading account.
* **Preview first.** See the exact venue plan, cost and any refusal before you commit.

## Start with a test key

All starters use the same two variables as the [Quickstart](https://docs.lean.xyz/quickstart.md):

```bash theme={"dark"}
export LEAN_API_URL="https://api.lean.xyz"
export LEAN_API_KEY="lean_sk_test_..."
```

A test key lets you try everything without real money: orders and fills are simulated against
test balances of 10,000 USD on each venue. Switch to a live key when you're ready. See
[Test mode and live mode](https://docs.lean.xyz/test-mode.md).


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