Skip to main content

Fast mode

Set slippage=10000 to activate fast mode. The API skips gas estimation, price impact calculation, and USD valuation — returning only path and transaction (no stats). Use this when latency matters more than quote details.
const quote = await api('/api/v2/quote?' + new URLSearchParams({
  tokenIn: NATIVE,
  tokenOut: TOKEN,
  amount: '1000000000000000',
  slippage: '10000', // fast mode
  trader: wallet.address,
  chain: 'BASE'
}))
// quote.stats is undefined — only quote.path and quote.transaction are returned

Sign everything

Always sign and submit approve and extra transactions when present in the quote response. Skipping them will cause the trade to revert.
// approve — token allowance for the router
if (quote.transaction.approve) {
  signedApprove = await wallet.signTransaction(
    ethers.Transaction.from(quote.transaction.approve)
  )
}

// extra — permit2 or fee transactions for specific tokens
if (quote.transaction.extra) {
  signedExtra = await wallet.signTransaction(
    ethers.Transaction.from(quote.transaction.extra)
  )
}

Execute immediately

Quotes expire after 30 seconds. Sign and call /api/v2/execute as soon as you receive the quote — nonces and gas prices go stale quickly.

Use simulation

Set simulation: true on execute to catch reverts before broadcasting. This adds minimal latency but prevents failed transactions from hitting the chain and consuming gas.

Slippage guidelines

ScenarioRecommended slippage
Blue-chip tokens (ETH, major stables)100-300 bps (1-3%)
Mid-cap tokens500 bps (5%)
Low-liquidity / meme tokens1000-2000 bps (10-20%)
Pump.fun tokens (Solana)1000-3000 bps
Fast mode (no stats)10000 bps

Check result.success

HTTP 200 does not mean the trade succeeded. Always check result.success — the response body contains the actual execution status.
const result = await api('/api/v2/execute', { ... })

if (!result.success) {
  console.error('Trade failed:', result.error)
  return
}

console.log(`TX: ${result.txRes.explorerUrl}`)

MEV protection

Enable mev: true for large trades on ETH and BSC. This routes the transaction through a private mempool to avoid sandwich attacks. Not needed on L2s where MEV is less prevalent.

Integrator fees

Use the integrator and fee params to monetize your integration. The fee is split 80/20 on-chain — 80% to your wallet, 20% to the protocol. No off-chain settlement required.
const quote = await api('/api/v2/quote?' + new URLSearchParams({
  // ... token params
  integrator: '0xYourFeeWallet',
  fee: '100' // 1% — you receive 0.8%, protocol keeps 0.2%
}))

Use /api/v2/value for price checks

If you only need a price estimate without building a transaction, use /api/v2/value instead of /api/v2/quote. It returns USD values and output amounts without gas estimation or transaction building — faster and lighter.

Chain auto-detection

You can omit the chain parameter on /api/v2/quote — the API will detect the chain from the token address. Explicit chain is still recommended for reliability and to avoid ambiguity with tokens deployed on multiple chains.