Introduction
An introduction to how the 0x Swap API works and the resources included this section
The 0x API is a REST API that runs on HTTP. The 0x API’s
/swap
endpoint aggregates liquidity from across the DEX ecosystem and easily surfaces the best price for ERC20 assets. The endpoint aggregates liquidity from both on-chain and off-chain liquidity networks. 📍 New to 0x Swap API? Watch this video on 🛠 Building Token Swaps with 0x API. It covers and overview of how the Swap API works, how to use it, and project ideas.
0x Swap API watches out for your users and is easy for developers.
- By default, it has built-in user-protection features, including:
- It is easy-to-use! For example, you can easily find the best price to buy DAI with WETH with this request
(click to see live price response 👉) https://api.0x.org/swap/v1/price?buyToken=DAI&sellToken=WETH&sellAmount=100000000000000000
The response that is returned back is a valid unsigned Ethereum transaction that can be submitted directly to a node to complete the swap.
Under the hood, the API performs certain tasks:
- Queries prices from multiple DEXs and market makers and aggregates the liquidity from the queried sources to provide the best price possible. Think of how Google flights aggregates flight prices for a certain time and date to help you find the best price,
/swap
similarly helps you find the best price across DeFi liquidity sources. - Swap API’s smart order routing algorithm splits up your transaction across different sources to maximize the overall return on your swap. Read more about smart order routing here.
- Swap API's Slippage Protection enables developers to surface more reliable quotes and consistently deliver the best executed price to users.
- Swap API's Price Impact Protection calculates price impact estimates, and allows developers to easily notify users if insufficient liquidity may negatively affect the price.
This API is intended for public use. If you are an integrator who needs access higher rate limits, please fill out the 0x API Taker Integration Request Form.

0x API's smart order routing algorithm helps users get the best price by splitting the swap across different DEXes.
This section contains the following docs and guides
API FAQs
Last modified 1mo ago