FAQ
CORS Errors
Why am I getting a CORS error when using the 0x API?
TL;DR CORS errors happen because the 0x API enforces strict security policies. Avoid making API calls directly from the browser to prevent CORS issues and exposing your API keys. Instead, use a backend server, serverless functions, or a full-stack framework.
Error Message You might see an error like this:
Explanation
This error occurs because browsers block requests with custom headers (e.g., 0x-version) unless explicitly allowed by the server. Making API calls from a browser is not recommended because it can expose your API keys.
Recommended Solutions
- Use a Backend Server — Proxy API calls through a backend server and handle API keys securely (e.g.,
axiosin Node.js orrequestsin Python). - Serverless Functions — Use AWS Lambda, Vercel Functions, or Netlify Functions.
- Full-Stack Framework — Implement backend logic in Next.js or Remix.
Troubleshooting
I received an API issue / error code. Help!
See Handling API issues and error codes for a full list of common 0x issue types and 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, check the following:
- Are allowances properly set for the user to trade the
sellToken? - Does the user have enough
sellTokenbalance 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 this guide.
- Did the RFQ Quote expire? RFQ quotes are typically valid for ~60s on mainnet. See the RFQ expiry accordion below.
For more details, see Troubleshooting.
Did my order revert because the RFQ quote expired?
RFQ quotes from Market Makers are only valid for a short period (roughly 60s on mainnet).
Two ways to check:
- Use the Tenderly debugger on the transaction; look for
getOTCOrderInfoin the trace and inspectexpiryAndNonce. - You may need to reach out to 0x support to help decode
expiryAndNonce.
Best practice: refresh quotes about every 30s to prevent RFQ expiry. See Matcha.xyz for an example.
0x orders are reverting but my transaction is fine, what is happening?
Some subset of 0x orders may revert (not fill) while the overall transaction succeeds. This is expected: due to timing/pricing, some orders may be filled or expired before a user attempts to fill. The protocol uses fallback orders to compensate, resulting in a successful transaction even though internal order reverts occurred.
How does including taker in the API call help with catching issues?
How does including taker in the API call help with catching issues?
Passing a taker lets 0x API provide a bespoke quote and catch revert issues:
- Estimate gas for
takerto execute the quote. - If successful,
gasin the quote reflects an accurate execution estimate. - If not, a gas estimation error hints at execution issues for that
taker.
TL;DR Pass taker to validate quotes and avoid many revert cases.
I received an INPUT_INVALID error. Help!
I received an INPUT_INVALID error. Help!
I received BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE or SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE. Help!
I received BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE or SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE. Help!
The buy token is not authorized for trade due to legal restrictions.
I received an INTERNAL_SERVER_ERROR error. Help!
I received an INTERNAL_SERVER_ERROR error. Help!
An internal server error occurred.
- Check that the API request is formatted properly.
- Check 0x system status.
- If the issue persists, contact support.
How will I know if the trade is not possible due to insufficient asset liquidity?
The API will return liquidityAvailable=false and omit other response params if there isn’t enough liquidity available for the requested quote.

What does MEV protection mean?
Use the getSources endpoint.
Swap API
About Swap API
How do I get a list of all the sources the API is sourcing from?
Use the getSources endpoint.
How do I find a list of supported chains for Swap?
Use the getChains endpoint to get a list of supported chains for Swap.
Is there a fee to use Swap API?
We offer two transparent, flexible tiers for Web3 businesses of all sizes. You can get started here. If you are a high-volume app or have a unique business model, please contact us to discuss a custom plan.
0x takes an on-chain fee on swaps for select tokens for teams on the Standard tier. This fee is charged on-chain to your users during the transaction. In cases where we charge a fee, we return the value in the API response as zeroExFee. See the Swap API reference for details.
How does Swap API select the best orders for me?
Swap API samples each liquidity source and adjusts for gas consumption (using your specified gas price, or a fast default) and any associated fees. It evaluates different compositions of sources to select the best set of orders, and also creates fallback orders to ensure executability.
Example: Curve’s nominal price may look best, but after factoring gas * gasPrice and fees, it may not be optimal.
How can I find the tokens that 0x supports for trading?
0x supports all tokens by default except those blocked for compliance reasons.
Is it possible to use the Swap API to trade custom ERC-20 tokens or altcoins?
If you’d like to trade a custom token, you’ll need to create liquidity by deploying a pool on an AMM the API sources (e.g., Uniswap, SushiSwap, Curve).
What does MEV protection mean?
MEV protection applies to RFQ orders, which are filled privately and atomically to prevent sandwiching/front-running. It does not apply to AMM trades, which execute on public mempools and are subject to typical MEV risks.
Monetizing your Swap Integration
I am building a DEX app using Swap API. Can I charge my users a trading fee/commission?
You can collect affiliate fees or trade surplus. Read the full guide: monetizing your swap integration.
How is the trading fee/commission I charge returned by Swap API?
If swapFeeRecipient, swapFeeBps, and swapFeeToken are set, the response includes fees.integratorFee.amount which you can display to users.
Example for 1% of 100 USDC:
sellToken=0xA0b8…eB48(USDC)swapFeeToken=0xA0b8…eB48sellAmount=100000000(USDC has 6 decimals)swapFeeBps=100
Fee amount = 1000000 = 1 USDC.
See the guide: monetization. In API v2, you can take fees on buyToken or sellToken.
Can I collect trade surplus (positive slippage)?
Available to select integrators on a custom pricing plan. Contact support. See the monetization guide.
AllowanceHolder and Permit2
What is the difference between using AllowanceHolder and Permit2 for Swap API?
0x Swap API supports two allowance methods: AllowanceHolder (recommended) and Permit2 (advanced).
AllowanceHolder (Recommended)
Better UX, lower gas, simpler integration, and safe defaults. Great for aggregators, teams upgrading from Swap v1, and advanced wallets (multisigs/smart accounts).
Endpoints:
Allowance target is returned in issues.allowance.spender or allowanceTarget.
Chain-specific AllowanceHolder addresses (verify with official docs before hardcoding):
0x0000000000001fF3684f28c67538d4D072C22734— Cancun hardfork chains (Ethereum Mainnet, Arbitrum, Avalanche, Base, Berachain, Blast, BSC, Ink, Linea, Mode, Monad, Optimism, Plasma, Polygon, Scroll, Sonic, Unichain, World Chain)0x0000000000005E88410CcDFaDe4a5EfaE4b49562— Shanghai hardfork chains (Mantle)
Permit2 (Advanced Only)
Enables time-limited/granular approvals but requires a double-signature flow. If you use Permit2, set allowances on Permit2 only — never on the Settler (funds may be lost).
Endpoints:
Permit2 address (all chains): 0x000000000022D473030F116dDEE9F6B43aC78BA3
Read more about the contracts here.
Should I use AllowanceHolder or Permit2 for my meta-aggregator project?
Depends on UX and integration type:
AllowanceHolder: single-signature UX, consistent across sources, similar to Swap v1.
Permit2: universal approvals and time-limited/granular allowances; requires an extra signature.
If an allowance is needed when using AllowanceHolder, which contract will issues.allowance.spender or allowanceTarget return?
If an allowance is needed when using AllowanceHolder, which contract will issues.allowance.spender or allowanceTarget return?
The AllowanceHolder contract.
How should the signed Permit2 EIP-712 (permit2.eip712) message look?
How should the signed Permit2 EIP-712 (permit2.eip712) message look?
Ethereum signatures: r, s, v, ordered as r, s, v, where:
r < secp256k1ns < (secp256k1n / 2 + 1)vis 0 or 1; on EVM encode as27 + v(27 or 28)
Pack to 65 bytes: bytes 0–31 = r, 32–63 = s, 64 = v.
Parameter Questions
What is gas?
Gas is the fee required to conduct a transaction on Ethereum, paid in ETH and denominated in Gwei (1 ETH = 1,000,000,000 Gwei).
What is the significance of 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE?
What is the significance of 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE?
It’s a standardized representation of native tokens (e.g., ETH, BNB, POL) which don’t have contract addresses like ERC-20s.
On Mantle: $MNT is an exception with contract address 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000 on Mantle EVM (not applicable to wrapped/bridged MNT). See Handling native tokens with 0x Swap API.
Does the 0x API return buyAmount in base units?
Does the 0x API return buyAmount in base units?
Yes. All buyAmount values are in the token’s base units.
- 18 decimals (e.g., WETH, DAI):
1000000000000000000= 1.0 - 6 decimals (e.g., USDC):
1000000= 1.0
Useful helpers:
Is it possible to quote by the buyAmount?
Is it possible to quote by the buyAmount?
No — in v2 only sellAmount is supported for more deterministic
behavior and broader liquidity support.
Can I skip validation for /quote by leaving the taker parameter blank?
Can I skip validation for /quote by leaving the taker parameter blank?
No — taker is required in v2 for /quote. It enables
us to return calldata and identify issues that would cause failures.
Why does the value of the to field in /swap/quote vary?
Why does the value of the to field in /swap/quote vary?
The Settler contract can be redeployed; the to target address will therefore change. See: current/future Settler addresses.
Best Practices
What is the best way to query swap prices for many asset pairs without exceeding the rate limit?
Contact 0x to discuss a solution that best suits your use case.
How can I display the 0x Swap Fee to my end users?
When applicable, the fee is returned as zeroExFee in quotes. You
are responsible for showing the amount and token to
users. See the Pricing Page and
/quote response
.
Is there a way to sell assets via Swap API if the exact sellToken amount is not known before the transaction is executed?
Not currently, but we’re exploring this feature.
How can I get the ABI for an ERC-20 contract via TypeScript?
Options:
- Copy from Etherscan (Contract tab → ABI).
- Use the Etherscan API.
- Fetch from the token’s GitHub repo if available.
Import
erc20Abifromviem
.
What’s the best way to access 0x trade data?
Depends on your use case:
- 0x Trade Analytics API — historical analysis, usage tracking, reporting.
- 0x-parser — TypeScript library for decoding real-time 0x transaction logs.
See the 0x transaction data guide.
Can I detect whether a transaction originated from the 0x API by parsing transaction receipts?
Not directly via onchain data alone. While all 0x API trades settle through the Settler contract, transactions don’t include a unique tag that explicitly ties them to the API.
Tracking your own app’s activity:
- Use the 0x Trade Analytics API.
- Enable onchain tagging in the 0x Dashboard (Settings → “Enable onchain tagging”).
- You can monitor the Settler contract, but it includes non-API transactions.
- For aggregated usage insights, reach out and share your use case.
Gasless API
About Gasless API
How do I get a list of sources the API is sourcing from?
Use the getSources endpoint.
What chains does Gasless API support?
See the full list of supported chains
Which tokens are supported by Gasless API?
Short answer:
Gasless API provides a gasless experience at two points of the trade flow where users normally pay gas:
- Gasless approvals work only for tokens listed in our Gasless Approval Token endpoint (tokens that support EIP-2612).
- Gasless swaps work for selling any non-native token (ERC-20 or similar).
What doesn’t work:
You can’t use Gasless API to sell a chain’s native coin (e.g., ETH on Mainnet, POL on Polygon). Native coins aren’t ERC-20s, so they lack transferFrom which the relay system uses. Use the Swap API instead (user pays gas in the native token) or have users wrap the coin (e.g., ETH → WETH).
Work-arounds for tokens not supported by Gasless API:
- Use the regular Swap API — the user pays gas in the native coin.
- Wrap the coin first (e.g., ETH → WETH), then use Gasless API.
What if my user wants to sell a native token (e.g., swap ETH for USDC) on Mainnet?
Use the
Swap API
(user pays gas in the native token), or have users wrap the native coin first (e.g., ETH → WETH), then use Gasless API.
What is the minimum amount users can trade with Gasless API?
It varies by chain, size, and gas conditions. If the amount is too small, the API returns an error with the estimated minimum. As a guideline, set a minimum of about 1 on other chains.
What’s the difference between Permit (EIP-2612) and Permit2?
Both enable gasless-like UX, but they serve different purposes.
In short: Permit (EIP-2612) is an ERC-20 extension
enabling gasless approvals via an EIP-712 signature — no on-chain tx —
but only for tokens that implement EIP-2612. Many older tokens (e.g., WETH) don’t,
so they still need a regular approve().
Permit2 (by Uniswap Labs) is a universal approval contract for
any ERC-20. Users first do a standard gasful approve() to Permit2,
then future moves can be authorized via EIP-712 signatures (gasless for subsequent
swaps). This is useful when tokens don’t support permit() but you
want a consistent meta-tx flow. Permit2 is deployed at
0x000000000022D473030F116dDEE9F6B43aC78BA3 on major chains.
Gas
Who pays for the gas fees to allow those swaps to happen?
0x covers the gas fee up front. The cost is wrapped into the trade and paid in the token the user is trading. Applications may choose to sponsor transactions; in that case they pay 0x directly and users are not billed on chain.
Monetizing Gasless API
Can I monetize using Gasless API?
You have full flexibility on the fees you collect on trades.
Include these parameters when making a Gasless API request:
swapFeeRecipient— Wallet address to receive trading fees.swapFeeBps— Fee in basis points (0–1000; 1000 Bps = 10%).swapFeeToken— Contract address of the token to receive fees (must bebuyTokenorsellToken).
Gasless Approvals
What tokens work with gasless approvals?
Gasless approvals are supported only for tokens listed in the gasless approval token endpoint.
How do I know if an approval is required?
Check the response from /gasless/quote,
If
issues.allowanceis notnull, an allowance approval is required.If
approvalis notnull, a gasless approval is possible.
My user needs an approval before swapping — are these separate transactions? Do I need 2 signatures?
Gasless approvals and gasless swap are bundled in the same transaction, but each requires a signature for its EIP-712 object. You can design the UI so it feels like a single step to the user.
What does a gasless approve + swap happy path look like?
Troubleshooting
I received one of these errors: INPUT_INVALID, BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE, INTERNAL_SERVER_ERROR. Help!
Trade Analytics API
What is the 0x Trade Analytics API?
The Trade Analytics API gives integrators easy access to the history of trades initiated through 0x APIs and settled on 0x Smart Contracts. This API offers comprehensive transaction records, providing useful insights into user trading behavior.
Whose data is returned?
The Trade Analytics API will only return data for the app associated with the API key that makes the request. While all trading data is publicly available onchain, the Trade Analytics API provides a streamlined, well formatted data for the specific app making the request.
What is data finality in the context of the Trade Analytics API?
The data accessed through the API is deemed final 48 hours after a trade is completed. This delay allows time for the data pipeline to capture all relevant information, including fees from proxy contracts and updated USD prices from Coingecko.
To ensure that your trading data is up to date, we recommend that you fetch and update data from the preceding 2 days in addition to the current day.
How quickly will a new trade show up in the Trade Analytics API?
Data is updated roughly every 15 minutes. While generally reliable, data from these updates can sometimes be missing or incomplete, especially if they have a dependency on external sources such as token USD price providers. Each trade data is considered final 48 hours after it’s mined onchain – this enables us to address any gaps from earlier updates, ensuring data accuracy.
We don’t recommend using this API for use cases that require real time updates. If you’re interested in such data, please submit a feature request.
Can I detect whether a transaction originated from the 0x API by parsing transaction receipts?
It’s a common question — and the short answer is: not directly via onchain data alone.
While all 0x API trades are settled through the 0x Settler smart contract, these transactions don’t include a unique tag or flag that explicitly ties them to the API.
That said, there are a few ways to approach attribution, depending on what you’re trying to track:
🔍 If you’re trying to track your own app’s activity
- The 0x Trade Analytics API is the best place to start. It allows you to query detailed trade data associated with your API key.
- Enable onchain tagging. In your 0x Dashboard, go to your app’s Settings and toggle on “Enable onchain tagging.” This makes it easier to filter and trace your transactions onchain later.
🌍 If you’re trying to detect any and all transactions routed via the 0x API
- You can monitor the 0x Settler contract for activity, but this includes all transactions — not just those initiated via the 0x API.
- Currently, there is no canonical event that maps directly to “this came from the Swap API,” but we’re exploring ways to make API attribution more accessible in the future.
- If you’re interested in aggregated Swap API usage data, we may be able to share insights or internal tools depending on your use case. Reach out to us — we’d love to hear more about what you’re trying to build.
We understand attribution is an important use case, whether you’re tracking your own usage or seeking broader ecosystem insights. Don’t hesitate to contact us to discuss how we can best support you.
What is the difference between using the Trade Analytics API vs the 0x-parser?
Trade Analytics API is best for historical analysis and business intelligence. Provides comprehensive trade data including volumes, fees, and USD values.
0x-parser is a best for real-time transaction data and displaying final swap amounts immediately after settlement.
Read more about accessing 0x transaction data here.
0x Dashboard
Does the 0x Dashboard support having multiple user accounts for our team?
For now we only support one user per team account, but we will add support for multiple users in the coming weeks.
What is an App?
An app is a self-contained unit for each application that you’re building. You can set up multiple apps, each with unique API keys and configurations, on the 0x Dashboard.
Smart Contracts
Are the smart contracts audited?
Building with 0x
My project would like to integrate 0x. How can I contact the 0x team?
Create an account on the 0x Dashboard to get an API key and start building for free. You can also review plans and contact our team for custom needs.
My project is interested to apply as a liquidity source in 0x ecosystem. How can I contact the 0x team?
Thank you for your interest in providing liquidity to the 0x ecosystem. Please refer to the “Liquidity Integrations” tab.