v4

latestOpenAPI 3.0.32026-08-07129194194.6 KB
Routing

Returns the best route for the given list of input tokens and output token

post/v1/route/multi

Request body

max_splitsinteger

Defines the maximum number of independent paths (i.e., transactions) . For v4 wallets, you can omit this or set it to 4; for v5 wallets, you can set it to 100 (this is our internal upper limit, and we may reduce it later). No more than 20 splits will be used for single input_asset.

max_lengthinteger

Defines the maximum length of each path in tokens. It accepts values from [2; 5]. If it's 2, only direct swaps A -> B without multihops are possible. If it's 3, there can be a maximum of 1 intermediate token, i.e., A -> X -> B. If it's 4/5, there can be 2/3 intermediate tokens. A value of 2 deprives you of more profitable exchanges by finding market inefficiencies and does not allow you to exchange tokens without a direct pair (since there can be no intermediate tokens). The higher the value, the more profitable routes can be built, but the higher the likelihood that the user ends up with an intermediate token (since our blockchain is asynchronous, and some swap in the middle of the route may fail due to slippage).

mev_protectionboolean

Whether a MEV protection should be enabled

Example request

{
  "input_assets": [
    {
      "token": {
        "blockchain": "ton",
        "address": "native"
      }
    }
  ],
  "output_asset": {
    "blockchain": "ton",
    "address": "native"
  },
  "pool_selector": {
    "blockchains": [
      "ton"
    ],
    "dexes": [
      "dedust"
    ]
  },
  "mev_protection": true,
  "additional_data": {
    "sender_address": "UQCNTO0Nh0Z7QNyRW1BLWfk08f2dAOw4izrx9sO6OUPg4DoV",
    "referral_name": "tonkeeper"
  }
}

Response

resulting route

total_output_amountnumber double required
total_savingsnumber double
total_estimated_cashback_usdnumber double
total_partner_commission_tonnumber double
total_mev_protection_feenumber double

Fees for the usage of MEV protection.