curl --request POST \
--url https://backend.swap.coffee/v1/route/multi \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"input_assets": [
{
"token": {
"blockchain": "ton",
"address": "native"
},
"amount": 1
}
],
"output_asset": {
"blockchain": "ton",
"address": "native"
},
"max_splits": 4,
"max_length": 3,
"pool_selector": {
"blockchains": [
"ton"
],
"dexes": [
"dedust"
],
"max_volatility": 1
},
"mev_protection": true,
"additional_data": {
"sender_address": "UQCNTO0Nh0Z7QNyRW1BLWfk08f2dAOw4izrx9sO6OUPg4DoV",
"referral_name": "tonkeeper"
}
}
'{
"routes": [
{
"input_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"input_amount": 123,
"output_amount": 123,
"input_usd": 123,
"output_usd": 123,
"recommended_gas": 123,
"price_impact": 123,
"paths": [
{
"blockchain": "ton",
"dex": "stonfi",
"pool_address": "<string>",
"input_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"swap": {
"result": "fully_fulfilled",
"input_amount": 123,
"output_amount": 123,
"before_reserves": [
123
],
"after_reserves": [
123
],
"reason": "<string>",
"left_amount": 123
},
"recommended_gas": 123,
"average_gas": 123,
"next": "<array>"
}
],
"savings": 123,
"left_amount": 123,
"estimated_cashback_usd": 123,
"partner_commission_ton": 123,
"mev_protection_fee": 123
}
],
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"total_output_amount": 123,
"total_savings": 123,
"total_estimated_cashback_usd": 123,
"total_partner_commission_ton": 123,
"total_mev_protection_fee": 123
}curl --request POST \
--url https://backend.swap.coffee/v1/route/multi \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"input_assets": [
{
"token": {
"blockchain": "ton",
"address": "native"
},
"amount": 1
}
],
"output_asset": {
"blockchain": "ton",
"address": "native"
},
"max_splits": 4,
"max_length": 3,
"pool_selector": {
"blockchains": [
"ton"
],
"dexes": [
"dedust"
],
"max_volatility": 1
},
"mev_protection": true,
"additional_data": {
"sender_address": "UQCNTO0Nh0Z7QNyRW1BLWfk08f2dAOw4izrx9sO6OUPg4DoV",
"referral_name": "tonkeeper"
}
}
'{
"routes": [
{
"input_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"input_amount": 123,
"output_amount": 123,
"input_usd": 123,
"output_usd": 123,
"recommended_gas": 123,
"price_impact": 123,
"paths": [
{
"blockchain": "ton",
"dex": "stonfi",
"pool_address": "<string>",
"input_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"swap": {
"result": "fully_fulfilled",
"input_amount": 123,
"output_amount": 123,
"before_reserves": [
123
],
"after_reserves": [
123
],
"reason": "<string>",
"left_amount": 123
},
"recommended_gas": 123,
"average_gas": 123,
"next": "<array>"
}
],
"savings": 123,
"left_amount": 123,
"estimated_cashback_usd": 123,
"partner_commission_ton": 123,
"mev_protection_fee": 123
}
],
"output_token": {
"address": {
"blockchain": "ton",
"address": "native"
},
"metadata": {
"name": "ARBUZ",
"symbol": "ARBUZ",
"decimals": 123,
"listed": true,
"verification": "whitelisted",
"image_url": "<string>"
}
},
"total_output_amount": 123,
"total_savings": 123,
"total_estimated_cashback_usd": 123,
"total_partner_commission_ton": 123,
"total_mev_protection_fee": 123
}Show child attributes
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.
1 <= x <= 50Defines 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).
2 <= x <= 5Configures 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.
Show child attributes
If specified, only pools from given blockchains will be used for routing
1If specified, only pools from given dexes will be used for routing
1If specified, only pools with volatility lower than given value will be used for routing
x >= 0Whether a MEV protection should be enabled
true
resulting route
Show child attributes
Show child attributes
Show child attributes
"ARBUZ"
"ARBUZ"
whitelisted, blacklisted, community, unknown Show child attributes
Show child attributes
"ARBUZ"
"ARBUZ"
whitelisted, blacklisted, community, unknown Show child attributes
"ton"
"stonfi"
Show child attributes
Show child attributes
"ARBUZ"
"ARBUZ"
whitelisted, blacklisted, community, unknown Show child attributes
Show child attributes
"ARBUZ"
"ARBUZ"
whitelisted, blacklisted, community, unknown Show child attributes
Result of the swap
fully_fulfilled, partially_fulfilled, unavailable Fees for the usage of MEV protection.
Show child attributes
Show child attributes
"ARBUZ"
"ARBUZ"
whitelisted, blacklisted, community, unknown Fees for the usage of MEV protection.