POST
/
v1
/
route

Authorizations

X-Api-Key
string
header
required

Body

application/json
input_token
object
required
output_token
object
required
additional_data
object
input_amount
number

Input amount in tokens (not nano!) to be swapped

Required range: x > 0
max_length
integer
default:
3

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).

Required range: 2 < x < 5
max_splits
integer
default:
4

Defines the maximum number of independent paths (i.e., transactions) the route can split into. For v4 wallets, you can omit this or set it to 4; for v5 wallets, you can set it to 20 (this is our internal upper limit, and we may reduce it to 10).

Required range: 1 < x < 20
output_amount
number

If specified, the route will be built to get the specified output amount. If not specified, the route will be built to get the maximum output amount for the given input amount.

Required range: x > 0
pool_selector
object

Configures the DEX pools that can appear in the generated route. By setting blockchains = ["ton"] inside it, you can remove the dexes field; max_volatility allows you to exclude pools whose volatility has been above a certain percentage in the last 15 minutes. This makes sense when you allow 2-3 intermediate tokens or a large number of splits to smooth out potential issues.

Response

200 - application/json
input_amount
number
required
input_token
object
required
input_usd
number
required
output_amount
number
required
output_token
object
required
output_usd
number
required
paths
object[]
required
price_impact
number
required
estimated_cashback_usd
number
left_amount
number
savings
number