Swap API Introduction

The Swap API is the easiest way to tap into Oxdefiapi's aggregated liquidity. It handles all the complexity of finding the best price across exchanges and gives you a simple response that you can use to execute the trade.

Getting Started

To make your first swap, you'll need:

  • An API key from the Dashboard
  • An Ethereum wallet (like MetaMask)
  • Some ETH for gas fees

Endpoint

GET https://api.oxdefiapi.com/swap/v1/quote

Example Request

const params = {
  sellToken: 'ETH',
  buyToken: 'DAI',
  sellAmount: '1000000000000000000', // 1 ETH
}

const response = await fetch(
  `https://api.oxdefiapi.com/swap/v1/quote?${new URLSearchParams(params)}`
);