Skip to main content

FAQ for Developers

Is it possible to specify the function we want to use with the 1inch API?
Unfortunately this is not possible at this time. The most you can do is use the compatibility mode parameter to force the API to use the swap function. This is the least gas efficient function but is sometimes required when trading tokens with a commission/tax on trade or transfer along with consistency when integrating with a smart contract.

Is it possible to get the result of all paths like the comparison chart on app.1inch.io?
This is not returned by the API, instead you would need to individually quote these sources yourself.

I’m trying to use the 1inch router in a smart contract, is there an example?
Yes, you can find an example here. If you need more help please reach out to https://discord.com/invite/1inch.

I’m trying to use the 1inch router without the API, is this possible?
This is possible but not recommended. The functions "unoswap", "uniswapV3Swap", "fillOrderTo" and "clipperSwap" can all be used without the API but require proper bit masking and encoding. You would also lose the power of the aggregation protocol if you're using such functions. It's recommended to use the API in almost all cases.

Why am I getting 0 for the gas in my API response?
This could be happening if you're using the "disableEstimate" parameter with true assigned to it. This will disable the gas estimation and return 0 for the gas.

What token address should I use if I want to trade ETH?
Use the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, this applies to the native asset of the chain, so MATIC on polygon, BNB on BNB chain, AVAX on Avalanche, etc.

How can I use Request for Quotation (RFQ) orders?
RFQ order are intended for market makers and can't be submitted by users to the limit order API. They can be used to offer private OTC deals in a gas efficient manner.

How can I get integrated into your aggregator?
Please reach out via this form: https://docs.google.com/forms/d/e/1FAIpQLScPbwZ3uVekqXTEoR7wmcCMCn9XkIBta26aaOyYoAsqlswcxQ/viewform?hl=en

What are 500 internal server errors? (tx-gateway, aggregation API, limit order API)
500 errors can happen for a multitude of reasons, most commonly due to an incorrectly formatted request parameter. Make sure you're using the amount field in the token's minimum divisible units, for ETH it's wei. Some other reasons might be random errors with the API or the underlying protocols being aggregated. If you're getting 500 errors consistently, please reach out to us on https://discord.com/invite/1inch.

What is the rate limit?
The rate limit varies based on the load of the API, but generally it's 30 request per minute. This is across all public endpoints and not specific to each endpoint. To purchase an enterprise rate limit, please send an email to api@1inch.io with as many details as possible about your project name, size, and usage requirements.

Why is the value field 0 in the API response?
The value field is the amount of ETH sent with the transaction to the 1inch router, when trading tokens this should always be 0. When you're trading ETH, the value field will reflect the amount of ETH sent to the 1inch router.

Is there a simple swap UI that I can embed in my website?
Currently there is no swap widget that is maintained, but you can use the API to build your own.

If I don't have the user's private key, how do I send the transaction if the example requires a private key?
Here is a simple guide provided by metamask to sign and send transactions without the user's private key: https://docs.metamask.io/wallet/how-to/send-transactions#example

How can I get the gas price for a transaction?
You can use a gas oracle like https://www.blocknative.com/gas-estimator for the gas price. For the gas limit you must use the eth_estimateGas rpc call. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas

How can I find the contract address being used in the route?
Currently this is not possible with the consumer api, it will only provide the protocol and the from and to token address used in the part.