Skip to main content
POST
Optimal route between two tokens

Body

application/json
chainId
number
default:1
required

Chain ID of the network to execute the transaction on

fromAddress
string
default:0xd8da6bf26964af9d7eed9e03e53415d37aa96045
required

Ethereum address of the wallet to send the transaction from

amountIn
string[]
required

Amount of tokenIn to swap in wei

Example:
tokenIn
string[]
required

Ethereum address of the token to swap from. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Example:
tokenOut
string[]
required

Destination token addresses. Solana mints are case-sensitive; native SOL uses 11111111111111111111111111111111.

routingStrategy
enum<string> | null

Routing strategy to use

Available options:
ensowallet-v2,
router,
delegate,
router-legacy,
delegate-legacy
executionMode
enum<string>
default:user

Controls how quote is built based on execution mode

Available options:
user,
backend
toEoa
boolean | null
deprecated

Flag that indicates if gained tokenOut should be sent to EOA

includeTransactionCost
boolean
default:false

Include point-in-time source-chain transaction cost estimates in native units and USD, plus USD values for reported bridge fees

useIntentAddress
boolean

Route a cross-chain request through an intent address on the destination chain. The bridge delivers to that address, then a keeper runs the destination route and sends tokenOut to the receiver. When omitted, intents are used if both chains support them. Set to false to use a bridge callback instead. Ignored for same-chain routes.

spender
string

Ethereum address of the spender of the tokenIn

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

refundReceiver
string

Ethereum address of the receiver of any dust tokens produced during execution. Required for routes to Solana.

Example:

"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"

minAmountOut
string[]

Minimum amount out in wei. If specified, slippage should not be specified

slippage
string
default:50

Slippage in basis points (1/10000). e.g. 50 = 0.50%. If specified, minAmountOut should not be specified

Example:

"300"

ignoreAggregators
enum<string>[] | null

A list of swap aggregators to be ignored from consideration

Available options:
0x,
1inch,
openocean,
kyberswap,
native,
paraswap,
bebop,
barter,
sushiswap-router,
ooga-booga,
renegade,
uniswap,
rooster,
wowmax,
grapher,
hyperbloom,
hyperswap,
hyperflow,
fly,
eisen,
nordstern,
everlong,
bitget,
akka
ignoreStandards
string[] | null

A list of standards to be ignored from consideration

ignoreBridges
enum<string>[]

A list of bridges to be ignored from consideration

Available options:
cctp,
stargate,
ccip,
relay,
layerzero-teller,
arbitrum-native,
mayan
crosschainRouteMode
enum<string>
default:full

Controls cross-chain route complexity. direct uses only a bridge, source allows routing before the bridge, destination allows routing after the bridge, sourceOrDestination allows routing on either chain but not both, and full allows routing on both chains

Available options:
direct,
source,
destination,
sourceOrDestination,
full
effort
enum<string>

Latency/quality trade-off for pathfinding and aggregator querying. light returns fastest over a reduced search space (short aggregator wait with early return once two usable quotes arrive, fewer candidate paths, no destination-side bridge routing), medium waits the full short window over the full search space, high is the default balanced behavior, and max queries all aggregators in parallel with an extended wait for best execution (higher CU cost)

Available options:
light,
medium,
high,
max
referralCode
string

Referral code that will be included in an on-chain event.

Maximum string length: 16
Example:

"0123456789ABCDEF"

receiver
string

Destination recipient. Required for cross-chain routes; Solana uses a case-sensitive Base58 address.

destinationChainId
number

Chain ID of the network to bridge to and receive tokenOut

allowAsync
boolean
default:false

Allow async redeems, where tokenOut is paid after the transaction. An async route returns amountOut, minAmountOut and priceImpact as null and describes the payout in async. Cannot be combined with minAmountOut or useIntentAddress, intents do not support async redeems.

Response

gas
string
required
amountOut
required

Null for async routes, see async.estimatedAmountOut

metadata
object
required
createdAt
number
required

Block number the transaction was created on

tx
object
required

The tx object to use in ethers

route
object[]
required

The route the shortcut will use

blockNumber
number

Block number the quote was simulated against

priceImpact
number | null

Price impact in basis points, null if USD price not found

feeAmount
string[]

An array of the fee amount collected for each tokenIn

ensoFeeAmount
string[]
async
object

Present when the route is an async redeem (allowAsync=true). amountOut, minAmountOut and priceImpact are null because nothing is delivered in the transaction, the estimates are in async

minAmountOut
string

The minimum allowable amount out after slippage

intent
object
detailedRoute
object[]

Ordered route segments with the underlying standard actions. For inspection only; do not use it to build the transaction.

userOp
object

The ERC-4337 user operation object

preTransactions
object[]

Transactions that may need to be executed before the main shortcut transaction. Token approvals should be skipped when the current allowance is already sufficient.

bridgingEstimates
object[]

Estimated bridging durations when applicable

validUntil
number

Unix timestamp (seconds) after which this quote expires. Transactions submitted after this time may revert. On an intent route a late transaction still bridges, but the bridged token is refunded on the destination chain instead of being swapped.

transactionCost
string | null

Point-in-time lower-bound estimate of mandatory source-chain transaction fees in the native token smallest unit. Excludes priority fees, transaction value, bridge fees, and destination execution.

transactionCostUsd
string | null

Decimal string USD value of transactionCost. Null when the native-token price or source-chain fee estimate is unavailable.