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

# Execute a swap

> From one quote request to a confirmed swap.

## The flow

<Steps>
  <Step title="Check the allowance (ERC-20 input only)">
    The signing wallet must allow the executor `0x27F38C4fd323D635d0E15054a6cfbdFc9D076F25` to spend at least `amountIn` of the input token. Approve first if it does not.
  </Step>

  <Step title="Request the quote with a transaction">
    Call [`GET /quote`](/api-reference/quote) with `recipient`. Do this after any approval so the quote is fresh.
  </Step>

  <Step title="Show the user the terms">
    Display `swap.netOut` as the expected output and `swap.minOut` as the minimum received.
  </Step>

  <Step title="Sign and send `tx`">
    Send `to`, `data` and `value` exactly as returned, on chain `4663`.
  </Step>

  <Step title="Wait for the receipt">
    A successful swap emits `Settled` from the executor. A reverted swap moves no tokens.
  </Step>
</Steps>

## Who pays and who receives

* The wallet that **sends** `tx` pays the input. The executor only pulls tokens from the sender.
* `recipient` receives the output. It can be the sender or any other address, but not the zero address.

## Native ETH

Use `0x0000000000000000000000000000000000000000` for ETH.

* **ETH input:** no approval. `tx.value` equals `amountIn`; send it as returned.
* **ETH output:** the recipient receives native ETH, not WETH.

Inside `swaps`, legs that trade through WETH show the WETH address `0x0bd7d308f8e1639fab988df18a8011f41eacad73`. That is expected.

## Approvals

Approve the executor for the exact `amountIn`, or a larger amount if your product supports standing approvals. The executor uses only the amount in the order and clears any approvals it grants to pools during the swap.

`swap.spender` and `tx.to` are always the executor address. If either is ever different from [the published address](/contracts), do not sign.

## Slippage, minimum and deadline

| Parameter | Default | Range | Effect |
| - | - | - | - |
| `slippageBps` | `50` (0.5%) | `0` to `500` | `minOut = netOut × (10000 − slippageBps) / 10000` |
| `minOut` | not set | up to `swap.netOut` | Your own minimum. Overrides `slippageBps`. |
| `deadline` | now + 600 s | now to now + 3600 s | Unix seconds. The swap reverts after it. |

The quote is exact at `block`. Prices move, so a swap sent later may get less than `netOut`, but never less than `minOut`.

## Freshness

Quotes do not have an ID or a server-side expiry. The transaction carries its own `deadline` and `minOut`. For the best price, request a new quote right before the user signs, and again if they wait more than a few seconds. Requests are fast, typically well under a second.

## When a swap reverts

The executor reverts with one of these errors. Nothing is transferred.

| Error | Meaning | What to do |
| - | - | - |
| `Slippage(net, minOut)` | Price moved past the minimum | Request a new quote |
| `Expired()` | Sent after `deadline` | Request a new quote |
| ERC-20 transfer failure | Allowance or balance too low | Approve or top up, then re-quote |
| `BadOrder()` | `value` does not match the order, or the input token takes a transfer fee | Send `tx.value` exactly. Fee-on-transfer and rebasing input tokens are not supported. |

## Gas

`gas` is the router's estimate for the swaps. `swap.executorGas` is the gas measured when the transaction was run through the executor at the quote block. Use `eth_estimateGas` from the signing wallet when you can, or `executorGas` plus a margin.


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