# GET /protocol/fees/top: $0.003 per call

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 chain (e.g. Base, Solana) or one category (Dexs, Lending, Stablecoin Issuer, Derivatives...). Up to 50 rows with amount, day-on-day change and number of chains. 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 fees and revenue (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/protocol-fees-top](/sample/protocol-fees-top). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

```bash
curl "https://aayatai.com/sample/protocol-fees-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/protocol/fees/top?by=revenue&period=30d&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/protocol/fees/top?by=revenue&period=30d&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("protocol-fees-top", {"by":"revenue","period":"30d","limit":5});
```

## Inputs

- `by` (string; one of `fees`, `revenue`; default `fees`): fees = what users paid; revenue = what the protocol kept.
- `period` (string; one of `24h`, `7d`, `30d`; default `24h`): Time window.
- `chain` (string): Only this chain, e.g. Base (default: all chains).
- `category` (string): Only this DefiLlama category, e.g. Dexs, Lending (default: all).
- `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
{
  "by": "revenue",
  "period": "30d",
  "chain": null,
  "category": null,
  "protocols": [
    {
      "rank": 1,
      "protocol": "Tether",
      "slug": "tether",
      "category": "Stablecoin Issuer",
      "amountUsd": 503767801,
      "change1dPct": 0.4,
      "chains": 1
    },
    {
      "rank": 2,
      "protocol": "Circle USDC",
      "slug": "circle",
      "category": "Stablecoin Issuer",
      "amountUsd": 206134684,
      "change1dPct": -0.2,
      "chains": 1
    }
  ],
  "totalTracked": 2437,
  "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 /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/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](/).