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

> ## Agent Instructions
> These are the Ampli Intelligence docs. API base: https://si.ampli.net/api/v1. API MCP: https://si.ampli.net/mcp.
> Auth is a partner key (X-Partner-Name and X-Partner-API-Key headers) or an x402 payment in USDC on Base.
> For a single-treasury agentic wallet or Wallet-as-a-Service, use the ampli^ SDK at https://ampli.net and https://docs.ampli.net. agk_ keys and /api/v1/agent-runtime belong to that SDK.
> Use only the routes and tools documented here. Do not invent endpoints or parameters.
> The ampli^ SDK (https://ampli.net, docs at https://docs.ampli.net) can use this intelligence to deliver a single-treasury agentic wallet or Wallet-as-a-Service. This host is si.ampli.net. Auth is a partner key or an x402 payment. agk_ keys and /api/v1/agent-runtime belong to the SDK Agent API.
> Every amount is an integer string in the token's base units. USDC, EURC, USDT0, and USDG use 6 decimals (1000000 is 1 USDC). WETH and cbETH use 18. cbBTC uses 8.
> The service is non-custodial. It returns an allocation, an action plan, and calldata. It never holds keys, signs, or sends a transaction.
> APR values are percentages measured now or over the trailing 7 days. They are not forecasts and nothing here guarantees a return.
> x402 payments are verified before the work and settled only when the response is 2xx. A 400 or 422 costs nothing.
> Partner headers always win. A request with a wrong partner key returns 401 and does not fall back to payment.
> Monitor alerts arrive only on the websocket. create_monitor_session returns a token; the client must open the socket itself.
> Market names in optimize must come from list_protocols for the same chain and token. Do not guess names.

# Risk rules and constraints

> The liquidity and health rules that limit where new money can go, how missing data is handled, and the policy constraints a caller can add on top.

Yield alone picks the riskiest market. Ampli limits where **new** money can go. These rules only restrict new deposits. They never force a withdrawal from a position you already hold.

## Built-in rules

| Rule | Default | Effect |
| :- | :- | :- |
| Liquidity buffer | 40% kept free | A position may use at most 60% of a market's current withdrawable liquidity, so you can still exit |
| Stuck positions | always on | A held position larger than the market's liquidity keeps at least the part that cannot be withdrawn now |
| Utilization ceiling | 95% | Markets above it take no new deposits. Near full utilization, withdrawals can fail and rates swing |
| Morpho RED warnings | always on | Vaults that Morpho flags RED, such as `deposit_disabled` or bad debt, take no new deposits |
| Largest depositor | on | A Morpho vault's cap uses the liquidity left after its largest depositor exits. If that depositor cannot fully exit, the vault takes no new deposits |
| APR spike discount | 24 samples | A market whose latest APR is above its 7-day average is priced at the average, so a short incentive spike does not attract capital |
| Gas horizon | 30 days | A move must pay for its gas within the horizon |

When the remaining room cannot hold `total_capital`, the call fails with a `400` that says how much fits. It never returns a plan that strands funds. See [Errors](https://docs.si.ampli.net/errors.md#insufficient-capacity).

## Missing data

Missing data is handled conservatively:

* A market whose liquidity cannot be read takes no new deposits.
* A market without enough APR history keeps its spot curve instead of the 7-day discount.
* If Morpho's risk data is unavailable, the largest-depositor rule is skipped for that request.

## Caller constraints

Add your own policy in `constraints`. Each entry is `{ "kind": ..., "params": { ... } }`. Amounts are base units. Invalid shapes and impossible combinations return `400` with the expected parameters, never a silent partial plan.

| `kind` | `params` | Effect |
| :- | :- | :- |
| `min_protocols` | `min_protocols`, optional `min_fraction_per_protocol` (0.01 to 1, default 0.05) | Spread across at least N markets, each holding at least that fraction |
| `max_amount_per_protocol` | `protocol`, `max_ratio` (above 0, at most 1) | Cap one market at a share of capital. `0.4` means 40% |
| `max_allocation_amount_per_protocol` | `protocol`, `max_amount` | Cap one market at an absolute amount |
| `min_allocation_amount_per_protocol` | `protocol`, `min_amount` | Require at least this amount in one market |
| `min_amount` | `protocol`, `value`, optional `percentage` | Floor in one market. With `percentage: true`, `value` is a fraction from 0 to 1 |
| `exclude_protocol` | `protocol` | Never use a market |

```json theme={null}
{
  "constraints": [
    { "kind": "min_protocols", "params": { "min_protocols": 3 } },
    { "kind": "max_amount_per_protocol", "params": { "protocol": "superform", "max_ratio": 0.4 } },
    { "kind": "max_allocation_amount_per_protocol", "params": { "protocol": "moonwell", "max_amount": "250000000" } },
    { "kind": "exclude_protocol", "params": { "protocol": "spark" } }
  ]
}
```

This spreads across at least three markets with at least 5% each, caps Superform at 40%, caps Moonwell at 250 USDC (`250000000`), and never uses Spark.

> [!NOTE]
>
> Constraints narrow what the rules allow; they cannot loosen a built-in rule. A floor that a rule forbids, such as a minimum in a market above 95% utilization, can make the request fail with a `400`.


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