Use the Route API when Enso can find a single path from the current position into one new destination. Use the Bundle API when the action order must be fixed.
Definition
A position migration exits one vault or protocol position and enters another in a single flow, so the user does not have to redeem to a cash token and later deposit in a second transaction.
How it works
Start from the position token the user holds and the destination position they want.
If a single path exists, one route can exit the source position and enter the new one.
If the move must redeem, swap, and deposit in a fixed order, specify those actions in a bundle.
Show the quote, collect any required approval, submit the returned transaction, then refresh balances.
How Enso does this
Call POST https://api.enso.build/api/v1/shortcuts/route with tokenIn set to the current position token and tokenOut set to the new destination token, plus amountIn and slippage. Discover destination tokens with GET /api/v1/tokens. Use POST /api/v1/shortcuts/bundle when the order must be fixed, and use routingStrategy delegate when the flow requires it (including some harvest, borrow, or repay steps). See Get Started and Enso Earn.
FAQ
Does migration have to pass through a stablecoin in my app?
Not if Route can find a path from the source position token to the destination position token. You only need to introduce an intermediate asset when you are specifying the steps yourself in a bundle.
What if Enso cannot build the route?
The API can return an error such as “Could not build shortcuts for route.” Confirm both tokens are supported, try Bundle with an explicit action list, or request coverage in the Telegram developer chat.
Related articles
How do I withdraw from a vault and swap in one transaction?
What does “Could not build shortcuts for route” mean?
How do I add an Earn tab to a wallet or app?
How do I discover tokens, vaults, and protocols from the API?
When should I use the Bundle API instead of Route?
