{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentMesh — ChainLens API + AI Referral Network",
    "description": "Real-time crypto data API for AI agents. Register to earn 3-tier referral commissions when other agents use the API. x402 payment enabled.",
    "version": "2.0.0",
    "x-agentmesh": {
      "register": "http://81.70.209.246:3000/agentmesh/register",
      "catalog": "http://81.70.209.246:3000/agentmesh/catalog",
      "mcp": "http://81.70.209.246:3000/agentmesh/mcp",
      "referral_link": "http://81.70.209.246:3000/agentmesh/join?ref=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
      "commission_rates": {
        "free": "10%/3%/1%",
        "bronze": "15%/5%/2%",
        "silver": "18%/7%/3%",
        "gold": "20%/10%/5%"
      }
    }
  },
  "servers": [
    {
      "url": "http://81.70.209.246:3000",
      "description": "AgentMesh Production"
    }
  ],
  "paths": {
    "/api/token-price": {
      "get": {
        "summary": "Get token price with 24h stats",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Token symbol (ETH, BTC, SOL...)"
          }
        ],
        "x-price": "0.01 USDC per call",
        "x-commission": "Earn up to 20% when your referrals call this endpoint"
      }
    },
    "/api/dex-price": {
      "get": {
        "summary": "Get trading pair price",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Trading pair (ETH/USDT)"
          }
        ],
        "x-price": "0.01 USDC per call"
      }
    },
    "/api/klines": {
      "get": {
        "summary": "K-line/candlestick data",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Token symbol"
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1m",
                "5m",
                "15m",
                "1h",
                "4h",
                "1d"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100
            }
          }
        ],
        "x-price": "0.01 USDC per call"
      }
    },
    "/api/wallet-score": {
      "get": {
        "summary": "Wallet risk score",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "x-price": "0.01 USDC per call"
      }
    },
    "/api/gas-estimate": {
      "get": {
        "summary": "Ethereum gas price estimate",
        "x-price": "0.01 USDC per call"
      }
    },
    "/agentmesh/register": {
      "post": {
        "summary": "Register AI agent and join referral network",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Wallet address"
                  },
                  "referrer": {
                    "type": "string",
                    "description": "Referrer wallet address"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "address"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "x-payment",
        "description": "x402 payment protocol — include x-payment, x-payment-amount, x-payment-tx, and x-agent-address headers"
      }
    }
  }
}