0x API is an HTTP API that gives external developers access to all of 0x liquidity and tooling. More importantly, it goes beyond 0x and is the best way to access liquidity in all of Decentralized Finance, as it aggregates liquidity from all available sources, giving the end-user the best possible deal.
Implementing Ethereum token purchasing is extremely developer friendly, and requires less than ten lines of code.
// Get a quote to sell 1 ETH to buy DAI
const response = await fetch(
'https://api.0x.org/swap/v0/quote?sellToken=ETH&buyToken=DAI&sellAmount=1000000000000000000'
)
const quote = await response.json()
// Send to ethereum with your favorite Web3 Library
window.web3.eth.sendTransaction(quote, (err, txId) => {
console.log('Success!', txId)
})
The API averages millions of dollars per day in crypto trading volume, and handles hundreds of requests per second without a hiccup. It provides the swapping functionality behind many popular Decentralized Finance apps such as Zerion, Relay, and Matcha. It also represents the first public-facing service with an SLA, on-call rotation, and status page run by 0x engineering.