# Exact Output (toAmount)

## Overview

By default, Squid routes use **exact input** — you specify how much to send (`fromAmount`) and receive the best available output. With **exact output**, you specify how much you want to receive (`toAmount`) and the system calculates the required input amount.

This lets users say "I want to receive exactly X tokens" instead of "I want to send exactly X tokens."

{% hint style="info" %}
Exact output requires the `ExactOutputRouting` feature flag. Contact the Squid team to enable it for your integrator ID.
{% endhint %}

***

## Usage

Specify `toAmount` instead of `fromAmount` in your route request. Exactly one must be provided.

```json
// Forward (existing) — specify how much to send
{
  "fromAmount": "1000000000000000000",
  "fromToken": "...",
  "toToken": "..."
}

// Exact output — specify how much to receive
{
  "toAmount": "1000000",
  "fromToken": "...",
  "toToken": "..."
}
```

The response will include a calculated `fromAmount` representing how much input is needed to receive exactly `toAmount`. The `toAmountMin` will equal the `toAmount` — the output is guaranteed.

***

## Slippage

Slippage works in reverse compared to forward mode:

|            | Forward (fromAmount)         | Exact Output (toAmount)                   |
| ---------- | ---------------------------- | ----------------------------------------- |
| **Output** | May receive less than quoted | **Guaranteed** — `toAmountMin = toAmount` |
| **Input**  | Fixed at `fromAmount`        | May need to send slightly more            |

In exact output mode, slippage is applied to the **input** side. You may need to provide up to `fromAmount × (1 + slippage)` as input. Any unused input tokens are automatically returned to your address.

***

## Supported Route Types

| Route Type                                                  | Supported |
| ----------------------------------------------------------- | --------- |
| EVM single-chain swaps                                      | ✅         |
| EVM-to-EVM cross-chain (Coral V2)                           | ✅         |
| All chains accessible via Coral V2                          | ✅         |
| Routes with post-hooks                                      | ✅         |
| Routes with pre-hooks                                       | ❌         |
| Traditional bridge (Axelar GMP, Chainflip, ITS, Noble CCTP) | ❌         |
| Cosmos routes (Osmosis, Astroport)                          | ❌         |
| Solana single-chain (Jupiter)                               | ❌         |

***

## Limitations

* **Feature flag required** — `ExactOutputRouting` must be enabled for your integrator ID.
* **No pre-hooks** — Pre-hooks are not supported because the input amount is unknown at pre-hook execution time. Post-hooks work normally.
* **Coral V2 only for cross-chain** — Traditional bridge protocols are not supported for cross-chain exact output routes.
* **Some DEXes unsupported** — Paths through Curve, KyberSwap Elastic, Osmosis, Astroport, Printr, or Saddle will fail in exact output mode.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.squidrouter.com/api-and-sdk-integration/key-concepts/exact-output.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
