Quickstart

Get started with DexAggregator API in 5 minutes

This guide will help you make your first API call to DexAggregator and execute an optimal token swap.

Prerequisites

  • Basic understanding of blockchain and token swaps

  • API client (curl, Postman, or code)

  • Wallet address for testing

Step 1: Server Setup (Optional)

If you're running your own instance:

# Clone the repository
git clone https://github.com/YourOrg/DexAggregator-go-server.git
cd DexAggregator-go-server

# Install dependencies
go mod download

# Run the server
go run examples/kyberswap_api_server.go

The server will start on http://localhost:8081 by default.

Using a hosted instance? Skip this step and use your API endpoint URL.

Step 2: Check Server Health

Verify the API is running:

Response:

Step 3: Get Supported Chains

Response:

Step 4: Get Contract Addresses

Get the smart contract addresses for your chain:

Response:

Step 5: Build Your First Swap Route

Now let's swap 1 WBNB to USDT on BSC:

Response:

Step 6: Execute the Swap

Use the returned data to execute the swap on-chain:

Using Web3.js (JavaScript)

Using ethers.js (TypeScript)

Understanding the Response

Field
Description

amountOut

Expected output amount (best case)

minAmountOut

Minimum output after slippage tolerance

executorData

ABI-encoded calldata ready for contract execution

swapType

Type of swap: simple, batch, multihop, or parallel_multihop

gas

Estimated gas units needed

routeInfo

Breakdown of which DEXes and routes are used

Parameter Explanation

Required Parameters

  • chain: Chain identifier (bsc, ethereum)

  • tokenIn: Input token contract address

  • tokenOut: Output token contract address

  • amountIn: Input amount in wei (18 decimals for most tokens)

  • sender: Your wallet address

  • recipient: Receiving wallet address

Optional Parameters

  • slippageTolerance: Max acceptable slippage in basis points (50 = 0.5%)

  • deadline: Unix timestamp for transaction validity

  • includedSources: Array of DEX names to include (default: all supported)

  • gasPrice: Custom gas price in wei

Common Token Addresses

BSC Mainnet

Ethereum Mainnet

Next Steps

Last updated