# GET /dex/top: $0.003 per call

The busiest decentralised exchanges: DEXs ranked by trading volume over 24 hours, 7 days or 30 days, across all chains or on one chain (e.g. Base, Solana, Arbitrum), with each one's share of the total, day-on-day change and number of chains. Up to 50 rows. DefiLlama data.

- **Price:** $0.003 in USDC, the same on Base, Solana, Polygon, Arbitrum. Failed calls are never charged.
- **Free trial:** yes, 20 free calls a day from Claude, Cursor or any MCP client ([set-up](/mcp/setup)).
- **Tier:** live
- **Answers cached for:** 30 min
- **Data sources:** DefiLlama DEX volumes (free)
- **Lane:** Web3 data ([OpenAPI](/openapi/web3-data.json))
- **Live health:** [status page](/status)

## Free sample

See an answer for the demo input first, free (no payment, 10 a minute): [https://aayatai.com/sample/dex-top](/sample/dex-top). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

```bash
curl "https://aayatai.com/sample/dex-top"
```

## 1. See the price (free)

Call it without paying: you get `402 Payment Required` and a `PAYMENT-REQUIRED` header with the exact price and where to pay.

```bash
curl -i "https://aayatai.com/dex/top?chain=Base&limit=5"
```

## 2. Pay and call (TypeScript)

```bash
npm install @x402/fetch @x402/evm viem
```

```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

// A wallet used only by your agent, holding a little USDC on Base.
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

const res = await pay("https://aayatai.com/dex/top?chain=Base&limit=5");
console.log(await res.json());
```

## 3. Or as an MCP tool

```ts
// MCP server: https://aayatai.com/mcp (Streamable HTTP). With the x402 MCP client (see /start):
const result = await client.callTool("dex-top", {"chain":"Base","limit":5});
```

## Inputs

- `chain` (string): Only this chain, e.g. Solana (default: all chains).
- `period` (string; one of `24h`, `7d`, `30d`; default `24h`): Time window.
- `limit` (integer; default `10`): How many rows (1-50).
- `detail` (string; one of `full`, `brief`; default `full`): brief = key fields only (same price)

Bad inputs are rejected with HTTP 400 before any payment is asked for.

## Example answer

Example only: the shape of an answer, with placeholder addresses and made-up figures. It is not data about any real token or wallet; call the service (or its free sample) for real results.

```json
{
  "period": "24h",
  "chain": "Base",
  "totalVolumeUsd": 1365912253,
  "dexes": [
    {
      "rank": 1,
      "dex": "Aerodrome Slipstream",
      "slug": "aerodrome-slipstream",
      "volumeUsd": 659297523,
      "sharePct": 48.27,
      "change1dPct": 12.1,
      "chains": 1
    },
    {
      "rank": 2,
      "dex": "Uniswap V3",
      "slug": "uniswap-v3",
      "volumeUsd": 364493611,
      "sharePct": 26.69,
      "change1dPct": 4.3,
      "chains": 47
    }
  ],
  "source": "DefiLlama"
}
```

## Related

- [GET /protocol/fees](/services/protocol-fees) ($0.003): What a DeFi protocol earns: fees paid by its users and the protocol's own revenue over the last 24 hours, 7 days, 30 days, a year and all time, the day-on-day c
- [GET /protocol/fees/top](/services/protocol-fees-top) ($0.003): Which crypto protocols earn the most: a ranking by fees paid by users or by the protocol's own revenue over 24 hours, 7 days or 30 days, optionally for one chai
- [GET /chain/stats](/services/chain-stats) ($0.003): One blockchain's economy in one call: total value locked, DEX trading volume (24 h, 7 d, 30 d and the day-on-day change), its five busiest DEXs, fees paid on th
- [GET /chain/rank](/services/chain-rank) ($0.002): Blockchains ranked by total value locked in DeFi or by US-dollar stablecoins circulating on them, with both figures and each chain's gas-fee currency symbol (e.
- [GET /dao/search](/services/dao-search) ($0.001): Find a DAO's Snapshot space by name: returns matching spaces, biggest first, with their id (to use with dao-proposals), whether Snapshot has verified them, foll
- [GET /dao/active](/services/dao-active) ($0.002): What DAOs are voting on right now: open Snapshot proposals from verified DAOs, biggest communities first, each with the DAO, title, closing time, voters so far,
- [GET /dao/proposals](/services/dao-proposals) ($0.002): A DAO's governance votes from Snapshot: the latest proposals (active, closed or all) with title, dates, voting type, each choice's votes and share, the leading 

New here? [Getting started in 60 seconds](/start). All services: [Aayat AI](/).