Documentation

Everything you need to build

Complete API reference, integration guides, and real-world examples. Get your first trade running in under 5 minutes.

Quick Start

Get up and running in 60 seconds

1. Get your API key

Sign up for a free account and generate your API key from the dashboard. Free tier includes 100 requests per day — perfect for testing.

2. Make your first request

bash
curl -X GET 'https://api.dexflow.dev/v1/quote' \
  -H 'X-API-Key: sk_live_your_api_key' \
  -d 'from=ETH' \
  -d 'to=USDC' \
  -d 'amount=1000000000000000000'

3. Parse the response

{
  "success": true,
  "data": {
    "bestRoute": {
      "dex": "Uniswap V3",
      "amountOut": "1825430000",
      "price": "1825.43",
      "priceImpact": "0.12%",
      "estimatedGas": "150000",
      "gasPrice": "$12.40"
    },
    "savings": "2.3%",
    "mevProtection": {
      "safe": true,
      "riskLevel": "low"
    }
  }
}

Authentication

DexFlow uses API keys to authenticate requests. Include your API key in theX-API-Key header:

// Add to request headers
headers: {
  'X-API-Key': 'sk_live_...'
}
⚠️

Keep your API key secret

Never commit API keys to version control or expose them in client-side code. Use environment variables and keep them server-side.

GET/v1/quote

Get the best price for a token swap across all integrated DEXs

Parameters

fromrequired
string

Token symbol to swap from (e.g., "ETH", "USDC", "WBTC")

torequired
string

Token symbol to swap to (e.g., "ETH", "USDC", "DAI")

amountrequired
string

Amount to swap in wei (for ETH) or smallest unit. Example: "1000000000000000000" = 1 ETH

slippageoptional
number

Maximum acceptable slippage percentage (default: 0.5)

Response

200 OK
{
  "success": true,
  "data": {
    "request": {
      "from": { "symbol": "ETH", "address": "0xEee..." },
      "to": { "symbol": "USDC", "address": "0xA0b..." },
      "amountIn": "1000000000000000000"
    },
    "bestRoute": {
      "dex": "Uniswap V3",
      "pool": "0x88e6...0.3%",
      "amountOut": "1825430000",
      "price": "1825.43",
      "priceImpact": "0.12%",
      "estimatedGas": "150000",
      "gasPrice": "$12.40",
      "netProfit": "$42.15"
    },
    "allRoutes": [
      {
        "dex": "Uniswap V3",
        "price": "1825.43",
        "score": 1850430
      },
      {
        "dex": "SushiSwap",
        "price": "1821.12",
        "score": 1821120
      }
    ],
    "savings": "2.3%",
    "quotesFound": 5,
    "timestamp": "2024-11-24T12:34:56.789Z",
    "mevAnalysis": {
      "protected": true,
      "riskLevel": "low",
      "recommendation": "Safe to execute"
    }
  }
}

Code Examples

javascript
const axios = require('axios');

const quote = await axios.get('https://api.dexflow.dev/v1/quote', {
  headers: { 'X-API-Key': process.env.DEXFLOW_API_KEY },
  params: {
    from: 'ETH',
    to: 'USDC',
    amount: '1000000000000000000'
  }
});

console.log(`Best price: $${quote.data.bestRoute.price}`);
console.log(`You save: ${quote.data.savings}`);
python
import requests
import os

response = requests.get(
    'https://api.dexflow.dev/v1/quote',
    headers={'X-API-Key': os.getenv('DEXFLOW_API_KEY')}, 
    params={'from': 'ETH', 'to': 'USDC', 'amount': '1000000000000000000'}
)

result = response.json()
print(f"Best price: {result['bestRoute']['price']}")
print(f"You save: {result['savings']}")

Ready to start building?

Create your free account and get 100 requests per day