Swap API

Powerful trades with a few lines of code

We’ve been building world-class Swaps since 2017 so you don’t have to. Access the most efficient liquidity for web3 tokens through a single API.

Get started

Your gateway into web3

Best prices, all-in

Keep users in your app by offering the best trading experience directly inside your product. Access to 7+ million tokens at the best prices all-in, with the lowest revert rate in the industry.

Unlock revenue

Monetization features that help you sustainably grow your business, with multiple fee collection options. Control your balance sheet by collecting fees in either the buy or sell token.

Security & reliability

Enterprise grade services you can build your business on, with 99.99% uptime. Built with security first and multiple third party audits to ensure there are no vulnerabilities to exploit.

Advanced routing for any trade

0x Argon Router’s multihop and multiplex routing delivers the best prices and optimal trading path for users.

Uniswap V2

0x RFQ

Balancer v2

Sushiswap v3

Dodo

Curve

Lido

Best in class performance

Battle-tested since 2017, 0x is the trusted leader in the decentralized exchange infrastructure.

99.82%

Historical Uptime

5%

Revert rates
Lowest in Defi

<500ms

Median response time

500+

Integrators

Built for serious onchain apps

16 EVM Networks:

Available on the largest chains, including Ethereum, Base, Arbitrum, BNB Chain, Polygon and more.

Deepest Coverage:

Access 9M+ tokens with unrivaled liquidity from 130+ exchanges, including tokens with buy/sell taxes.

Slippage & MEV Protection:

Designed to minimize the impact of sandwich attacks and MEV. Users save an average of ~50-80% on slippage.

Exclusive RFQ Liquidity:

Unlock top-tier liquidity coverage from sophisticated market makers. 0x RFQ outperforms AMMs on price 46% of the time where available.

Actionable User Insights:

Understand your user trading behavior with in-depth charts and data from onchain trades with 0x Trade Analytics.

Monetization Controls:

Unlock new revenue streams with multiple options. Choose which tokens to collect fees in.

Lower Risk Profile:

Leverage Permit2 to bolster your apps defensibility and lower your risk profile for the unthinkable.

Address Screening:

Built-in regulatory and legal compliance. Avoid hefty fees with no additional integration or cost.

Reduce Errors with Smart Validation:

Reliable quotes with accurate gas estimates, every time.

Buy/Sell Tax Support:

Keep up with trends, keep up with user demands.

Simplified Error Handling:

Error messages designed for humans. Solving the most tedious part of the developer experience with description vs cryptic error codes.

Dedicated Support:

Get help from an expert in 30 min or less directly through the 0x Dashboard.

Integrate in 5 minutes or less

Embed crypto trading in your app with just a few lines of code.

Play


const main = async () => {

	 const sellAmount = parseUnits("1000", await usdc.read.decimals());

  	// fetch quote
  	const quoteParams = new URLSearchParams({
  		chainId: client.chain.id.toString(),
    	sellToken: usdc.address,
    	buyToken: weth.address,
    	sellAmount: sellAmount.toString(),
      taker: client.account.address,
    });

  const quoteResponse = await fetch(
    "https://api.0x.org/swap/permit2/quote?" + quoteParams.toString(),
    {
      headers,
    }
  );

  const quote = await quoteResponse.json();
  console.log("Quote to swap 1000 USDC for WETH: ", quote);

}
main();

Play


const main = async () => {

	 const sellAmount = parseUnits("1000", await usdc.read.decimals());

  	// fetch quote
  	const quoteParams = new URLSearchParams({
  		chainId: client.chain.id.toString(),
    	sellToken: usdc.address,
    	buyToken: weth.address,
    	sellAmount: sellAmount.toString(),
      taker: client.account.address,
    });

  const quoteResponse = await fetch(
    "http://api.0x.org/gasless/quote?" + quoteParams.toString(),
    {
      headers,
    }
  );

  const quote = await quoteResponse.json();
  console.log("Quote to swap 1000 USDC for WETH: ", quote);

}
main();

Developer Guides

Tap into a decade of onchain expertise

Developer Guides