{
  "openapi": "3.0.3",
  "info": {
    "title": "defi-protocol-tvl",
    "version": "1.1.0",
    "description": "Live DeFi & EVM chain intelligence: protocol TVL, Base & Ethereum gas prices, stablecoin peg health, and top chain TVL rankings. Pay-per-call USDC on Base via x402."
  },
  "servers": [
    {
      "url": "https://defi-protocol-tvl.restockalarm.workers.dev"
    }
  ],
  "paths": {
    "/v1/tvl": {
      "get": {
        "summary": "DeFi Protocol Live TVL Lookup",
        "description": "Fetch live Total Value Locked (TVL) in USD for any DeFi protocol slug (e.g. aave, uniswap, aerodrome) via DefiLlama.",
        "parameters": [
          {
            "name": "protocol",
            "in": "query",
            "required": true,
            "description": "DefiLlama protocol slug (e.g. aave, uniswap, aerodrome)",
            "schema": {
              "type": "string",
              "example": "aave"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/gas-now": {
      "get": {
        "summary": "Live EVM Gas Prices (Base + Ethereum)",
        "description": "Live gas prices and estimated ETH/ERC-20 transfer costs in ETH and USD on Base and Ethereum mainnet.",
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Optional: all (default), base, or ethereum",
            "schema": {
              "type": "string",
              "example": "all"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.005"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/stablecoin-peg": {
      "get": {
        "summary": "Stablecoin Peg Health & Depeg Risk",
        "description": "Live USD peg price, deviation in bps, 24h supply change, and depeg_risk (low/medium/high) for USDC, USDT, DAI, USDe or a chosen symbol.",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": false,
            "description": "Optional stablecoin symbol (e.g. USDC, USDT, DAI, USDe); omit for all 4",
            "schema": {
              "type": "string",
              "example": "USDC"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/chain-tvl-rank": {
      "get": {
        "summary": "Top Chains TVL Ranking + Base Rank",
        "description": "Live top-15 (up to 50) blockchain TVL ranking in USD with market share and dedicated Base ranking via DefiLlama.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Optional number of top chains (1-50, default 15)",
            "schema": {
              "type": "string",
              "example": "15"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/yield-opportunities": {
      "get": {
        "summary": "DeFi Yield Opportunities Scanner",
        "description": "Top DeFi yield pools with APY (base vs reward), TVL, project, symbol, IL risk, and simple risk rating via DefiLlama.",
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Optional chain filter (e.g. base, ethereum, arbitrum)",
            "schema": {
              "type": "string",
              "example": "base"
            }
          },
          {
            "name": "stablecoinOnly",
            "in": "query",
            "required": false,
            "description": "Optional true/1 to restrict to stablecoin pools",
            "schema": {
              "type": "string",
              "example": "true"
            }
          },
          {
            "name": "minTvl",
            "in": "query",
            "required": false,
            "description": "Optional minimum TVL in USD (default 0)",
            "schema": {
              "type": "string",
              "example": "1000000"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Optional max results (1-100, default 20)",
            "schema": {
              "type": "string",
              "example": "20"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.02"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/defi-protocol-risk": {
      "get": {
        "summary": "DeFi Protocol Risk Dossier",
        "description": "Score a DeFi protocol 0-100 for risk before routing funds: TVL, 7d/30d TVL change, chain concentration and known hacks (DefiLlama).",
        "parameters": [
          {
            "name": "protocol",
            "in": "query",
            "required": true,
            "description": "DefiLlama protocol slug, e.g. aave",
            "schema": {
              "type": "string",
              "example": "aave"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.05"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/tvl-batch": {
      "get": {
        "summary": "Protocol TVL Batch",
        "description": "Batch protocol TVL: up to 10 comma-separated DefiLlama slugs resolved in one cached DeFiLlama call (10 min TTL), each with name, TVL and lead chain.",
        "parameters": [
          {
            "name": "protocols",
            "in": "query",
            "required": true,
            "description": "Up to 10 comma-separated DefiLlama protocol slugs",
            "schema": {
              "type": "string",
              "example": "aave,lido"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.03"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    },
    "/v1/defi-tvl-chain": {
      "get": {
        "summary": "Chain TVL Overview",
        "description": "Chain TVL overview for any chain DeFiLlama tracks (solana, ton, sui, avalanche, ...): total TVL, native symbol. Other chains where free data exists.",
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "required": true,
            "description": "Chain name as DefiLlama lists it, e.g. solana, ton, sui",
            "schema": {
              "type": "string",
              "example": "solana"
            }
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USDC",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "networks": [
            "eip155:8453"
          ],
          "payTo": "0x7B97303d62517eA9E26D1E1b199Eac42a487F430"
        },
        "responses": {
          "200": {
            "description": "JSON result"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "402": {
            "description": "Payment Required (x402)"
          }
        }
      }
    }
  }
}