0x Cheat Sheet
Supported Chains
Swap and Gasless v2 APIs are currently supported on the following chains. Select the chain in your request by providing the corresponding chainId request parameter. To request support for a new chain, please submit a request here.
Swap API v2
Sample Request and Response
See full list of required query parameters and responses here.
Request
Response
Expand to see response
Gasless API v2
Sample Request and Response
See full list of required query parameters and responses here.
Request
Response
Expand to see response
0x Contracts
This section provides an overview of the three main contracts developers need to understand when working with the 0x API - AllowanceHolder, Permit2, 0x Settler. For more in-depth details, refer to the 0x Contracts section.
A Note About Setting Token Allowances
-
NEVER set an allowance on the Settler contract. Doing so may result in unintended consequences, including potential loss of tokens or exposure to security risks. The Settler contract does not support or require token allowances for its operation. Setting an allowance on the Settler contract will lead to misuse by other parties.
-
ONLY set allowances on AllowanceHolder or Permit2 contracts, as indicated by the API responses.
-
The correct allowance target is returned in
issues.allowance.spenderorallowanceTarget.
0x Settler
The 0x Settler contract is the core execution layer of 0x v2, designed for flexibility and security. It is responsible for executing swaps without requiring passive token allowances.
⚠️ Important: Never set token allowances directly on the Settler contract — this will result in lost funds.
Key Points:
- When using
/swap/permit2, Settler is the entry point contract (where you senddata). - Its address changes dynamically per deployment. The correct contract address is always returned in
transaction.toby the API.
Further reading: 0x Settler
AllowanceHolder (Recommended)
AllowanceHolder is the default and recommended allowance contract for most integrators. It provides a better UX, lower gas costs, and is designed to minimize common integration pitfalls that can occur with using Permit2.
Why use AllowanceHolder?
- ✅ Gas efficiency: Lower approval and execution costs than Permit2.
- ✅ Safer defaults: Reduces the chance of errors during integration.
- ✅ Simple UX: Works with standard approval flows without requiring double signatures, unlike Permit2.
- ✅ Equal Safety: Security guarantees are equivalent to Permit2.
AllowanceHolder is recommended for most integrators, and it is especially well-suited for:
- Teams aggregating multiple liquidity sources and aiming for a consistent user experience across wallets.
- Developers upgrading from Swap v1 (similar integration flow).
- Integration with advanced wallets (multisigs, smart contract wallets)
Endpoints:
Key Points:
- The correct allowance target will be returned in
issues.allowance.spenderorallowanceTarget. - More flexible than the traditional contract-wide approvals.
- Contract addresses are chain-specific, and can be hardcoded. Always verify with the official documentation 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)
Further Reading: AllowanceHolder Contract
Permit2 (Advanced Use Only)
Permit2, developed by Uniswap, enables flexible approvals with features like time-limited and granular allowances. It can be powerful, but it introduces risks that new integrators must be careful with
⚠️ Permit2 is for advanced integrators only.
If you use Permit2, ONLY set allowances on Permit2. NEVER set an allowance on the Settler contract. Setting an allowance on Settler WILL result in loss of funds.
When to use Permit2:
- Your app requires time-limited or granular approvals that AllowanceHolder does not support.
- Your users already have infinite allowances set on Permit2 via another app — no reset is needed.
Endpoints:
Key Points:
- The correct allowance target will be returned in
issues.allowance.spenderorallowanceTarget. - Requires a double-signature flow. This is more complex to integrate but allows for features like time-limited approvals.
- Permit2 is deployed to
0x000000000022D473030F116dDEE9F6B43aC78BA3across all chains. You can hardcode this address in your integration.
Further Reading: Permit2