> ## 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.

# Integrator Fees

> Charge your own fee on top of Rialto's, paid to your wallet atomically on every swap.

## How it works

Approved integrators can charge their own fee on top of Rialto's on every swap
they route. The fee is collected as part of the swap and paid to your wallet in
the same onchain transaction. There is no separate claim step, no fee contract to
deploy, and no settlement to run yourself.

1. You request a quote with a swap\_fee\_bps value, your fee in basis points.
2. Rialto adds your fee on top of its own and returns the full breakdown.
3. The same quote includes one executable transaction that, on execution, pays
   both Rialto's treasury and your wallet atomically.
4. The taker signs or approves as needed, then submits the quote's tx directly or
   signs Permit2 for gasless relay.

Your fee is additive. Rialto charges its standard fee, and your fee is taken on
top. Rialto does not take any cut of your portion.

## What is bound to your key

| Bound to your key  | Meaning                                                |
| ------------------ | ------------------------------------------------------ |
| Payout wallet      | The address your fees are sent to.                     |
| Maximum fee in bps | A per-key cap, the largest swap\_fee\_bps you may set. |
| Integrator id      | An identifier used to attribute the swaps you route.   |

Because these are bound to the key and not the request, a leaked or tampered
request can never redirect your fees or raise your fee above your cap.

## Setting your fee

Add swap\_fee\_bps to the standard quote request. Your payout wallet and cap come
from your key, so you do not pass them on the request.

| Param          | Description                                                                                        |
| -------------- | -------------------------------------------------------------------------------------------------- |
| swap\_fee\_bps | Your fee in basis points, applied on top of Rialto's fee. 30 = 0.30%. swapFeeBps is also accepted. |

```bash theme={null}
INTEGRATOR_KEY='rialto_live_integrator.redacted_secret'

curl -sS 'https://rialto-trade-api.rialto.xyz/quote?sell_token=WETH&buy_token=USDC&sell_amount=0.01&taker=0x1111111111111111111111111111111111111111&slippage_bps=50&swap_fee_bps=30' \
  -H "Authorization: Bearer $INTEGRATOR_KEY"
```

## Reading the fee in the response

A quote with an integrator fee gains two things: an integrator\_fee block echoing
your fee, payout wallet, and integrator id; and extra entries in platform\_fee.fees,
one line per recipient, each showing the token the fee is taken in and the exact
amount. Rialto selects the most suitable fee token in the swap automatically, so
you do not choose a fee token.

```json theme={null}
{
  "buy_amount": "19800022",
  "platform_fee": {
    "total_bps": 80,
    "fees": [
      {
        "side": "source",
        "token": "<sell_token_address>",
        "symbol": "WETH",
        "decimals": 18,
        "bps": "50",
        "amount": "50000000000000",
        "amount_decimal": "0.00005",
        "recipient": "<rialto_fee_recipient_address>"
      },
      {
        "side": "source",
        "token": "<sell_token_address>",
        "symbol": "WETH",
        "decimals": 18,
        "bps": "30",
        "amount": "30000000000000",
        "amount_decimal": "0.00003",
        "recipient": "<integrator_fee_recipient_address>"
      }
    ]
  },
  "integrator_fee": {
    "bps": 30,
    "recipient": "<integrator_fee_recipient_address>",
    "id": "your-integrator-id"
  }
}
```

In this example Rialto's fee is 50 bps and your fee is 30 bps, for a combined
total\_bps of 80. The recipient on the second line is your payout wallet. The token
and amount fields tell you exactly which token the fee is taken in and how much.

## Caps and rules

| Rule                     | Behavior                                                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| Fee above your key's cap | swap\_fee\_bps greater than your configured maximum is rejected with 400.                                                      |
| Combined fee too high    | Rialto's fee plus your fee must not exceed the protocol maximum, currently 100 bps total. Over the limit is rejected with 400. |
| Non-integrator key       | A key without integrator access that sends swap\_fee\_bps is rejected with 403.                                                |
| No fee requested         | Omit swap\_fee\_bps or send 0 for a standard swap with no integrator fee.                                                      |

Execute an integrator-fee quote exactly like any other quote. The fee recipient
and cap are key-bound server-side, and the fee split is encoded into the
transaction Rialto returns.
