The Enso Shortcuts system offers two powerful APIs for building DeFi workflows:

  • Automated Routing: The POST shortcuts/route API calculates optimized multi-step paths for entering/exiting DeFi positions or swapping ERC20 tokens. It automatically creates a path between two positions specified in the request.
  • Bundling DeFi Actions: The POST shortcuts/bundle API lets you orchestrate DeFi workflows by composing multi-step sequences of Actions of your choosing.

Both APIs return a transaction object with calldata representing your workflow, ready to be submitted to EnsoShortcutRouter for execution.

The following examples are on Ethereum (chainID=1).

1. Automated Routing

The POST route API is suitable for single-path operations with automatic optimization.

Token Swaps

Optimize conversions between tokens by leveraging automated routing across DEXs.

Example: Swapping 1 ETH to USDC with the best execution price and 0.5% slippage

  • Input: 1 ETH
  • Output: USDC worth of 1 ETH
  • Slippage: 0.5%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
    "tokenOut": ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
    "amountIn": ["1000000000000000000"],
    "slippage": "50"
  }' | jq

LST Staking Entry

Transform base tokens directly into staked liquid staking positions with a single call.

Example: Converting 1 ETH to stETH (Lido Staked ETH) in one step

  • Input: 1 ETH
  • Output: stETH
  • Slippage: 0.5%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
    "tokenOut": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
    "amountIn": ["1000000000000000000"],
    "slippage": "50"
  }'  | jq

Yield Position Entry

Enter yield-generating positions from base assets.

Example: Moving from 1 WETH to a Yearn vault (yvWETH)

  • Input: 1 WETH Output: yvWETH (exact amount depends on the vault’s share price)
  • Slippage: 0.5%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
    "tokenOut": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
    "amountIn": ["1000000000000000000"],
    "slippage": "50"
  }'  | jq

Position Exit (Single Token)

Exit completely from a DeFi position back to a single base token.

Example: Converting 1 yvWETH (Yearn ETH vault) back to WETH

  • Input: 1 yvWETH
  • Output: WETH (actual amount depends on accrued yield)
  • Slippage: 0.5%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xa258c4606ca8206d8aa700ce2143d7db854d168c"],
    "tokenOut": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],
    "amountIn": ["1000000000000000000"],
    "slippage": "50"
  }'

LP Position Entry

Enter into LP token positions with automatic routing and slippage protection.

Example: Going from 1 ETH to ETH/USDC Uniswap LP tokens

  • Output: ~0.92 ETH/USDC LP tokens (varies with pool composition)
  • Slippage: 1%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
    "tokenOut": ["0x06325440d014e39736583c165c2963ba99faf14e"],
    "amountIn": ["1000000000000000000"],
    "slippage": "100"
  }'  | jq

Simple LST Zapping

Direct entry into or exit from liquid staking tokens.

Example: Converting 1 stETH back to ETH

  • Input: 1 stETH (Lido Staked ETH)
  • Output: ETH (varies with current discount/premium)
  • Slippage: 1%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/route' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '{
    "chainId": 1,
    "fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "routingStrategy": "router",
    "receiver": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "spender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "tokenIn": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
    "tokenOut": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
    "amountIn": ["1000000000000000000"],
    "slippage": "100"
  }'  | jq

Note: Limited to simple LST interactions without complex staking steps. Use Bundle API for multi-step LST staking flows.

2. Bundling DeFi Actions

The Bundle API (POST /v1/shortcuts/bundle) excels at orchestrating complex sequences of operations.

Multi-Position Entry

Splitting funds across several positions simultaneously

Example: Distributing 1 ETH into three LST tokens in one transaction

  • Input: 1 ETH
  • Outputs:
    1. stETH (Lido Staked ETH)
    2. rETH (Rocket Pool ETH)
    3. cbETH (Coinbase Staked ETH)
  • Slippage: 1% for each conversion
  • Process:
    1. Convert 1/3 ETH (0.333 ETH) to stETH
    2. Convert 1/3 ETH (0.333 ETH) to rETH
    3. Convert 1/3 ETH (0.334 ETH) to cbETH
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
        "amountIn": "333000000000000000",
        "slippage": "100"
      }
    },
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0xae78736cd615f374d3085123a210448e74fc6393",
        "amountIn": "333000000000000000",
        "slippage": "100"
      }
    },
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0xbe9895146f7af43049ca1c1ae358b0541ea49704",
        "amountIn": "334000000000000000",
        "slippage": "100"
      }
    }
  ]' | jq

Staking Pipeline

Chain multiple actions together to create a complete Curve LP staking workflow.

Example: Creating a staked Curve 3pool position starting with 1 ETH

  • Input: 1 ETH
  • Final Output: 3pool LP tokens staked in Curve gauge
  • Process:
    1. Swap 1 ETH to USDC
    2. Deposit USDC into Curve 3pool to get 3pool LP tokens
    3. Stake 3pool LP tokens in the Curve gauge
curl -X 'POST' \
  "https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate" \
  -H 'accept: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "amountIn": '1000000000000000000',
        "slippage": "300"
      }
    },
    {
      "protocol": "curve",
      "action": "deposit",
      "args": {
        "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "tokenOut": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
        "amountIn": {
          "useOutputOfCallAt": 0
        },
        "primaryAddress": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"
      }
    },
    {
      "protocol": "curve-gauge",
      "action": "deposit",
      "args": {
        "tokenIn": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
        "tokenOut": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A",
        "amountIn": {
          "useOutputOfCallAt": 1
        },
        "primaryAddress": "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A"
      }
    }
  ]' | jq

Portfolio Rebalancing

Adjusting position sizes across multiple protocols.

Example: Rebalancing from 70% ETH/30% USDC to 50% ETH/50% USDC across Aave positions

  • Input: 0.6 WETH (for reallocation)
  • Output:
    1. 0.4 WETH deposited to Aave (aWETH)
    2. ~$580 USDC (from 0.2 WETH) deposited to Aave (aUSDC)
  • Process:
  1. Convert 0.2 WETH to USDC
  2. Deposit 0.4 WETH into Aave (aWETH position)
  3. Deposit the acquired USDC into Aave (aUSDC position)
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "amountIn": "200000000000000000",
        "slippage": "100"
      }
    },
    {
      "protocol": "aave-v3",
      "action": "deposit",
      "args": {
        "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
        "amountIn": "400000000000000000",
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    },
    {
      "protocol": "aave-v3",
      "action": "deposit",
      "args": {
        "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "tokenOut": "0xbcca60bb61934080951369a648fb03df4f96263c",
        "amountIn": {
          "useOutputOfCallAt": 0
        },
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    }
  ]' | jq

Position Migration

Moving from one protocol to another

Example: Migrating 1 aWETH from Aave to Compound’s cETH

  • Input: 1 aWETH (Aave WETH)
  • Output: cETH (Compound ETH)
  • Process:
    1. Withdraw 1 WETH from Aave by redeeming aWETH
    2. Unwrap WETH to ETH
    3. Deposit ETH into Compound to get cETH
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
  {
    "protocol": "aave-v3",
    "action": "redeem",
    "args": {
      "tokenIn": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
      "tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "amountIn": "1000000000000000000",
      "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
    }
  },
  {
    "protocol": "wrapped-native",
    "action": "redeem",
    "args": {
      "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "tokenOut": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "amountIn": {
        "useOutputOfCallAt": 0
      },
      "primaryAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
    }
  },
  {
    "protocol": "compound-v2",
    "action": "deposit",
    "args": {
      "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "tokenOut": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5",
      "amountIn": {
        "useOutputOfCallAt": 1
      },
      "primaryAddress": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5"
    }
  }
]' | jq

Leveraged Positions

Creating leveraged positions through multiple actions

Example: Creating a 2x ETH position using Aave

  • Input: 1 WETH initial collateral
  • Final Result: WETH worth of collateral in Aave
  • Process:
    1. Deposit 1 WETH as collateral in Aave
    2. Borrow ~1,000 USDC against the WETH collateral
    3. Swap the borrowed 1,000 USDC back to ~0.35 WETH
    4. Deposit the additional WETH back into Aave as more collateral
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
    {
      "protocol": "aave-v3",
      "action": "deposit",
      "args": {
        "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
        "amountIn": "1000000000000000000",
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    },
    {
      "protocol": "aave-v3",
      "action": "borrow",
      "args": {
        "collateral": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "amountOut": "1000000000",
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    },
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "tokenOut": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "amountIn": {
          "useOutputOfCallAt": 1
        },
        "slippage": "100"
      }
    },
    {
      "protocol": "aave-v3",
      "action": "deposit",
      "args": {
        "tokenIn": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "tokenOut": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
        "amountIn": {
          "useOutputOfCallAt": 2
        },
        "primaryAddress": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
      }
    }
  ]' | jq

Complex LST Zapping

Multi-step entry into or exit from liquid staking tokens with additional operations.

Example: Creating diversified LP and LST positions with 1 ETH

  • Input: 1 ETH split evenly
  • Slippage: 3% for each conversion
  • Process:
    1. Convert 0.5 ETH to stETH/ETH Curve LP tokens
    2. Convert 0.5 ETH to BAL/WETH Balancer LP tokens
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0x06325440D014e39736583c165C2963BA99fAf14E",
        "amountIn": "500000000000000000",
        "slippage": "300"
      }
    },
    {
      "protocol": "enso",
      "action": "route",
      "args": {
        "tokenIn": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "tokenOut": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56",
        "amountIn": "500000000000000000",
        "slippage": "300"
      }
    }
  ]' | jq

Yield Compounding Flow

Automate yield compounding by harvesting rewards, swapping, and redepositing in a single transaction.

Example: Compounding Curve gauge rewards back into the stETH/ETH pool

  • Input: Existing position in stETH/ETH Curve gauge
  • Process:
    1. Harvest accumulated wstETH rewards from the Curve gauge
    2. Convert wstETH rewards to stETH
    3. Deposit stETH back into the stETH/ETH Curve pool
  • Slippage: 3%
curl -X POST \
  'https://api.enso.finance/api/v1/shortcuts/bundle?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&routingStrategy=delegate&receiver=0xd8da6bf26964af9d7eed9e03e53415d37aa96045' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ENSO_API_KEY" \
  -d '[
      {
        "protocol": "curve-gauge",
        "action": "harvest",
        "args": {
          "token": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
          "primaryAddress": "0x182B723a58739a9c974cFDB385ceaDb237453c28"
        }
      },
      {
        "protocol": "enso",
        "action": "route",
        "args": {
          "tokenIn": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
          "tokenOut": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
          "amountIn": { "useOutputOfCallAt": 0 },
          "slippage": "300"
        }
      },
      {
        "protocol": "curve",
        "action": "deposit",
        "args": {
          "tokenIn": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
          "tokenOut": "0x06325440d014e39736583c165c2963ba99faf14e",
          "amountIn": { "useOutputOfCallAt": 1 },
          "primaryAddress": "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"
        }
      }
    ]
  ' | jq