const response= await fetch(https://api.0x.org/swap/v1/quote?sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=0x6b175474e89094c44da98b954eedeac495271d0f&sellAmount=100&takerAddress=0xcb976099df1484c87b96685879571749cc007197, { method: "GET", headers: [ ["0x-api-key","6b321e0f-8d29-45de-ac49-ef0726c2b4cc"] ], });

code: 111, reason: 'Gas estimation failed'. Could you please help ?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented May 12, 2023 at 13:07

2 Answers 2


The error message suggests that the gas estimation for the transaction failed. This can happen when the smart contract that you are interacting with requires a specific amount of gas to execute the transaction, but the gas limit provided is not enough to complete the transaction.

To resolve this issue, you can try increasing the gas limit for the transaction. You can do this by adding a gasLimit parameter to your transaction object. For example:

const response = await fetch('https://api.0x.org/swap/v1/quote?sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=0x6b175474e89094c44da98b954eedeac495271d0f&sellAmount=100&takerAddress=0xcb976099df1484c87b96685879571749cc007197', {
  method: 'GET',
  headers: [
    ['0x-api-key', '6b321e0f-8d29-45de-ac49-ef0726c2b4cc']
  gasLimit: '500000'

You may need to experiment with different gas limit values to find the one that works for your specific transaction. Also, you should make sure that the takerAddress parameter is a valid Ethereum address that has sufficient funds to cover the transaction costs.


Thank you for your kind Mr. Kelvin Chelenje.

After two days, I discovered that 0xapi had been updated and no longer requires adding "&takerAddress" at the end.

const response = await fetch(https://**goerli**.api.0x.org/swap/v1/quote?sellToken=${sellToken}&buyToken=${buyToken}&sellAmount=${sellAmount}

And when executed, it will... and it's quite strange that 0.01 ETH will result in an error while 0.1 ETH will be successful.

const receipt = await web3.eth.sendTransaction({...swapQuoteJSON,from:takerAddress,value:100000000000000000});

The problem has been fixed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.