gate402 · Best Swap

by gate402

POSTBase

$0.02

per call · USD Coin on Base

Best-execution intel for a Base token: which DEX pool to trade on and the estimated price impact + total cost for a given trade size, ranked across pools, with a split suggestion. Constant-product estimate for trading agents — the execution plan, not a firm quote.

Endpoint

POST https://gate402.app/v1/best-swap

1

Calls / 30d

1

Unique payers / 30d

Aug 22

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://gate402.app/v1/best-swap", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "address": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed",
    "sizeUsd": 1000
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://gate402.app/v1/best-swap" \
  -H "Content-Type: application/json" \
  -d '{"address":"0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed","sizeUsd":1000}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "address": "0x…",
  "alternatives": [
    {
      "dex": "uniswap",
      "priceImpactPct": 0.31,
      "totalCostPct": 0.61
    }
  ],
  "best": {
    "dex": "aerodrome",
    "estTokensReceived": 82900,
    "feePct": 0.3,
    "liquidityUsd": 1200000,
    "pairAddress": "0x…",
    "priceImpactPct": 0.17,
    "totalCostPct": 0.47,
    "url": "https://dexscreener.com/base/0x…"
  },
  "notes": [
    "Low impact (~0.17%) on aerodrome — fine to execute in one pool"
  ],
  "priceUsd": "0.012",
  "recommendation": "Trade on aerodrome — ~0.47% total cost (impact + fee)",
  "sizeUsd": 1000,
  "splitSuggested": false,
  "symbol": "TKN"
}

Payment details

Pay to0x8e57bfde053dbb6862991759c19affc5f383d5d0
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Market Data and the homepage with a featured placement.

Get featured →

More from gate402 & similar services