{"openapi":"3.0.0","paths":{"/v6.1/8453/quote":{"get":{"operationId":"AggregationController_getQuote_v6.1","parameters":[{"name":"src","required":true,"in":"query","schema":{"example":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","type":"string"}},{"name":"dst","required":true,"in":"query","schema":{"example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb","type":"string"}},{"name":"amount","required":true,"in":"query","schema":{"example":"10000000000000000","type":"string"}},{"name":"protocols","required":false,"in":"query","description":"All supported liquidity sources by default","schema":{"type":"string"}},{"name":"fee","required":false,"in":"query","description":"Partner fee in percent. min: 0; max: 3 Should be the same for /quote and /swap","schema":{"minimum":0,"maximum":3,"type":"number"}},{"name":"gasPrice","required":false,"in":"query","description":"Network price per gas in wei. By default fast network gas price","schema":{"type":"string"}},{"name":"complexityLevel","required":false,"in":"query","schema":{"minimum":0,"maximum":2,"type":"number"}},{"name":"parts","required":false,"in":"query","schema":{"minimum":0,"maximum":50,"type":"number"}},{"name":"mainRouteParts","required":false,"in":"query","schema":{"minimum":0,"maximum":10,"type":"number"}},{"name":"gasLimit","required":false,"in":"query","schema":{"minimum":100000,"maximum":11500000,"type":"number"}},{"name":"includeTokensInfo","required":false,"in":"query","description":"Return fromToken and toToken info in response","schema":{"type":"boolean"}},{"name":"includeProtocols","required":false,"in":"query","description":"Return used swap protocols in response","schema":{"type":"boolean"}},{"name":"includeGas","required":false,"in":"query","description":"Return approximated gas in response","schema":{"type":"boolean"}},{"name":"connectorTokens","required":false,"in":"query","schema":{"minimum":0,"maximum":5,"type":"string"}},{"name":"excludedProtocols","required":false,"in":"query","description":"excluded supported liquidity sources","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteRequestError"}}}}},"summary":"Find the best quote to swap with 1inch Router","tags":["Swap"]}},"/v6.1/8453/swap":{"get":{"operationId":"AggregationController_getSwap_v6.1","parameters":[{"name":"src","required":true,"in":"query","schema":{"example":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","type":"string"}},{"name":"dst","required":true,"in":"query","schema":{"example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb","type":"string"}},{"name":"amount","required":true,"in":"query","schema":{"example":"10000000000000000","type":"string"}},{"name":"from","required":true,"in":"query","description":"The address that calls the 1inch contract","schema":{"type":"string"}},{"name":"origin","required":true,"in":"query","description":"An EOA address that initiate the transaction","schema":{"type":"string"}},{"name":"protocols","required":false,"in":"query","description":"All supported liquidity sources by default","schema":{"type":"string"}},{"name":"fee","required":false,"in":"query","description":"Partner fee in percent. min: 0; max: 3 Should be the same for /quote and /swap","schema":{"minimum":0,"maximum":3,"type":"number"}},{"name":"gasPrice","required":false,"in":"query","description":"Network price per gas in wei. By default fast network gas price","schema":{"type":"string"}},{"name":"complexityLevel","required":false,"in":"query","schema":{"minimum":0,"maximum":2,"type":"number"}},{"name":"parts","required":false,"in":"query","schema":{"minimum":0,"maximum":50,"type":"number"}},{"name":"mainRouteParts","required":false,"in":"query","schema":{"minimum":0,"maximum":10,"type":"number"}},{"name":"gasLimit","required":false,"in":"query","schema":{"minimum":100000,"maximum":11500000,"type":"number"}},{"name":"includeTokensInfo","required":false,"in":"query","description":"Return fromToken and toToken info in response","schema":{"type":"boolean"}},{"name":"includeProtocols","required":false,"in":"query","description":"Return used swap protocols in response","schema":{"type":"boolean"}},{"name":"includeGas","required":false,"in":"query","description":"Return approximated gas in response","schema":{"type":"boolean"}},{"name":"connectorTokens","required":false,"in":"query","schema":{"minimum":0,"maximum":5,"type":"string"}},{"name":"excludedProtocols","required":false,"in":"query","description":"excluded supported liquidity sources","schema":{"type":"string"}},{"name":"slippage","required":false,"in":"query","description":"Slippage tolerance in percent. Min: 0; Max: 50.\nUse either slippage or minReturn, not both.\n\nAdvantages of slippage:\n- minReturn is calculated relative to the actual rate\n- For tokens with fee-on-transfer, re-estimation occurs and slippage is applied to the actual amount\n- Allows path re-routing if initial estimation fails\n\nDisadvantages of slippage:\n- The /swap result needs verification - check how much slippage the user agrees to accept\n\nExample: slippage=1 means accepting up to 1% less than the expected amount.","schema":{"minimum":0,"maximum":50,"example":1,"type":"number"}},{"name":"minReturn","required":false,"in":"query","description":"Minimum amount of destination token that must be received, in the smallest unit (considering decimals).\nUse either minReturn or slippage, not both.\n\nAdvantages of minReturn:\n- Result guaranteed to not be lower than this amount\n\nDisadvantages of minReturn:\n- If rate changes between /quote and /swap requests, you'll get an error\n- Must be calculated manually relative to quote.dstAmount minus desired slippage percentage\n- Must be manually selected for fee-on-transfer tokens\n- Path won't be re-estimated if estimation fails\n- Requires precise calculation and understanding of the value being set\n\nExample: For a token with 18 decimals, minReturn=1000000000000000000 requires at least 1 token.","schema":{"example":"1000000000000000000","type":"string"}},{"name":"permit","required":false,"in":"query","description":"https://eips.ethereum.org/EIPS/eip-2612","schema":{"type":"string"}},{"name":"receiver","required":false,"in":"query","description":"This address will receive funds after the swap. By default same address as \"from\" param","schema":{"type":"string"}},{"name":"referrer","required":false,"in":"query","schema":{"type":"string"}},{"name":"allowPartialFill","required":false,"in":"query","description":"By default set to false","schema":{"type":"boolean"}},{"name":"compatibility","required":false,"in":"query","description":"Allows to swap tokens with internal transfer fee","schema":{"type":"boolean"}},{"name":"disableEstimate","required":false,"in":"query","description":"Enable this flag to disable onchain simulation","schema":{"type":"boolean"}},{"name":"usePatching","required":false,"in":"query","description":"Enable this flag if you patch input amount on your smart contract","schema":{"type":"boolean"}},{"name":"usePermit2","required":false,"in":"query","description":"Enable this flag in case you did an approval to permit2 smart contract","schema":{"type":"boolean"}},{"name":"forceApprove","required":false,"in":"query","description":"When enabled, the approval check during simulation will be skipped","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapRequestError"}}}}},"summary":"Generate calldata to swap on 1inch Router","tags":["Swap"]}},"/v6.1/8453/approve/spender":{"get":{"operationId":"ApproveController_getSpender_v6.1","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpenderResponse"}}}}},"summary":"Address of the 1inch Router that is trusted to spend funds for the swap","tags":["Approve"]}},"/v6.1/8453/approve/transaction":{"get":{"operationId":"ApproveController_getCallData_v6.1","parameters":[{"name":"tokenAddress","required":true,"in":"query","description":"Token address you want to swap","schema":{"example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb","type":"string"}},{"name":"amount","required":false,"in":"query","description":"The number of tokens that the 1inch Router is allowed to swap.If not specified, it will be allowed to spend an infinite amount of tokens.","schema":{"example":"100000000000","type":"string"}}],"responses":{"200":{"description":"Transaction body to allow the exchange with the 1inch Router","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveCallDataResponse"}}}}},"summary":"Generate approve calldata to allow 1inch Router to perform a swap","tags":["Approve"]}},"/v6.1/8453/approve/allowance":{"get":{"operationId":"ApproveController_getAllowance_v6.1","parameters":[{"name":"tokenAddress","required":true,"in":"query","description":"Token address you want to swap","schema":{"example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb","type":"string"}},{"name":"walletAddress","required":true,"in":"query","description":"Wallet address for which you want to check","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllowanceResponse"}}}}},"summary":"Get the number of tokens that the 1inch Router is allowed to swap","tags":["Approve"]}},"/v6.1/8453/liquidity-sources":{"get":{"operationId":"ProtocolsController_getProtocolsImages_v6.1","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProtocolsResponse"}}}}},"summary":"List of liquidity sources that are available for routing in the 1inch Aggregation Protocol","tags":["Info"]}},"/v6.1/8453/tokens":{"get":{"operationId":"TokensController_getTokens_v6.1","parameters":[],"responses":{"200":{"description":"All supported tokens (can also use your own)","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"object","properties":{"0x111111111117dc0aa78b770fa6a738034120c302":{"$ref":"#/components/schemas/TokenInfo"}}}}}}}}},"summary":"List of tokens that are available for swap in the 1inch Aggregation protocol","tags":["Info"]}}},"info":{"title":"1inch Swap API","description":"\n<h2>base Network</h2>\nUsing 1inch Swap API, you can find the best route to exchange assets and make the exchange.\n<br><br>\n<h3>Step by step:</h3>\n1. Lookup addresses of tokens you want to swap, for example ‘0xxx’ , ‘0xxxx’ for DAI -> 1INCH\n2. Check for allowance of 1inch router contract to spend source asset (/approve/allowance)\n3. If necessary, give approval for 1inch router to spend source token (/approve/transaction)\n4. Monitor the best exchange route using (/quote)\n5. When you ready use to perform swap (/swap)","version":"6.1","contact":{}},"tags":[],"servers":[],"components":{"schemas":{"TokenInfo":{"type":"object","properties":{"address":{"type":"string","example":"0x111111111117dc0aa78b770fa6a738034120c302"},"symbol":{"type":"string","example":"1INCH"},"name":{"type":"string","example":"1INCH Token"},"decimals":{"type":"number","example":18},"logoURI":{"type":"string","example":"https://tokens.1inch.io/0x111111111117dc0aa78b770fa6a738034120c302.png"},"domainVersion":{"type":"string"},"eip2612":{"type":"boolean","example":true},"isFoT":{"type":"boolean","example":false},"tags":{"example":["tokens"],"type":"array","items":{"type":"string"}}},"required":["address","symbol","name","decimals","logoURI"]},"QuoteResponse":{"type":"object","properties":{"srcToken":{"description":"Source token info","allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"dstToken":{"description":"Destination token info","allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"dstAmount":{"type":"string","description":"Expected amount of destination token","example":"62131879850006790961"},"protocols":{"type":"array","description":"Selected protocols in a path","items":{"$ref":"#/components/schemas/TokenSwaps"}},"gas":{"type":"number","description":"Estimated gas","example":100000}},"required":["dstAmount"]},"HttpExceptionMeta":{"type":"object","properties":{"type":{"type":"string"},"value":{"type":"string"}},"required":["type","value"]},"QuoteRequestError":{"type":"object","properties":{"error":{"type":"string","description":"Error code description","example":"Bad Request"},"description":{"type":"string","description":"Error description","example":"insufficient liquidity"},"statusCode":{"type":"number","description":"HTTP code","enum":[400,500],"example":400},"requestId":{"type":"string","description":"Request id","example":"2a92c18a-5c20-4f0d-a0da-e8b5b3602ad6"},"meta":{"description":"Meta information","type":"array","items":{"$ref":"#/components/schemas/HttpExceptionMeta"}}},"required":["error","description","statusCode","requestId","meta"]},"TransactionData":{"type":"object","properties":{"from":{"type":"string","example":"0x1111111111111111111111111111111111111111"},"to":{"type":"string","example":"0x1111111254eeb25477b68fb85ed929f73a960582"},"data":{"type":"string","example":"0x0502b1c50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000003556e53186804ca3e0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000180000000000000003b6d034026aad2da94c59524ac0d93f6d6cbf9071d7086f2"},"value":{"type":"string","example":"10000000000000000"},"gasPrice":{"type":"string","example":"6994090150"},"gas":{"type":"number","example":121363}},"required":["from","to","data","value","gasPrice","gas"]},"SwapResponse":{"type":"object","properties":{"srcToken":{"description":"Source token info","allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"dstToken":{"description":"Destination token info","allOf":[{"$ref":"#/components/schemas/TokenInfo"}]},"dstAmount":{"type":"string","description":"Expected amount of destination token","example":"62131879850006790961"},"protocols":{"type":"array","description":"Selected protocols in a path","items":{"$ref":"#/components/schemas/TokenSwaps"}},"tx":{"description":"Transaction object","allOf":[{"$ref":"#/components/schemas/TransactionData"}]}},"required":["dstAmount","tx"]},"SwapRequestError":{"type":"object","properties":{"error":{"type":"string","description":"Error code description","example":"Bad Request"},"description":{"type":"string","description":"Error description","example":"cannot estimate"},"statusCode":{"type":"number","description":"HTTP code","enum":[400,500],"example":400},"requestId":{"type":"string","description":"Request id","example":"2a92c18a-5c20-4f0d-a0da-e8b5b3602ad6"},"meta":{"description":"Meta information","type":"array","items":{"$ref":"#/components/schemas/HttpExceptionMeta"}}},"required":["error","description","statusCode","requestId","meta"]},"SpenderResponse":{"type":"object","properties":{"address":{"type":"string","description":"Address of the 1inch Router that is trusted to spend funds for the swap","example":"0x1111111254eeb25477b68fb85ed929f73a960582"}},"required":["address"]},"ApproveCallDataResponse":{"type":"object","properties":{"data":{"type":"string","description":"The encoded data to call the approve method on the swapped token contract","example":"0x095ea7b30000000000000000000000001111111254eeb25477b68fb85ed929f73a960582ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},"gasPrice":{"type":"string","description":"Network high gas price in wei","example":"1000000000"},"to":{"type":"string","description":"Token address that will be allowed to exchange through 1inch Router","example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb"},"value":{"type":"string","description":"Native token value in wei (for approve is always 0)","example":"0"}},"required":["data","gasPrice","to","value"]},"AllowanceResponse":{"type":"object","properties":{"allowance":{"type":"string","description":"Allowance amount","example":"115792089237316195423570985008687907853269984665640564039457584007913129639935"}},"required":["allowance"]},"ProtocolImage":{"type":"object","properties":{"id":{"type":"string","description":"Protocol id"},"title":{"type":"string","description":"Protocol title"},"img":{"type":"string","description":"Protocol logo image"},"img_color":{"type":"string","description":"Protocol logo image in color"}},"required":["id","title","img","img_color"]},"ProtocolsResponse":{"type":"object","properties":{"protocols":{"description":"List of protocols that are available for routing in the 1inch Aggregation Protocol","type":"array","items":{"$ref":"#/components/schemas/ProtocolImage"}}},"required":["protocols"]},"SelectedProtocol":{"type":"object","properties":{"name":{"type":"string","description":"Protocol id","example":"UNISWAP_V3"},"part":{"type":"number","description":"Protocol share","example":100},"fromTokenAddress":{"type":"string","description":"Source token to swap on protocol","example":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},"toTokenAddress":{"type":"string","description":"Destination token to swap on protocol","example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb"}},"required":["name","part","fromTokenAddress","toTokenAddress"]},"TokenSwaps":{"type":"object","properties":{"token":{"type":"string","description":"Source token address for the hops","example":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},"hops":{"type":"array","description":"Swap hops from source token","items":{"$ref":"#/components/schemas/TokenHop"}}},"required":["token","hops"]},"TokenHop":{"type":"object","properties":{"part":{"type":"number","description":"The distribution percent from source token coming to destination token on this hop","example":100},"dst":{"type":"string","description":"Destination token address","example":"0x50c5725949a6f0c72e6c4a641f24049a917db0cb"},"fromTokenId":{"type":"number","description":"Source token index in the path","example":0},"toTokenId":{"type":"number","description":"Destination token index in the path","example":1},"protocols":{"type":"array","description":"The token split among different liquidity sources","items":{"$ref":"#/components/schemas/SelectedLiquiditySource"}}},"required":["part","dst","fromTokenId","toTokenId","protocols"]},"SelectedLiquiditySource":{"type":"object","properties":{"name":{"type":"string","description":"The liquidity source id","example":"UNISWAP_V3"},"part":{"type":"number","description":"The distribution percent from total amount coming to specified destination token","example":100}},"required":["name","part"]}}}}