{
  "openapi": "3.0.0",
  "info": {
    "title": "DeFi Signal API",
    "version": "1.0.0",
    "description": "Unieke bot-data van live DeFi-scanners op Base, Arb, OP en Solana",
    "x-guidance": "This API provides unique DeFi bot telemetry from live scanners on Base, Arbitrum, OP, and Solana.\nTo call a paid endpoint:\n1. GET /api/status to see payment info (wallet + USDC contract on Base).\n2. Send exact USDC amount to the payment wallet on Base mainnet.\n3. Include the transaction hash as PAYMENT-SIGNATURE header in your request.\n4. Payment is verified on-chain. Each tx hash can only be used once.\nFree: /api/status | Paid: /api/signals ($0.002), /api/pt ($0.001), /api/pt-next ($0.005), /api/earnings ($0.003), /api/health ($0.002), /api/murshid ($0.010), /api/edge ($0.008)",
    "contact": {
      "email": "info@holistischadviseur.nl"
    }
  },
  "paths": {
    "/openapi.json": {
      "get": {
        "summary": "OpenAPI discovery document",
        "description": "Free endpoint. Returns this OpenAPI spec.",
        "operationId": "getOpenApi",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "OpenAPI 3.0.0 spec"
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "summary": "Service description and payment info",
        "description": "Free endpoint. Returns all available endpoints, prices, and payment wallet address.",
        "operationId": "getStatus",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Service info and payment details"
          }
        }
      }
    },
    "/api/signals": {
      "get": {
        "summary": "SOL arbitrage near-win signals (last 2 hours)",
        "description": "Returns up to 30 recent Solana DEX arbitrage opportunities missed by our bot due to $0.05 minimum threshold. The response includes source_last_write_ts and status (\"live\"/\"stale\") — the underlying data-collection bot is not guaranteed to be running continuously, so a count of 0 can mean either a quiet market or a stale/dead data source. Check status before interpreting count:0 as \"no opportunities right now\".",
        "operationId": "getSignals",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "List of arb signals with pair, route, profit_usd, detect_lag_ms, plus source_last_write_ts and status (live/stale)"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/pt": {
      "get": {
        "summary": "PoolTogether draw scans and recent claims",
        "description": "Live data from pt-claimer bots on Base, Arbitrum, and OP.",
        "operationId": "getPt",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.001"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Draw scans, winners, and claim results"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/earnings": {
      "get": {
        "summary": "Live bot earnings per channel (today)",
        "description": "Aggregated earnings from 7+ DeFi bots across Base, Arb, OP, Solana.",
        "operationId": "getEarnings",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.003"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Earnings by bot/channel in USD for today"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "summary": "VPS bot health — live PM2 status of all 50+ bots",
        "description": "Real-time PM2 status snapshot of all bots running on Hetzner VPS.",
        "operationId": "getHealth",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "List of all bots with status, uptime, restarts, cpu, mem_mb"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/murshid": {
      "get": {
        "summary": "Al-Murshid nightly strategy report",
        "description": "Nightly strategic advisory report: 5 key questions answered, recommendations, lessons learned.",
        "operationId": "getMurshid",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Strategy report with recommendations and lessons"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/edge": {
      "get": {
        "summary": "Edge scores — strategy verdicts with expected vs actual returns",
        "description": "Al-Murshid strategy verdicts: each strategy with expected monthly income, actual monthly income, status.",
        "operationId": "getEdge",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.008"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Strategy verdicts with expected_per_month and werkelijk_per_maand"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/vuln-search": {
      "get": {
        "summary": "Smart contract vulnerability pattern search (3ilm — 1,032 exact-reconciled findings)",
        "description": "Query 1,032 accepted/rejected findings from 10 exact-reconciled Sherlock contests (see METHODOLOGY.md — smaller, verified set preferred over a larger unreconciled one). Returns matching vulnerability patterns with acceptance rates and real examples.",
        "operationId": "getVulnSearch",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 USDC payment on Base mainnet"
          },
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query: e.g. \"oracle price manipulation\", \"reentrancy\", \"flash loan\""
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Matching patterns with acceptance_rate and examples"
          },
          "402": {
            "description": "Payment Required — $0.005 USDC on Base"
          }
        }
      }
    },
    "/api/pt-next": {
      "get": {
        "summary": "PoolTogether draw schedule for all chains",
        "description": "Returns the next draw time on Base, Arb, OP and Scroll with countdown. Use to time your claim bots optimally.",
        "operationId": "getPtSchedule",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC tx hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Next draw times per chain with timeUntilMs (drawId, lastAwardAt, nextDrawAt, periodH)"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/morpho-borrowers": {
      "get": {
        "summary": "Morpho Base — active borrowers per market",
        "description": "Top markets by borrower count, with sample borrower addresses. Bot-intelligence for liquidation scanners.",
        "operationId": "getMorphoBorrowers",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Markets sorted by borrower count with sample addresses"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/aave-health": {
      "get": {
        "summary": "Aave V3 Base+Arbitrum — near-liquidation positions",
        "description": "Opportunity and competitor events from the last 48 hours, sorted by estimated profit.",
        "operationId": "getAaveHealth",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.008"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Near-liquidation opportunities with healthFactor, estProfitUSD"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/compound-health": {
      "get": {
        "summary": "Compound V3 — live scan telemetry, liquidation signal",
        "description": "Recent scan_complete events (last 6h): accounts checked, liquidatable/absorbed counts, scan latency, data freshness. Complementary to /api/compound-borrowers (address list vs. scan outcomes).",
        "operationId": "getCompoundHealth",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.008"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Scan telemetry summary with liquidatable_now signal"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/jup-lend": {
      "get": {
        "summary": "Jupiter Lending (Solana) — live scan telemetry, liquidation signal",
        "description": "Recent scan_complete events (last 6h) from the Jupiter Lending liquidator bot: vaults tracked, liquidation events, RPC-throttle (rate429) health signal. New asset class not covered by any EVM endpoint.",
        "operationId": "getJupLendHealth",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.008"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Scan telemetry summary with liquidated_now signal and RPC health"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/rpc-status": {
      "get": {
        "summary": "Live RPC-provider health per chain — getLogs support + liveness latency",
        "description": "Latest measurement per (provider, chain) pair from the RPC-telemetry cron (every 2h): whether getLogs works/is capped/range-capped/archive-gated/rate-limited/unhealthy/timed out, plus basic liveness (blockNumber/getSlot) latency.",
        "operationId": "getRpcStatus",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Per provider×chain: liveness_ok, liveness_ms, getlogs_status, getlogs_ms"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/liquidation-watch": {
      "get": {
        "summary": "Live multi-chain liquidation risk — Morpho Blue + Aave V3 + Compound V3",
        "description": "Reads 5 read-only liquidation-monitoring bots fresh on every call (no caching): morpho-eth-monitor, aave-eth-monitor, compound-eth-monitor on Ethereum; aave-avax-monitor on Avalanche; aave-polygon-monitor on Polygon. Returns the latest scan_summary per source (market/borrower coverage, candidate count, notional at risk) plus the top 10 most at-risk accounts across all sources combined, sorted by lowest health factor. Compound V3 has no health-factor concept (isLiquidatable() boolean) — those accounts are flagged liquidatable_now:true and ranked most urgent.",
        "operationId": "getLiquidationWatch",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "per_source scan summaries + top_at_risk accounts with chain, protocol, account, healthFactor, debtUSD"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/compound-borrowers": {
      "get": {
        "summary": "Compound V3 ETH/Base/Arb/Poly — active borrowers per market",
        "description": "Top markets by borrower count across 4 chains, with sample borrower addresses. Bot-intelligence for liquidation scanners.",
        "operationId": "getCompoundBorrowers",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Markets sorted by borrower count with sample addresses"
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/bug-intel": {
      "post": {
        "summary": "Bug Bounty Intelligence scan — AI Security Copilot for smart contracts",
        "description": "Submit a public GitHub repo for an Al-Mizaan v3 security scan. Returns a jobId. Poll /api/bug-intel/{jobId} for status. Report delivered within 24h as HTML. $5 USDC. Cheapest AI security scan on the internet.",
        "operationId": "submitBugIntel",
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "x402 payment: Base mainnet USDC transaction hash"
          }
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "5.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "repo"
                ],
                "properties": {
                  "repo": {
                    "type": "string",
                    "example": "owner/repo-name",
                    "description": "GitHub repo (owner/repo or full URL)"
                  },
                  "contact": {
                    "type": "string",
                    "example": "you@example.com",
                    "description": "Email or Telegram handle for delivery notification"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Job queued — contains jobId and pollUrl"
          },
          "400": {
            "description": "Invalid repo format or payment"
          },
          "402": {
            "description": "Payment Required — $5 USDC on Base"
          }
        }
      }
    },
    "/api/bug-intel/{jobId}": {
      "get": {
        "summary": "Poll Bug Intel job status",
        "description": "Free status endpoint. Returns status (queued/complete) and reportUrl when done.",
        "operationId": "getBugIntelStatus",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job status with reportUrl when complete"
          },
          "404": {
            "description": "Job not found"
          }
        }
      }
    }
  }
}