> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enso.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Optimal route between two tokens

> Calculates optimal transaction with the best route between two tokens, which may involve several actions that interact with various DeFi protocols. This single call already quotes internally and returns executable calldata along with `amountOut` and `gas`, so there is no separate quote step to call beforehand. <Tip>To enter a non-tokenized position, use GET&nbsp;`shortcuts/route/nontokenized`.</Tip>



## OpenAPI

````yaml /public/openapi.json get /api/v1/shortcuts/route
openapi: 3.0.0
info:
  title: Enso API
  description: >-
    #### Enso API

    - Find detailed documentation on
    [docs.enso.finance](https://docs.enso.finance).

    - To use the API, **you must include your API Key in the Authorization
    header** (Bearer format).

    - For testing, Swagger pre-authorizes you using the key:
    `1e02632d-6feb-4a75-a157-documentation` (1rps).

    - Get your own API Key at
    [enso.finance/developers](https://enso.finance/developers).
  version: 1.0.1
  contact: {}
servers:
  - url: https://api.enso.build
security:
  - {}
tags:
  - name: shortcuts
    description: ''
paths:
  /api/v1/shortcuts/route:
    get:
      tags:
        - DeFi Shortcuts
      summary: Optimal route between two tokens
      description: >-
        Calculates optimal transaction with the best route between two tokens,
        which may involve several actions that interact with various DeFi
        protocols. This single call already quotes internally and returns
        executable calldata along with `amountOut` and `gas`, so there is no
        separate quote step to call beforehand. <Tip>To enter a non-tokenized
        position, use GET&nbsp;`shortcuts/route/nontokenized`.</Tip>
      operationId: RouterController_routeShortcutTransaction
      parameters:
        - name: chainId
          required: false
          in: query
          description: Chain ID of the network to execute the transaction on
          schema:
            default: 1
            type: number
        - name: fromAddress
          required: true
          in: query
          description: Ethereum address of the wallet to send the transaction from
          schema:
            example: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
            type: string
        - name: amountIn
          required: true
          in: query
          description: Amount of tokenIn to swap in wei
          schema:
            example:
              - '1000000000000000000'
            type: array
            items:
              type: string
        - name: tokenIn
          required: true
          in: query
          description: >-
            Ethereum address of the token to swap from. For ETH, use
            0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
          schema:
            example:
              - '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
            type: array
            items:
              type: string
        - name: tokenOut
          required: true
          in: query
          description: >-
            Ethereum address of the token to swap to. For ETH, use
            0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
          schema:
            example:
              - '0x6b175474e89094c44da98b954eedeac495271d0f'
            type: array
            items:
              type: string
        - name: routingStrategy
          required: false
          in: query
          description: >-
            Routing strategy to use. in majority of cases you can use `router`.
            Use `delegate` with EOA when you want to specify a `spender`
          schema:
            nullable: true
            enum:
              - ensowallet
              - router
              - delegate
              - router-legacy
              - delegate-legacy
            type: string
        - name: toEoa
          required: false
          in: query
          description: Flag that indicates if gained tokenOut should be sent to EOA
          deprecated: true
          schema:
            nullable: true
            type: boolean
        - name: receiver
          required: false
          in: query
          description: Ethereum address of the receiver of the tokenOut
          schema:
            example: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
            type: string
        - name: spender
          required: false
          in: query
          description: Ethereum address of the spender of the tokenIn
          schema:
            example: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
            type: string
        - name: minAmountOut
          required: false
          in: query
          description: >-
            Minimum amount out in wei. If specified, slippage should not be
            specified
          schema:
            default: null
            type: array
            items:
              type: string
        - name: slippage
          required: false
          in: query
          description: >-
            Slippage in basis points (1/10000), e.g. 50 = 0.50%. Takes
            precedence over minAmountOut.
          schema:
            default: '500'
            example: '300'
            type: string
        - name: fee
          required: false
          in: query
          description: >-
            Fee in basis points (1/10000) for each amountIn value, e.g. 50 =
            0.50%. Must be in range 0-100. If specified, this percentage of each
            amountIn value will be sent to feeReceiver
          schema:
            example:
              - '100'
            type: array
            items:
              type: string
        - name: feeReceiver
          required: false
          in: query
          description: >-
            The Ethereum address that will receive the collected fee. Required
            if fee is provided
          schema:
            example: '0x220866B1A2219f40e72f5c628B65D54268cA3A9D'
            type: string
        - name: ignoreAggregators
          required: false
          in: query
          description: A list of swap aggregators to be ignored from consideration
          schema:
            nullable: true
            type: array
            items:
              type: string
              enum:
                - 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
        - name: ignoreStandards
          required: false
          in: query
          description: A list of standards to be ignored from consideration
          schema:
            nullable: true
            type: array
            items:
              type: string
        - name: ignoreBridges
          required: false
          in: query
          description: >-
            A list of bridges to be ignored from consideration for crosschain
            routes. Supported values: `relay`, `stargate`, `ccip`, `cctp`
          schema:
            nullable: true
            type: array
            items:
              type: string
              enum:
                - cctp
                - stargate
                - ccip
                - relay
        - name: referralCode
          required: false
          in: query
          description: Referral code that will be included in an on-chain event.
          schema:
            maxLength: 16
            example: 0123456789ABCDEF
            type: string
        - name: destinationChainId
          required: false
          in: query
          description: Chain ID of the network to bridge to and receive tokenOut
          schema:
            type: number
        - name: refundReceiver
          required: false
          in: query
          description: >-
            Ethereum address of the receiver of any dust tokens that might be
            produced during the execution of actions
          schema:
            example: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RouteShortcutTransaction'
        '400':
          description: ''
components:
  schemas:
    RouteShortcutTransaction:
      type: object
      properties:
        gas:
          type: string
        amountOut:
          type: string
        priceImpact:
          type: number
          nullable: true
          description: Price impact in basis points, null if USD price not found
        feeAmount:
          description: An array of the fee amount collected for each tokenIn
          type: array
          items:
            type: string
        minAmountOut:
          type: string
          description: The minimum allowable amount out after slippage
        createdAt:
          type: number
          description: Block number the transaction was created on
        tx:
          description: The tx object to use in `ethers`
          allOf:
            - $ref: '#/components/schemas/Transaction'
        route:
          description: The route the shortcut will use
          type: array
          items:
            $ref: '#/components/schemas/Hop'
        ensoFeeAmount:
          type: array
          items:
            type: string
      required:
        - gas
        - amountOut
        - priceImpact
        - feeAmount
        - minAmountOut
        - createdAt
        - tx
        - route
        - ensoFeeAmount
    Transaction:
      type: object
      properties:
        data:
          type: string
        to:
          type: string
        from:
          type: string
        value:
          type: string
      required:
        - data
        - to
        - from
        - value
    Hop:
      type: object
      properties:
        tokenIn:
          type: array
          items:
            type: string
        tokenOut:
          type: array
          items:
            type: string
        protocol:
          type: string
        action:
          type: string
          enum:
            - approve
            - borrow
            - borrowwithpositionid
            - bridge
            - deposit
            - singledeposit
            - singledepositwithpositionid
            - multideposit
            - tokenizedsingledeposit
            - tokenizedmultideposit
            - multioutsingledeposit
            - depositclmm
            - harvest
            - permittransferfrom
            - redeem
            - singleredeem
            - singleredeemwithpositionid
            - multiredeem
            - tokenizedsingleredeem
            - tokenizedmultiredeem
            - redeemclmm
            - repay
            - repaywithpositionid
            - swap
            - transfer
            - transferfrom
            - route
            - call
            - split
            - merge
            - balance
            - minamountout
            - slippage
            - fee
            - ensofee
            - paymasterfee
        primary:
          type: string
        internalRoutes:
          type: array
          items:
            type: string
        args:
          type: object
        chainId:
          type: number
        sourceChainId:
          type: number
        destinationChainId:
          type: number
      required:
        - tokenOut
        - protocol
        - internalRoutes
        - action
        - args
        - tokenIn
        - primary

````