connectorTokens
can be used{"fromToken": {"symbol": "string","name": "string","address": "string","decimals": 0,"logoURI": "string"},"toToken": {"symbol": "string","name": "string","address": "string","decimals": 0,"logoURI": "string"},"toTokenAmount": "string", // result amount of toToken in minimal divisible units"fromTokenAmount": "string", // input amount of fromToken in minimal divisible units"protocols": [ // route{"name": "string","part": 0,"fromTokenAddress": "string","toTokenAddress": "string"}],"estimatedGas": 0 // rough estimated amount of gas limit for used protocols}
Parametr Name | Type | Description |
| string | contract address of a token to sell e.g.: |
| string | contract address of a token to buy e.g.: |
| integer | amount of a token to sell, set in minimal divisible units e.g.:
|
| number | this percentage of
example to set a fee to 1.5%: |
| string | specify liquidity protocols to use. If not set, all liquidity protocols will be used e.g.: |
| string | 1inch takes in account gas expenses to determine exchange route. It is important to use the same gas price on the quote and swap methods gas price set in wei: default: "fast" from the network |
| string | maximum number of token-connectors to be used in a transaction. The more is used — the longer route estimation will take, the more complex route might be as a result. If not set, two token-connectors might be used
|
| string | token-connectors can be specified via this parameter. The more is set — the longer route estimation will take. If not set, default token-connectors will be used. If token you want to exchange doesn't have a pool with one of the default token-connectors, this parameter will help find the route; should be the same for a quote and swap e.g.:
|
| integer | maximum amount of gas for a swap; should be the same for a quote and swap
|
| integer | limit maximum number of main route parts; should be the same for a quote and swap
|
| integer | limit maximum number of parts each main route part can be split into; should be the same for a quote and swap
|
Parameter Name | Description |
| parameters of a token to sell |
| parameters of a token to buy |
| input amount of |
| result amount of |
| route of the trade |
| rough estimated amount of the gas limit for used protocols; do not use |
estimatedGas
should not be used from the quote method.
Request url to quote 10 000 USDT → WBTC
https://api.1inch.exchange/v2.0/quote?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&amount=10000000000
curl
curl -X GET "https://api.1inch.exchange/v2.0/quote?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&amount=10000000000" -H "accept: application/json"
{"fromToken": {"symbol": "USDT","name": "Tether USD","address": "0xdac17f958d2ee523a2206206994597c13d831ec7","decimals": 6,"logoURI": "https://tokens.1inch.exchange/0xdac17f958d2ee523a2206206994597c13d831ec7.png"},"toToken": {"symbol": "WBTC","name": "Wrapped BTC","address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","decimals": 8,"logoURI": "https://tokens.1inch.exchange/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.png"},"toTokenAmount": "53797189", // result amount of WBTC (0.538 WBTC)"fromTokenAmount": "10000000000","protocols": [[[{"name": "CURVE","part": 100,"fromTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7","toTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"}],[{"name": "SUSHI","part": 100,"fromTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f","toTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}],[{"name": "BALANCER","part": 100,"fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","toTokenAddress": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"}]]],"estimatedGas": 590385 // do not use gas limit from the quote method}
access-control-allow-origin: *cache-control: public,max-age=3,s-maxage=3cf-cache-status: EXPIREDcf-ray: 5f64ac3deca8dc07-LHRcf-request-id: 0692c9fab50000dc073b3cc000000001content-encoding: gzipcontent-type: application/json; charset=utf-8date: Sun,22 Nov 2020 18:21:55 GMTetag: W/"3d6-em7tiBuMKdKrCDzTlDGNi/H9Edk"expect-ct: max-age=604800,report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"server: cloudflarestatus: 200vary: Origin,Accept-Encodingx-powered-by: Express
Test your request in web interface: https://api.1inch.exchange/v2.0/swagger/#/Quote%2FSwap/swap
fromAddress
to compensate gasconnectorTokens
can be used{"fromToken": {"symbol": "string","name": "string","address": "string","decimals": 0,"logoURI": "string"},"toToken": {"symbol": "string","name": "string","address": "string","decimals": 0,"logoURI": "string"},"toTokenAmount": "string", // result amount of toToken in minimal divisible units"fromTokenAmount": "string", // input amount of fromToken in minimal divisible units"protocols": [ // route{"name": "string","part": 0,"fromTokenAddress": "string","toTokenAddress": "string"}],"tx": {"from": "string","to": "string","data": "string", // call data"value": "string", // amount of eth (in wei) will be sent to the contract address"gasPrice": "string","gas": 0 // rough estimate, increase gas value by ~25%}}
Parametr Name | Type | Description |
| string | contract address of a token to sell e.g.: |
| string | contract address of a token to buy e.g.: |
| integer | amount of a token to sell, set in minimal divisible units e.g.:
|
| string | address of a seller, make sure that this address has approved to spend e.g.: |
| number | limit of price slippage you are willing to accept in percentage, may be set with decimals. |
| string | specify liquidity protocols. If not set, all liquidity protocols will be used; you can disable any protocol by listing all protocols except those you don't need e.g.: |
| string | recipient address of a purchased token
if not set, |
| string | referrer's address |
| number | this percentage of
example to set a fee to 1.5%: |
| string | 1inch takes in account gas expenses to determine exchange route. It is important to use the same gas price on the quote and swap methods. Gas price set in wei: default: "fast" from network |
| boolean | If true, CHI will be burned from |
| string | maximum number of token-connectors to be used in a transaction. The more is used — the longer route estimation will take, the more complex route might be as a result. If not set, two token-connectors may be used
|
| string | token-connectors can be specified via this parameter. The more is set — the longer route estimation will take. If not set, default token-connectors will be used. If a token you want to exchange doesn't have a pool with one of the default token-connectors this parameter will help find the route;
should be the same for a quote and swap e.g.:
|
| boolean | if true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped tokens will return to the |
| boolean | if true, disable most of the checks |
| integer | maximum amount of gas for a swap; should be the same for a quote and swap
|
| integer | limit maximum number of main route parts; should be the same for a quote and swap
|
| integer | limit maximum number of parts each main route parts can be split into; should be the same for a quote and swap
|
Parameter Name | Description |
| parameters of a token to sell |
| parameters of a token to buy |
| input amount of |
| result amount of |
| route of the trade |
| transactions will be sent from this address |
| transactions will be sent to our contract address |
| call data |
| amount of ETH (in wei) will be sent to the contract address |
| gas price in wei |
| estimated amount of the gas limit, increase this value by 25% |
Request url to swap 100 ETH → DAI
https://api.1inch.exchange/v2.0/swap?fromTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=100000000000000000000&fromAddress=0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5&slippage=1
cur
curl -X GET "https://api.1inch.exchange/v2.0/swap?fromTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=100000000000000000000&fromAddress=0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5&slippage=1" -H "accept: application/json"
{{"fromToken": {"symbol": "ETH","name": "Ethereum","decimals": 18,"address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","logoURI": "https://tokens.1inch.exchange/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png"},"toToken": {"symbol": "DAI","name": "Dai Stablecoin","decimals": 18,"address": "0x6b175474e89094c44da98b954eedeac495271d0f","logoURI": "https://tokens.1inch.exchange/0x6b175474e89094c44da98b954eedeac495271d0f.png"},"toTokenAmount": "51231376107994948308048","fromTokenAmount": "100000000000000000000","protocols": [[[{"name": "Mooniswap","part": 100,"fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"}]],[[{"name": "WETH","part": 100,"fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}],[{"name": "BALANCER","part": 10,"fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","toTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"}, {"name": "SUSHI","part": 45,"fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","toTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"}, {"name": "UNISWAP_V2","part": 45,"fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","toTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"}]]],"tx": {"from": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5","to": "0x111111125434b319222cdbf8c261674adb56f3ae", // our contract address"data": "0x90411a32000000000000000000000000e4e8f73096301b0938b896a79521088633b85b75000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000e4e8f73096301b0938b896a79521088633b85b7500000000000000000000000052bc44d5378309ee2abf1539bf71de1b7d7be3b50000000000000000000000000000000000000000000000056bc75e2d63100000000000000000000000000000000000000000000000000abd7c629368f674b007000000000000000000000000000000000000000000000ad9422aaec1f1300c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000005c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000de00000000000000000000000000000000000000000000000000000000000001020000000000000000000000000000000000000000000000000000000000000118000000000000000000000000000000000000000000000000000000000000014a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001e4b3af37c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000019000000000000000000000000075116bd1ab4b0065b44e1a4ea9b4180a171406ed00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4d5bcb9b500000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000068a17b587caf4f9329f0e372e3a78d23a46de6b5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000144b3af37c000000000000000000000000000000000000000000000000000000000000000804000000000000000000000000000000000000000000000000000000000000004000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000017c0000000000000000000000000000017c000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004d0e30db00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003c483f1291f00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000360000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000020000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064eb5625d9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000007afe74ae3c19f070c109a38c286684256adc656c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000007afe74ae3c19f070c109a38c286684256adc656c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a48201aa3f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000004480000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000184b3af37c000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000024000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000900000000000000000000000000000012000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000c3d03e4f041fd4cd388c549ee2a29a9e5075882f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004fee327b14fcbe18e19cd459f57f194c6ebf14de00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4c9f12e9d000000000000000000000000c3d03e4f041fd4cd388c549ee2a29a9e5075882f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000003e4e8f73096301b0938b896a79521088633b85b7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000184b3af37c000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000024000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000900000000000000000000000000000009000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000a478c2975ab1ea89e8196811f51a7b7ade33eb11000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004fee327b14fcbe18e19cd459f57f194c6ebf14de00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4c9f12e9d000000000000000000000000a478c2975ab1ea89e8196811f51a7b7ade33eb11000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000003e4e8f73096301b0938b896a79521088633b85b75000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002647f8fe7a000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000044000000000000000000000000b4d21fb062f43424c001485bb79a698320ec7d1400000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000b4d21fb062f43424c001485bb79a698320ec7d1400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4059712240000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000100000000000000000000000000000000000000000000000045637a1297c8a3d200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004470bdb9470000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000ad9422aaec1f1300c50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000184b3af37c0000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000000000000000000000000000240000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000001000000000000000000000000000000010000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000052bc44d5378309ee2abf1539bf71de1b7d7be3b500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","value": "100000000000000000000", // 100 eth"gasPrice": "23000000000", // 23 gwei"gas": 557035 // increase this amount by 25%}}
access-control-allow-origin: *cache-control: public,max-age=3,s-maxage=3cf-cache-status: EXPIREDcf-ray: 5f7159e3bbe9073a-LHRcf-request-id: 069ab682510000073afe168000000001content-encoding: gzipcontent-type: application/json; charset=utf-8date: Tue,24 Nov 2020 07:17:36 GMTetag: W/"1541-tAyUSdeb29On/WsaUSPZLc9U7wI"expect-ct: max-age=604800,report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"server: cloudflarevary: Origin,Accept-Encodingx-powered-by: Express
Test your request in web interface: https://api.1inch.exchange/v2.0/swagger/#/Quote%2FSwap/swap
Symbol | Contract address |
ETH | 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee |
WETH | 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 |
DAI | 0x6b175474e89094c44da98b954eedeac495271d0f |
USDC | 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 |
USDT | 0xdac17f958d2ee523a2206206994597c13d831ec7 |
WBTC | 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599 |
VALUE | 0x49e833337ece7afe375e44f4e3e8481029218e5c |
BNT | 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c |