tokenIn and tokenOut. Whether you’re swapping tokens, entering yield vaults, or moving assets across chains, the Route API handles the complex routing logic automatically.
Routing vs Bundling: The Route API excels at single-path operations where you want Enso to determine the optimal route automatically. For custom multi-step workflows where you need precise control over each action, use the Bundle API instead.
When to use routing: Token swaps with optimal pricing, vault entries/exits, position migrations between protocols, crosschain transfers, and any scenario where you want automated route optimization rather than manually specifying each step.

Quick Start
Theroute API produces a gas-optimized, atomic transaction between the two given positions, combining swap, deposit, and redeem operations.
Use the Bundle API if you need other actions Enso supports, such as
harvest, borrow, repay.Sample requests
- Token Swap
- Vault Entry (Zap)
- Crosschain swap
- Crosschain Vault Zap
Core Concepts
Input/Output Model
Specify any
tokenIn and tokenOut - ERC20 tokens, LP tokens, vault shares, or yield positions. The Route API automatically finds the optimal path between any two DeFi positions across protocols and chains.Response
Response contains a complete transaction object ready to sign (
tx), amountOut (expected output), gas (estimated), and route (optimized path taken).Slippage Control
Set slippage in basis points:
"50" = 0.5%, "300" = 3%. Higher slippage for complex routes. Cannot use both slippage and minAmountOut - choose one protection method.Crosschain Operations
Add
destinationChainId for crosschain routes. API automatically selects optimal bridges and calculates fees.Response Structure
Use these fields to build the quote review screen:| Field | What it means | Show it as |
|---|---|---|
tx | Complete transaction object ready for submission. Contains the correct to, data, value, and gas fields. | The transaction your wallet signs. Submit it as-is. |
amountOut | Simulated output amount from the selected route. | Expected output or estimated received amount. |
minAmountOut | Slippage-protected minimum output when available. | Minimum received amount. |
gas | Estimated gas usage from simulation. | Network cost estimate and transaction gas value. |
priceImpact | Estimated price impact for the route when available. | Price impact warning or route quality indicator. |
route | The optimization path Enso constructed. | Route details, protocols, or path disclosure. |
Examples
The following examples progress from simple token swaps to complex crosschain vault interactions. Each example builds on concepts from previous ones, demonstrating how the Route API handles increasingly sophisticated DeFi operations automatically.0. Install & Authenticate
You can interact with the API using Enso SDK or directly via a REST API. You can explore Enso through API Sandbox. To install the SDK run the following command:1. Simple Token Swap
Start with the most basic routing operation: swapping ETH for USDC on Ethereum mainnet.SDK
2. Zap into Vault
Enter a Yearn vault directly from ETH, automatically handling any intermediate swaps and vault deposits.SDK
amountOut represents vault shares, not underlying tokens.
3. Vault Migration
Move from one yield protocol to another - exit Yearn vault and enter Aave lending position.SDK
4. Crosschain Transfer
Move assets between blockchains using Enso’s integrated bridge routing.SDK
feeAmount shows bridge costs, and route reveals pre- and post- bridging steps.
5. Crosschain Vault Zapping
The most complex example: bridge assets and enter a vault on the destination chain in one transaction.SDK
Route vs Bundle Output
Route returns a single optimized path from the requested input position to the requested output position. Theroute array explains the actions Enso selected, while tx, amountOut, and gas are the execution fields your application should display and submit.
Bundle returns a transaction built from the explicit actions you provide. When bundled actions include routing, the response can also include route-style information for those routed segments, giving users and reviewers more transparency into how the final transaction was constructed.
Use Route when the product can express the desired outcome as tokenIn -> tokenOut. Use Bundle when the product must control the exact sequence of actions, such as checking a bridged balance, harvesting rewards, borrowing, repaying, or depositing through a protocol-specific path.
Related APIs & Next Steps
When to Use Other APIs
- Bundle API: When you need custom multi-step logic or want to orchestrate specific actions in sequence, or you need actions beyond
swap,depositandredeemthe route API uses - Nontokenized Positions: For lending positions that don’t issue tokens (like Aave debt positions)
- Approval Endpoint: Managing token permissions when using
"router"strategy
Supporting APIs
- Tokens API: Discover available tokens and their addresses across chains
- Prices API: Get current token valuations for your UI
- Networks API: List supported chains and their details
Updated

