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

circle-info

Exact output requires the ExactOutputRouting feature flag. Contact the Squid team to enable it for your integrator ID.


Usage

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

// 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

GuaranteedtoAmountMin = 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 requiredExactOutputRouting 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.

Last updated