All Collections
Troubleshooting Guides
0x API Troubleshooting FAQ
0x API Troubleshooting FAQ

Frequently asked troubleshooting questions.

Jake avatar
Written by Jake
Updated over a week ago

I received an error code, how do I resolve it?

See Error codes for a full list of common 0x error codes and how to resolve them.

Why does my 0x transaction revert?

If your 0x quote is reverting, besides the standard revert issues related to ETH transactions, we recommend check the following are set correctly:

  • Are allowances properly set for the user to trade the sellToken?

  • Does the user have enough sellToken balance to execute the swap?

  • Do users have enough to pay the gas?

  • The slippage tolerance may be too low if the liquidity is very shallow for the token the user is trying to swap. Read here for how to handle this.

  • Fee-on-transfer tokens may wreak havoc on our contracts. Read here for how to handle this

  • Working in testnet? Only a subset of DEX sources are available. Be aware that token you want to use for testing must have liquidity on at least one of these sources; otherwise, you will receive an error. Read here for how to handle this.

For more details on addressing common issues, read Troubleshooting.

0x orders are reverting but my transaction is fine, what is happening?

Developers may note when analyzing their transactions that some subset of 0x orders may revert (not filled) but the whole transaction is successful. This is expected behavior as implied earlier, some orders due to timing, and the pricing may be filled or expired before a users attempt to fill the order. This would result in a revert and 0x protocol will utilize fallback orders to compensate for the reverted order. This will result in a successful transaction even though reverts occur within the transactions.

How does takerAddress help with catching issues?

By passing a takerAddress parameter, 0x API can provide a more bespoke quote and help catch revert issues:

  • 0x API will estimate the gas cost for takerAddress to execute the provided quote.

  • If successfully called, the gas parameter in the quote will be an accurate amount of gas needed to execute the swap.

  • If unsuccessful for revert reasons suggested above, then 0x API will throw a gas cost estimation error, alluding to an issue with the takerAddress executing the quote.

TLDR Pass takerAddress to get the quote validated before provided to you, assuring that a number of revert cases will not occur.

Why does the value of the to field in the /swap/quote response vary?

0x API selects the best 0x protocol interface to interact with based on the provided parameters and the smart order routing logic.

There are two main interfaces that 0x API will provide quotes for:

Exchange contract - the main entry-point of the 0x protocol, all swap quotes are settled by the exchange contract.

Forwarder extension contract - a payable interface allowing swaps between native ETH (as a sellToken) and another ERC20 asset.

Find the currently deployed contracts here.

I received an INSUFFICIENT_ASSET_LIQUIDITY error code, how do I resolve it?

This error indicates there is not enough of the asset on the network to make this trade. This is common for very long-tail tokens or if you are building in a testnet (e.g. Sepolia, Mumbai). On testnets, only a subset of DEX sources available on Ethereum mainnet are available on testnet, so not all token pairs may be available.

You can find more information on 0x API troubleshooting in our docs.

Did this answer your question?