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

# Settlement Modes

> Choose between automatic, Permit2, and allowance settlement when requesting a quote.

## Overview

The quote response's `settlement` field tells you which execution mode Rialto
returned. Always use the response value for transaction handling, even when you
send a request preference.

You can influence the backend's choice with the optional `settlement` query
parameter on `GET /quote`.

| Request value | Behavior                                                                                                                                                                        |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `auto`        | Default. Uses Permit2 for EOA ERC20 sells, and allowance mode for smart-wallet or native ETH sells.                                                                             |
| `permit2`     | Requires a Permit2 executable quote. Use this for gasless relays or integrations that specifically need Permit2. Native ETH sells and smart-wallet takers cannot use this mode. |
| `allowance`   | Requires router allowance mode. The response has no `permit2` payload or `tx.signature_offset`; ERC20 users approve the router spender in `issues.allowance.spender`.           |

`settlementPreference` is also accepted as an alias for `settlement`.

## Response modes

| Response value | What to do                                                                                                                                                                                                     |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `permit2`      | Have the taker sign the returned `permit2` typed data, splice the 65-byte signature into `tx.data` at `tx.signature_offset`, then submit the transaction from the taker wallet or through the gasless relayer. |
| `allowance`    | If `issues.allowance` is non-null, approve `issues.allowance.spender` for at least the raw `sell_amount`, then submit `tx.to`, `tx.data`, and `tx.value` without modifying calldata.                           |

## When to request Permit2

Request `settlement=permit2` when a flow specifically needs a Permit2 quote, such
as gasless relay submission. Pass `settlement=permit2` if you want the quote
request to fail instead of falling back to allowance mode.

```bash theme={null}
API_KEY='rialto_live_example.redacted_secret'
TAKER='<taker_wallet_address>'

curl -sS "https://rialto-trade-api.rialto.xyz/quote?sell_token=USDG&buy_token=WEEK&sell_amount=1&taker=$TAKER&permit2_owner=$TAKER&settlement=permit2&slippage_bps=50&chain_id=4663" \
  -H "Authorization: Bearer $API_KEY"
```

## Handling rules

Choose your handling from `settlement`, not from assumptions.

Do not modify `quote_id`, `route`, `platform_fee`, `permit2.message.witness`, or
`tx.data` except for replacing the Permit2 signature placeholder. A changed route
or witness will not match the signed quote and may revert.
