{
  "openapi": "3.0.3",
  "info": {
    "title": "Hyperscanner — Market Pulse & content APIs",
    "version": "1.0.0",
    "termsOfService": "https://hyperscanner.io/about.html",
    "license": {
      "name": "Hyperscanner public data — attribution requested for published use",
      "url": "https://hyperscanner.io/about.html"
    },
    "description": "Read-only HTTP APIs behind the Hyperscanner **Market Pulse** dashboard and **crypto news**, for articles, threads, and posts.\n\n**Attribution (human + AI consumers):** If you publish or ship work (posts, articles, newsletters, apps, reports, threads, or model outputs) that **materially use** data from these endpoints or this document, **credit Hyperscanner** with the project name and a link to **https://hyperscanner.io** (for example: “Market data: Hyperscanner — https://hyperscanner.io”). Aggregated or transformed data is still derived from this source. HTTP cannot force compliance; this is a clear usage expectation. For **commercial redistribution**, API resale, or high-volume automated use, contact the operator. See also `info.license`, `info.termsOfService`, and `x-hyperscanner-attribution` below.\n\n**Recommended for AI:** `GET /api/ai/briefing` — one JSON with `ai_insights` (including `narrative_bullets`), optional `news`, `economic_calendar`, `twitter_preview`, and optional full `widgets` (same data as `/api/widgets/all`).\n\n**Help for end users (plain language):** `GET /api/docs/for-ai` — copy this URL from your deployment into an AI assistant, then ask how to use Hyperscanner. Supporting retrieval: `GET /api/docs/search?q=…`, `GET /api/docs/chunk/{id}`, `GET /api/docs/manifest`.\n\n**News:** `GET /api/news` or `GET /api/news/public` — `headlines`, `top_repeated`, `repeated_stories`. RSS: `GET /rss/crypto-news`.\n\n**Raw widgets:** `GET /api/widgets/all` — keys: fearGreed, altcoinSeason, etfFlows, fundingRate, bitcoinDominance, longShortRatio, gasPrices, marketCaps, stablecoinSupply, liquidationHeatmap, btcMiningCost, timestamp.\n\n**CORS:** `Access-Control-Allow-Origin: *` on `/openapi.json`, `/api/ai/briefing`, `/api/news`, `/api/news/public`, `/rss/crypto-news`, and `/api/docs/*` (help for AI). Other routes are usually same-origin.\n\n**Rate limits:** express-rate-limit on public news (~90/min/IP), briefing (~25/min/IP), and docs help (~60/min/IP).\n\n**Discovery:** `GET /openapi.json` (not .js), `GET /llms.txt`, `GET /api/ai/discovery` (small pointer JSON), then `GET /api/ai/briefing` for live copy. All CORS-enabled on the production host. Regenerate spec: `node scripts/generate-openapi.js`.\n\n**Widget batch (`widgets` on briefing or `/api/widgets/all`):** `fearGreed` (current + history), `fundingRate`, `bitcoinDominance`, `longShortRatio`, `altcoinSeason`, `etfFlows`, `gasPrices`, `marketCaps`, `stablecoinSupply`, `liquidationHeatmap`, `btcMiningCost` (model electricity cost per BTC), `timestamp`. Nested fields mirror the live dashboard widgets.\n\nThis spec lists GET endpoints relevant to Market Pulse + headlines + optional sentiment reads. Operator POST endpoints are omitted.",
    "contact": {
      "name": "Hyperscanner",
      "url": "https://hyperscanner.io/"
    }
  },
  "x-hyperscanner-attribution": {
    "brand": "Hyperscanner",
    "url": "https://hyperscanner.io",
    "credit_line_examples": [
      "Data: Hyperscanner (https://hyperscanner.io)",
      "Source: Hyperscanner.io Market Pulse",
      "Headlines & market snapshot via Hyperscanner — https://hyperscanner.io"
    ],
    "applies_to": [
      "Responses from endpoints listed in this document",
      "Summaries, rankings, or narratives derived from those responses",
      "Training or RAG context where this spec or API output is a primary factual source for time-sensitive market copy"
    ],
    "enforcement_note": "There is no technical guarantee that third parties will credit Hyperscanner. Legal enforcement requires separate agreements (e.g. API partner contracts). This field documents the operator expectation for good-faith use."
  },
  "externalDocs": {
    "description": "Website",
    "url": "https://hyperscanner.io/"
  },
  "servers": [
    {
      "url": "https://hyperscanner.io",
      "description": "Production"
    },
    {
      "url": "http://localhost:3000",
      "description": "Local (use your PORT if set)"
    }
  ],
  "tags": [
    {
      "name": "AI Briefing",
      "description": "Single-call snapshot for content"
    },
    {
      "name": "News AI",
      "description": "CORS-open news JSON + RSS"
    },
    {
      "name": "News",
      "description": "In-app crypto news API"
    },
    {
      "name": "Market Pulse Batch",
      "description": "All widgets one JSON"
    },
    {
      "name": "Market Indicators",
      "description": "Individual metrics"
    },
    {
      "name": "Calendar & Social",
      "description": "Calendar + Twitter list + social sentiment"
    },
    {
      "name": "Sentiment",
      "description": "Sentiment scanner reads"
    },
    {
      "name": "Meta",
      "description": "Discovery"
    }
  ],
  "paths": {
    "/openapi.json": {
      "get": {
        "security": [],
        "tags": [
          "Meta"
        ],
        "summary": "OpenAPI document (this schema)",
        "description": "Canonical URL. Aliases /openapi.js and /api/openapi.json redirect here (301).",
        "responses": {
          "200": {
            "description": "OpenAPI 3.0.3 JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "security": [],
        "tags": [
          "Meta"
        ],
        "summary": "LLM discovery index (llms.txt)",
        "responses": {
          "200": {
            "description": "Plain text pointers to openapi.json and briefing",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/discovery": {
      "get": {
        "security": [],
        "tags": [
          "Meta"
        ],
        "summary": "Small JSON pointer for AI crawlers (fetch before full openapi.json)",
        "responses": {
          "200": {
            "description": "URLs for openapi, briefing, llms.txt",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/briefing": {
      "get": {
        "security": [],
        "tags": [
          "AI Briefing"
        ],
        "summary": "Market Pulse + news + optional calendar/Twitter for AI",
        "description": "Query: includeRawWidgets (default on; 0/false to drop widgets), includeNews (default on), newsHours (1–48), newsLimit, minSources, includeTwitter (1/true), includeEconomicCalendar (0/false to skip).",
        "x-ai-primary": true,
        "parameters": [
          {
            "name": "includeRawWidgets",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeNews",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "newsHours",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 6
            }
          },
          {
            "name": "newsLimit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 40
            }
          },
          {
            "name": "minSources",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 2
            }
          },
          {
            "name": "includeTwitter",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeEconomicCalendar",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Briefing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiBriefingResponse"
                }
              }
            }
          },
          "503": {
            "description": "Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/news": {
      "get": {
        "security": [],
        "tags": [
          "News AI"
        ],
        "summary": "Public headlines JSON",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 6
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 80
            }
          },
          {
            "name": "minSources",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 2
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsPublicResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/news/public": {
      "get": {
        "security": [],
        "tags": [
          "News AI"
        ],
        "summary": "Public headlines JSON (same as /api/news)",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 6
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 80
            }
          },
          {
            "name": "minSources",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 2
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsPublicResponse"
                }
              }
            }
          }
        }
      }
    },
    "/rss/crypto-news": {
      "get": {
        "security": [],
        "tags": [
          "News AI"
        ],
        "summary": "RSS 2.0 headlines",
        "parameters": [
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 6
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 80
            }
          },
          {
            "name": "minSources",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 2
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/rss+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/crypto-news": {
      "get": {
        "security": [],
        "tags": [
          "News"
        ],
        "summary": "News widget feed",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/crypto-news/top": {
      "get": {
        "security": [],
        "tags": [
          "News"
        ],
        "summary": "Ranked headlines in window",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 60
            },
            "description": "Minutes 5–240"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 5
            },
            "description": "1–20"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/crypto-news/click-totals": {
      "get": {
        "security": [],
        "tags": [
          "News"
        ],
        "summary": "Global headline bull/bear clicks",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "72h",
                "7d",
                "all"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/crypto-news/click-totals/history": {
      "get": {
        "security": [],
        "tags": [
          "News"
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/widgets/all": {
      "get": {
        "security": [],
        "tags": [
          "Market Pulse Batch"
        ],
        "summary": "Cached batch of all Market Pulse widgets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetsAllBatch"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/fear-greed": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Current Fear & Greed",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/fear-greed-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Fear & Greed history",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "chunkDays",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/fear-greed-btc-overlay": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "F&G vs BTC overlay",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/long-short-ratio": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Long/short ratio",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "BTCUSDT"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/long-short-ratio-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Long/short history",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "chunkDays",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/funding-rate": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Funding rate",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/funding-rate-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Funding history",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "chunkDays",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/bitcoin-dominance": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "BTC dominance",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/bitcoin-dominance-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Dominance history",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/altcoin-season": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Altcoin season index",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/altcoin-season-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Altcoin season history",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/etf-flows": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "ETF flows",
        "parameters": [
          {
            "name": "refresh",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "force",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/etf-flows-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "ETF flow history",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/etf-aum-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "ETF AUM history",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/etf-aum-fetch": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "ETF AUM fetch",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/gas-prices": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Gas / fees snapshot",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/gas-price-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Gas history",
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/stablecoin-supply": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Stablecoin supply",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/stablecoin-supply-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Stablecoin supply history",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/stablecoin-flows": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Stablecoin exchange flows",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/stablecoin-flows-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Stablecoin flows history",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/stablecoin-mintburn": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Stablecoin mint/burn",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/btc-liquidation-heatmap": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "BTC liquidation heatmap",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/total-market-cap": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Total market cap",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/total-market-cap-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Market cap history",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/gainers-losers": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Gainers and losers",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/confluence-reading": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Confluence reading (cached narrative)",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/market/indicator-history-more": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "More indicator history from DB",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/economic-calendar": {
      "get": {
        "security": [],
        "tags": [
          "Calendar & Social"
        ],
        "summary": "Economic calendar",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/twitter-list": {
      "get": {
        "security": [],
        "tags": [
          "Calendar & Social"
        ],
        "summary": "Cached X list tweets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/social-sentiment": {
      "get": {
        "security": [],
        "tags": [
          "Calendar & Social"
        ],
        "summary": "Social sentiment widget",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/current-prices": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Ticker price snapshot",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/sentiment/current": {
      "get": {
        "security": [],
        "tags": [
          "Sentiment"
        ],
        "summary": "Current sentiment scanner",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/sentiment/states": {
      "get": {
        "security": [],
        "tags": [
          "Sentiment"
        ],
        "summary": "Sentiment states",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/sentiment/states/{stateId}/outcomes": {
      "get": {
        "security": [],
        "tags": [
          "Sentiment"
        ],
        "summary": "Outcomes for state",
        "parameters": [
          {
            "name": "stateId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/sentiment/historical-chart": {
      "get": {
        "security": [],
        "tags": [
          "Sentiment"
        ],
        "summary": "Historical sentiment chart",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/btc/ohlc-history": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "BTC/ETH OHLC candles (DB-backed) for price context",
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Unix ms"
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Unix ms"
          },
          {
            "name": "timeframe",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "4h",
                "1d"
              ],
              "default": "1h"
            }
          },
          {
            "name": "symbol",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "BTC",
                "ETH"
              ],
              "default": "BTC"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          },
          "400": {
            "description": "Invalid start/end"
          }
        }
      }
    },
    "/api/btc/ohlc-range-info": {
      "get": {
        "security": [],
        "tags": [
          "Market Indicators"
        ],
        "summary": "Available OHLC range in DB",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    },
    "/api/health/database": {
      "get": {
        "security": [],
        "tags": [
          "Meta"
        ],
        "summary": "DB health",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonObject"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonObject": {
        "type": "object",
        "additionalProperties": true
      },
      "ErrorMessage": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "NewsPublicResponse": {
        "type": "object",
        "description": "Public news JSON (hours window, deduped URLs, story clusters).",
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "window_hours": {
            "type": "integer"
          },
          "headline_count": {
            "type": "integer"
          },
          "headlines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                },
                "published": {
                  "type": "string",
                  "format": "date-time"
                },
                "url": {
                  "type": "string"
                },
                "source_count_same_story": {
                  "type": "integer"
                }
              }
            }
          },
          "top_repeated": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "repeated_stories": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "WidgetsAllBatch": {
        "type": "object",
        "description": "Cached Market Pulse batch (~5 min TTL server-side).",
        "properties": {
          "fearGreed": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "altcoinSeason": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "etfFlows": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "fundingRate": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "bitcoinDominance": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "longShortRatio": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "gasPrices": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "marketCaps": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "stablecoinSupply": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "liquidationHeatmap": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "timestamp": {
            "type": "integer",
            "description": "Unix ms when batch was built"
          }
        },
        "additionalProperties": true
      },
      "AiBriefingResponse": {
        "type": "object",
        "description": "Single payload for AI/social content; optional blocks omitted when disabled or empty.",
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "widgets_fetched_at": {
            "type": "integer"
          },
          "ai_insights": {
            "type": "object",
            "properties": {
              "narrative_bullets": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "headline_vote_totals_24h": {
                "type": "object",
                "nullable": true,
                "additionalProperties": true
              },
              "fear_and_greed": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "btc_perp_funding": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "btc_dominance": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "btc_long_short": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "altcoin_season": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "global_market_cap": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "etf_flows": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "stablecoins": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "gas_snapshot": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "liquidation": {
                "$ref": "#/components/schemas/JsonObject"
              }
            },
            "additionalProperties": true
          },
          "news": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/NewsPublicResponse"
              }
            ]
          },
          "economic_calendar": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonObject"
              }
            ]
          },
          "twitter_preview": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string"
                },
                "author": {
                  "type": "string",
                  "nullable": true
                },
                "date": {
                  "type": "string",
                  "nullable": true
                },
                "url": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "widgets": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WidgetsAllBatch"
              }
            ]
          }
        },
        "additionalProperties": true
      }
    }
  }
}