Skip to main content
Version: V1

Examples

Input & output format on Ethereum#

Request url to swap 1 WETH -> DAI , by maximizing return and not include gas fee in the transaction:

https://aggregator-api.kyberswap.com/ethereum/route?tokenIn=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&tokenOut=0x6b175474e89094c44da98b954eedeac495271d0f&amountIn=1000000000000000000&saveGas=0&gasInclude=0

Response:

{
"inputAmount":"1000000000000000000",
"outputAmount":"4207648325067550956109",
"totalGas":630000,
"gasPriceGwei":"88.6558428",
"gasUsd":235.60777689282176,
"amountInUsd":4218.341244616171,
"amountOutUsd":4207.648325067551,
"receivedUsd":3972.0405481747293,
"swaps":[
[
{
"pool":"0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
"tokenIn":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"swapAmount":"850000000000000000",
"amountOut":"3577343564",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"uniswap",
"poolLength":2,
"poolType":"uni"
},
{
"pool":"0x306121f1344ac5f84760998484c0176d7bfb7134",
"tokenIn":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"tokenOut":"0xdac17f958d2ee523a2206206994597c13d831ec7",
"swapAmount":"3577343564",
"amountOut":"3577356980",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"dmm",
"poolLength":2,
"poolType":"dmm"
},
{
"pool":"0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",
"tokenIn":"0xdac17f958d2ee523a2206206994597c13d831ec7",
"tokenOut":"0x6b175474e89094c44da98b954eedeac495271d0f",
"swapAmount":"3577356980",
"amountOut":"3576508999844335706475",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"curve",
"poolLength":3,
"poolType":"curve-base"
}
],
[
{
"pool":"0x06da0fd433c1a5d7a4faa01111c044910a184553",
"tokenIn":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"tokenOut":"0xdac17f958d2ee523a2206206994597c13d831ec7",
"swapAmount":"150000000000000000",
"amountOut":"631288968",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"sushiswap",
"poolLength":2,
"poolType":"uni"
},
{
"pool":"0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",
"tokenIn":"0xdac17f958d2ee523a2206206994597c13d831ec7",
"tokenOut":"0x6b175474e89094c44da98b954eedeac495271d0f",
"swapAmount":"631288968",
"amountOut":"631139325223215249634",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"curve",
"poolLength":3,
"poolType":"curve-base"
}
]
],
"tokens":{
"0x6b175474e89094c44da98b954eedeac495271d0f":{
"address":"0x6b175474e89094c44da98b954eedeac495271d0f",
"symbol":"DAI",
"name":"Dai Stablecoin",
"price":1,
"decimals":18
},
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":{
"address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"symbol":"USDC",
"name":"USD Coin",
"price":1,
"decimals":6
},
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{
"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"symbol":"WETH",
"name":"Wrapped Ether",
"price":4218.341244616171,
"decimals":18
},
"0xdac17f958d2ee523a2206206994597c13d831ec7":{
"address":"0xdac17f958d2ee523a2206206994597c13d831ec7",
"symbol":"USDT",
"name":"Tether USD",
"price":1,
"decimals":6
}
}
}

Input & output format on Binance Chain (BSC)#

Request url to swap 100 BNB -> USDC , by maximizing return and include gas fee in the transaction and to search only for pancake:

https://aggregator-api.kyberswap.com/bsc/route?tokenIn=0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c&tokenOut=0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d&amountIn=100000000000000000000&saveGas=0&gasInclude=1&dexes=pancake

Response:

{
"inputAmount":"100000000000000000000",
"outputAmount":"48555365128252601806519",
"totalGas":425000,
"gasPriceGwei":"5",
"gasUsd":1.0381216266017324,
"amountInUsd":48852.782428316816,
"amountOutUsd":48555.365128252604,
"receivedUsd":48554.327006626,
"swaps":[
[
{
"pool":"0x58f876857a02d6762e0101bb5c46a8c1ed44dc16",
"tokenIn":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
"tokenOut":"0xe9e7cea3dedca5984780bafc599bd69add087d56",
"swapAmount":"90000000000000000000",
"amountOut":"43851418727559988673691",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"pancake",
"poolLength":2,
"poolType":"uni"
},
{
"pool":"0x2354ef4df11afacb85a5c7f98b624072eccddbb1",
"tokenIn":"0xe9e7cea3dedca5984780bafc599bd69add087d56",
"tokenOut":"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"swapAmount":"43851418727559988673691",
"amountOut":"43700760244678564848819",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"pancake",
"poolLength":2,
"poolType":"uni"
}
],
[
{
"pool":"0xd99c7f6c65857ac913a8f880a4cb84032ab2fc5b",
"tokenIn":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
"tokenOut":"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"swapAmount":"5000000000000000000",
"amountOut":"2428592640752141032757",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"pancake",
"poolLength":2,
"poolType":"uni"
}
],
[
{
"pool":"0x74e4716e431f45807dcf19f284c7aa99f18a4fbc",
"tokenIn":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
"tokenOut":"0x2170ed0880ac9a755fd29b2688956bd959f933f8",
"swapAmount":"5000000000000000000",
"amountOut":"576477595682008682",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"pancake",
"poolLength":2,
"poolType":"uni"
},
{
"pool":"0xea26b78255df2bbc31c1ebf60010d78670185bd0",
"tokenIn":"0x2170ed0880ac9a755fd29b2688956bd959f933f8",
"tokenOut":"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"swapAmount":"576477595682008682",
"amountOut":"2426012242821895924943",
"limitReturnAmount":"0",
"maxPrice":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"exchange":"pancake",
"poolLength":2,
"poolType":"uni"
}
]
],
"tokens":{
"0x2170ed0880ac9a755fd29b2688956bd959f933f8":{
"address":"0x2170ed0880ac9a755fd29b2688956bd959f933f8",
"symbol":"ETH",
"name":"Ethereum Token",
"price":4221.044653909727,
"decimals":18
},
"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d":{
"address":"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"symbol":"USDC",
"name":"Binance-Peg USD Coin",
"price":1,
"decimals":18
},
"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{
"address":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
"symbol":"WBNB",
"name":"Wrapped BNB",
"price":488.5278242831682,
"decimals":18
},
"0xe9e7cea3dedca5984780bafc599bd69add087d56":{
"address":"0xe9e7cea3dedca5984780bafc599bd69add087d56",
"symbol":"BUSD",
"name":"Binance USD",
"price":1,
"decimals":18
}
}
}

Input format on other chains#

request Url to swap 100 WMATIC to KNC:

https://aggregator-api.kyberswap.com/polygon/route?tokenIn=0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270&tokenOut=0x1C954E8fe737F99f68Fa1CCda3e51ebDB291948C&amountIn=100000000000000000000&saveGas=0&gasInclude=1

For Avalanche:

request Url to swap 10 AVAX to USDT:

https://aggregator-api.kyberswap.com/avalanche/route?tokenIn=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7&tokenOut=0xc7198437980c041c805A1EDcbA50c1Ce5db95118&amountIn=10000000000000000000&saveGas=0&gasInclude=1

For Fantom:

request Url to swap 100 WFTM to USDC:

https://aggregator-api.kyberswap.com/fantom/route?tokenIn=0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83&tokenOut=0x04068da6c83afcfa0e13ba15a6696662335d5b75&amountIn=100000000000000000000&saveGas=0&gasInclude=1

For Cronos:

request Url to swap 10 CRO to USDC:

https://aggregator-api.kyberswap.com/cronos/route?tokenIn=0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23&tokenOut=0xc21223249ca28397b4b6541dffaecc539bff0c59&amountIn=10000000000000000000&saveGas=0&gasInclude=1&dexes=vvs