---
title: "Optimal route between two tokens"
method: POST
path: "/api/v1/shortcuts/route"
tags: ["DeFi Shortcuts"]
---

# Optimal route between two tokens

`POST /api/v1/shortcuts/route`

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 the GET&nbsp;`/shortcuts/route/nontokenized`.</Tip>

## Request body

- RouteShortcutVariableInputs
  - `chainId` number — Chain ID of the network to execute the transaction on
  - `fromAddress` string, required — Ethereum address of the wallet to send the transaction from
  - `amountIn` string[], required — Amount of tokenIn to swap in wei
  - `tokenIn` string[], required — Ethereum address of the token to swap from. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
  - `tokenOut` string[], required — Ethereum address of the token to swap to. For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
  - `routingStrategy` 'router' | 'delegate' | 'router-legacy' | 'delegate-legacy' | 'ensowallet', nullable — Routing strategy to use. In majority of cases you can use `router`. Use `delegate` with EOA when you want to specify a `spender`
  - `toEoa` boolean, nullable — Flag that indicates if gained tokenOut should be sent to EOA
  - `receiver` string — Ethereum address of the receiver of the tokenOut
  - `spender` string — Ethereum address of the spender of the tokenOut. **Note**: you must use the `delegate` strategy when specifying a spender, otherwise it will be ignored.
  - `minAmountOut` string[] — Minimum amount out in wei. If specified, `slippage` should not be specified
  - `slippage` string — Slippage in basis points (1/10000), e.g. 50 = 0.50%. Takes precedence over minAmountOut argument.
  - `fee` string[] — 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`
  - `feeReceiver` string — The Ethereum address that will receive the collected fee. Required if fee is provided
  - `ignoreAggregators` string[], nullable — A list of swap aggregators to be ignored from consideration
  - `ignoreStandards` string[], nullable — A list of standards to be ignored from consideration
  - `ignoreBridges` string[], nullable — A list of bridges to be ignored from consideration for crosschain routes. Supported values: `relay`, `stargate`, `ccip`, `cctp`
  - `variableEstimates` object, required
  - `referralCode` string — Referral code that will be included in an on-chain event.
  - `destinationChainId` number — Chain ID of the network to bridge to and receive tokenOut
  - `refundReceiver` string — Ethereum address of the receiver of any dust tokens that might be produced during the execution of actions

## Response `200`

- RouteShortcutTransaction
  - `gas` string, required
  - `amountOut` string, required
  - `priceImpact` number, nullable, required — Price impact in basis points, null if USD price not found
  - `feeAmount` string[], required — An array of the fee amount collected for each tokenIn
  - `minAmountOut` string, required — The minimum allowable amount out after slippage
  - `createdAt` number, required — Block number the transaction was created on
  - `tx` Transaction, required
    - `data` string, required
    - `to` string, required
    - `from` string, required
    - `value` string, required
  - `route` Hop[], required — The route the shortcut will use
    - `tokenIn` string[], required
    - `tokenOut` string[], required
    - `protocol` string, required
    - `action` string, required
    - `primary` string, required
    - `internalRoutes` string[], required
    - `args` object, required
    - `chainId` number
    - `sourceChainId` number
    - `destinationChainId` number
  - `ensoFeeAmount` string[], required

## Other responses

- `400`

---

[API](https://skmtc.dev/enso/apis/enso-api.md) · [All operations](https://skmtc.dev/enso/apis/enso-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/enso/enso-api/revisions/249f471fdafd/schema)
