{
 "openapi": "3.1.0",
 "info": {
  "title": "SignalPulse",
  "description": "Two-product trading intelligence platform. Product 1 — Market Analysis: natural language Q&A across FX, crypto, equities, sports, and racing; powered by an 11-layer intelligence stack; requires an analysis credit ($1.49/call). Product 2 — Trade Signals: cross-asset scanner covering 37 instruments (28 FX pairs, 4 metals/commodities, 5 global indices) plus sports and racing; returns actionable entry/SL/TP with full rationale; requires a signal credit ($2.49/call). Credit packs purchased at signalpulse.app — card or crypto. Credits are product-specific: analysis credits work only for /api/analysis; signal credits work only for signal/scan endpoints.",
  "version": "2.0.0",
  "contact": {
   "email": "info@theaslangroupllc.com"
  }
 },
 "servers": [
  {
   "url": "https://signalpulse-peach.vercel.app"
  }
 ],
 "paths": {
  "/api/instruments": {
   "get": {
    "operationId": "listInstruments",
    "summary": "List supported instruments, sports, and endpoint reference",
    "description": "Free discovery endpoint. Returns all supported instruments, sports, prediction market categories, data layers, and full endpoint documentation.",
    "x-price-usd": 0,
    "x-credit-type": "none",
    "x-agent-use-case": "Discovery — call first to understand the full universe SignalPulse covers before generating signals or analysis",
    "responses": {
     "200": {
      "description": "Full instrument and endpoint catalog",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/analysis": {
   "get": {
    "operationId": "askAnalysis",
    "summary": "Ask any market, trading, or betting question — returns a deep intelligence report",
    "description": "Natural language market analysis. Ask any question about FX, metals, commodities, indices, crypto, equities, sports, or racing and receive a professional-grade report synthesising all relevant intelligence layers. The engine detects your asset class from the question text and pulls targeted data: COT positioning for FX, TIPS real yield for gold, sharp Pinnacle odds for sports, going conditions for horse racing, FRED macro for equities. The 'data_edge' field surfaces the non-obvious factor the casual observer would miss. Costs 1 analysis credit ($1.49).",
    "x-price-usd": 1.49,
    "x-credit-type": "analysis",
    "x-agent-use-case": "Ask any question before deciding whether to generate a signal. Use to research macro context, assess a sports matchup, understand a gold breakout thesis, or sense-check an existing position. Covered asset classes: fx, metals, commodity, index, crypto, equity, sports, racing, macro.",
    "x-agent-chaining": "Use /api/analysis for research and /api/signal/* for execution. Example: ask /api/analysis 'Is EURUSD bearish this week?' then call /api/scan/forex to get the actual signal.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Natural language question. Any instrument, any asset class. Examples: 'What is the outlook for gold given current real yields?', 'Should I back Arsenal at 2.10 on Saturday?', 'Is USDJPY about to break?', 'What does today's NFP mean for my USD longs?'",
      "example": "Is gold a good buy given where real yields are?"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^sp_[a-zA-Z0-9]{40}$"
      },
      "description": "SignalPulse API key with analysis credits. Keys issued after purchasing an analysis credit pack at signalpulse.app. One analysis credit deducted per call."
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "question": {
          "type": "string",
          "description": "Alternative to ?q= query parameter"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Intelligence report with data edge and confidence assessment",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "question": {
           "type": "string"
          },
          "asset_class": {
           "type": "string",
           "enum": [
            "fx",
            "metals",
            "commodity",
            "index",
            "crypto",
            "equity",
            "sports",
            "racing",
            "macro"
           ]
          },
          "summary": {
           "type": "string",
           "description": "2-3 sentence direct answer leading with the most important insight"
          },
          "analysis": {
           "type": "object",
           "properties": {
            "key_findings": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "bullish_factors": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "bearish_factors": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "wildcards": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "time_horizon": {
             "type": "string",
             "enum": [
              "short-term (1-7d)",
              "medium-term (1-4w)",
              "long-term (1-6m)"
             ]
            }
           }
          },
          "data_edge": {
           "type": "string",
           "description": "The most non-obvious insight — specific numbers, obscure indicators, or cross-asset signals a casual observer would miss"
          },
          "outlook": {
           "type": "string",
           "enum": [
            "bullish",
            "bearish",
            "neutral",
            "mixed"
           ]
          },
          "confidence": {
           "type": "number",
           "minimum": 0,
           "maximum": 1
          },
          "confidence_note": {
           "type": "string",
           "description": "What would change this view"
          },
          "generated_at": {
           "type": "string",
           "format": "date-time"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No credits remaining — purchase analysis credits at signalpulse.app"
     },
     "403": {
      "description": "Wrong credit type — this endpoint requires analysis credits, not signal credits"
     }
    }
   },
   "post": {
    "operationId": "askAnalysisPost",
    "summary": "Ask any market question (POST body)",
    "description": "Same as GET /api/analysis but accepts the question in the request body as JSON. Use when the question is too long for a query parameter.",
    "x-price-usd": 1.49,
    "x-credit-type": "analysis",
    "security": [
     {
      "analysisCredit": []
     }
    ],
    "parameters": [
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with analysis credits."
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "question"
        ],
        "properties": {
         "question": {
          "type": "string",
          "example": "What is the macro outlook for gold over the next month?"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Intelligence report — same schema as GET /api/analysis"
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/scan/market": {
   "get": {
    "operationId": "scanMarket",
    "summary": "Institutional cross-asset market scan for AI financial & trading agents — multi-layer read across FX majors, metals, and equity indices: regime, COT positioning, yield spreads, carry, real yields, VIX term structure, options gamma, and macro, synthesized into a decision-ready read: best instrument, directional bias, confidence, full rationale, key factors.",
    "description": "Desk-quality cross-asset intelligence on demand for autonomous financial/advisor/trading agents. Returns market_theme + best_opportunity (instrument, signal, confidence, bias, the FULL multi-layer rationale, weighted key_factors). Analysis tier — exact executable entries/stops/targets and post-cost expectancy are reserved for the premium SignalPulse product. Results cached briefly per style.",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "on-demand",
    "x-agent-chaining": "Use /api/scan/market as the primary discovery endpoint when no asset class preference exists. Narrow to /api/scan/forex for FX-only. Use /api/signal/generate when you have a specific instrument. Use /api/analysis to research context before acting.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "style",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "scalp",
        "intraday",
        "longterm"
       ],
       "default": "intraday"
      },
      "description": "Trading style: scalp (1H chart, tight targets ~20 pips), intraday (4H chart, exit before NY close), longterm (daily chart, structural position).",
      "example": "intraday"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^sp_[a-zA-Z0-9]{40}$"
      },
      "description": "SignalPulse API key with signal credits. One signal credit deducted per call."
     }
    ],
    "responses": {
     "200": {
      "description": "Cross-asset scan — single best opportunity with full intelligence briefing",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "scan_type": {
           "type": "string",
           "example": "market"
          },
          "universe_scanned": {
           "type": "number",
           "example": 37
          },
          "candidates_analyzed": {
           "type": "number"
          },
          "market_theme": {
           "type": "string"
          },
          "best_opportunity": {
           "type": "object",
           "properties": {
            "instrument": {
             "type": "string"
            },
            "asset_class": {
             "type": "string",
             "enum": [
              "fx",
              "metal",
              "commodity",
              "index"
             ]
            },
            "signal": {
             "type": "string",
             "enum": [
              "BUY",
              "SELL",
              "NEUTRAL"
             ]
            },
            "confidence": {
             "type": "number"
            },
            "entry": {
             "type": "object"
            },
            "stop_loss": {
             "type": "object"
            },
            "take_profit": {
             "type": "object"
            },
            "rationale": {
             "type": "string"
            },
            "why_best": {
             "type": "string"
            },
            "intelligence_nodes_active": {
             "type": "array",
             "items": {
              "type": "string"
             }
            }
           }
          },
          "ranked_candidates": {
           "type": "array"
          },
          "no_clear_edge": {
           "type": "boolean"
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     },
     "403": {
      "description": "Wrong credit type — signal credits required"
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/scan/forex": {
   "get": {
    "operationId": "scanForex",
    "summary": "Institutional forex market scan for AI financial & trading agents — multi-layer read across the 28 majors and crosses: rate differentials, COT positioning, carry, policy divergence, yield spreads, and cross-asset macro regime, synthesized into a decision-ready read: best pair, directional bias, confidence, full rationale, key factors.",
    "description": "Desk-quality FX intelligence on demand for autonomous financial/advisor/trading agents, for a fraction of a terminal subscription. Returns market_theme + best_opportunity (instrument, signal, confidence, bias, the FULL multi-layer rationale, weighted key_factors). Analysis tier — exact executable entries/stops/targets and post-cost expectancy are reserved for the premium SignalPulse product. Results cached briefly per style.",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "on-demand",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "style",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "scalp",
        "intraday",
        "longterm"
       ],
       "default": "intraday"
      },
      "description": "Trading style: scalp (1H, ICT structure, ≤20 pip targets), intraday (4H), longterm (daily)."
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "FX scan results — best opportunity with ranked candidates",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "scan_type": {
           "type": "string"
          },
          "pairs_scanned": {
           "type": "number"
          },
          "market_theme": {
           "type": "string"
          },
          "best_opportunity": {
           "type": "object"
          },
          "ranked_candidates": {
           "type": "array"
          },
          "no_clear_edge": {
           "type": "boolean"
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     },
     "403": {
      "description": "Wrong credit type"
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/scan/event": {
   "get": {
    "operationId": "scanEvent",
    "summary": "Institutional economic-event scan for AI financial & trading agents — historical-reaction study for a scheduled macro release (NFP, CPI, FOMC and more): how the affected FX pairs have moved after similar surprises, the surprise read, macro context, and which pair has the cleanest reaction profile, with directional bias, confidence, and full rationale.",
    "description": "Desk-quality event-study intelligence on demand for autonomous financial/advisor/trading agents. Returns recommended_trade (instrument, signal, confidence, bias, the FULL historical-reaction rationale, why_this_pair, key_factors) for a scheduled macro release. Analysis tier — exact executable entry/stop/target levels are reserved for the premium SignalPulse product. Results cached briefly per event.",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "on-demand",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "event",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Economic event name. Examples: NFP, FOMC, CPI, ECB, BOE, RBA, GDP, PCE",
      "example": "NFP"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Event intelligence briefing with expected market impact and positioning guidance",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "event": {
           "type": "string"
          },
          "market_impact_summary": {
           "type": "string"
          },
          "key_pairs_to_watch": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "bullish_scenario": {
           "type": "string"
          },
          "bearish_scenario": {
           "type": "string"
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     },
     "403": {
      "description": "Wrong credit type"
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/signal/generate": {
   "get": {
    "operationId": "generateSignal",
    "summary": "Generate a trading signal for any specific instrument",
    "description": "Synthesises RSI, MACD, Bollinger Bands, ATR, EMA trend, COT institutional positioning, FRED macro indicators, and GDELT news sentiment into a complete directional signal with entry, SL, and TP for any specified instrument. Covers forex, equities, commodities, crypto, and indices. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Use when you have a specific instrument in mind. For discovery (no instrument preference), use /api/scan/market or /api/scan/forex instead.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "instrument",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Any tradable instrument ticker. Examples: EURUSD, AAPL, BTC-USD, GOLD, GC=F (gold futures), CL=F (crude oil), ^GSPC (S&P 500), XAUUSD",
      "example": "EURUSD"
     },
     {
      "name": "timeframe",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "1h",
        "4h",
        "1d",
        "3d",
        "1w",
        "1m",
        "3m"
       ]
      },
      "description": "Signal timeframe — 1h (scalping) through 3m (long-term position)",
      "example": "4h"
     },
     {
      "name": "risk_points",
      "in": "query",
      "required": false,
      "schema": {
       "type": "number"
      },
      "description": "Points/pips at risk from entry to stop-loss. Defaults to 1.5× ATR."
     },
     {
      "name": "reward_ratio",
      "in": "query",
      "required": false,
      "schema": {
       "type": "number",
       "default": 1
      },
      "description": "Risk:reward ratio. 1.0 = 1:1, 1.5 = 1:1.5, 2.0 = 1:2."
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Complete trading signal with entry, SL, TP, and intelligence rationale",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "instrument": {
           "type": "string"
          },
          "timeframe": {
           "type": "string"
          },
          "signal": {
           "type": "string",
           "enum": [
            "BUY",
            "SELL",
            "NEUTRAL"
           ]
          },
          "confidence": {
           "type": "number"
          },
          "entry": {
           "type": "object"
          },
          "stop_loss": {
           "type": "object"
          },
          "take_profit": {
           "type": "object"
          },
          "rationale": {
           "type": "string"
          },
          "key_factors": {
           "type": "array"
          },
          "risks": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "macro_context": {
           "type": "string"
          },
          "disclaimer": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/sports": {
   "get": {
    "operationId": "generateSportsPick",
    "summary": "EV-based sports pick from 35+ sports — best value bet across today's card",
    "description": "Synthesises sharp consensus odds (Pinnacle, multiple books via The Odds API), ESPN injury reports, venue weather (Open-Meteo), GDELT news sentiment, and our model probability estimates into ranked picks with explicit Expected Value calculation. The pick is the bet where our model probability most exceeds the market implied probability — not just the favourite. Covers 35+ sports: NFL, NBA, MLB, NHL, EPL, AFL, NRL, UFC/MMA, boxing, tennis, golf, cricket, esports, and all major global soccer leagues. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Sports betting edge detection — the pick is the EV-positive selection where the market is systematically wrong, backed by injury, weather, and historical pattern data.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "sport",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Sport key. Examples: nfl, nba, mlb, nhl, epl, ucl, laliga, afl, nrl, ufc, boxing, tennis, golf, cricket. Call /api/instruments for the full list.",
      "example": "nfl"
     },
     {
      "name": "event",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Team name or matchup slug — e.g., bills-chiefs, arsenal-chelsea. Omit to get best pick across all of today's card.",
      "example": "bills-chiefs"
     },
     {
      "name": "market",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "h2h",
        "spreads",
        "totals"
       ]
      },
      "description": "Focus on a specific betting market. Omit to find the best EV pick across all markets."
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "EV-ranked sports picks with explicit probability edge",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "sport": {
           "type": "string"
          },
          "scan_summary": {
           "type": "string"
          },
          "top_picks": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "pick": {
              "type": "string"
             },
             "event": {
              "type": "string"
             },
             "market": {
              "type": "string"
             },
             "market_odds": {
              "type": "number"
             },
             "implied_probability_pct": {
              "type": "number"
             },
             "our_probability_pct": {
              "type": "number"
             },
             "edge_pct": {
              "type": "number"
             },
             "confidence": {
              "type": "number"
             },
             "rationale": {
              "type": "string"
             }
            }
           }
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/racing": {
   "get": {
    "operationId": "generateRacingPick",
    "summary": "Horse racing or greyhound pick — EV-based, going conditions, form, and trap bias",
    "description": "Generates the highest-value racing pick from today's card using sharp market prices (Pinnacle/Betfair), venue weather and going conditions (Open-Meteo), form and tipster intelligence (Tavily), and GDELT sentiment. The pick is explicitly EV-based: the selection where our estimated probability most exceeds the market implied probability. For horse racing: cross-references going conditions with each runner's form history on that going. For greyhounds: trap bias, rails vs wide runner preference, and sectional times. Explains WHY the market is mis-pricing the selection. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Racing edge detection — the pick surfaces the non-obvious factor (soft ground + stamina horse, trap 1 bias at this track) that explains why the market price is wrong. Includes explicit EV calculation.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "horse",
        "greyhound"
       ],
       "default": "horse"
      },
      "description": "Racing type. horse: UK/Ireland/US/AUS horse racing. greyhound: UK/Ireland greyhound racing with trap bias analysis.",
      "example": "horse"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "EV-based racing pick with going conditions, form synthesis, and explicit probability edge",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "race_type": {
           "type": "string",
           "enum": [
            "horse_racing",
            "greyhound"
           ]
          },
          "scan_summary": {
           "type": "string"
          },
          "top_pick": {
           "type": "object",
           "properties": {
            "selection": {
             "type": "string"
            },
            "event": {
             "type": "string"
            },
            "market_odds": {
             "type": "string"
            },
            "implied_probability_pct": {
             "type": "number"
            },
            "our_probability_pct": {
             "type": "number"
            },
            "edge_pct": {
             "type": "number"
            },
            "direction": {
             "type": "string",
             "enum": [
              "back",
              "lay"
             ]
            },
            "confidence": {
             "type": "number"
            },
            "rationale": {
             "type": "string"
            },
            "key_edge": {
             "type": "string"
            }
           }
          },
          "value_picks": {
           "type": "array"
          },
          "avoid": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "market_context": {
           "type": "string"
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/polymarket": {
   "get": {
    "operationId": "scanPolymarket",
    "summary": "Scan Polymarket for prediction market mispricings",
    "description": "Fetches live Polymarket binary markets (Gamma API), cross-references with GDELT news sentiment, FRED macro data, and Tavily web context to identify markets where our data-driven probability estimate diverges from the current crowd price by more than 10 percentage points. Returns opportunities ranked by edge size. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Prediction market edge detection — identifies mispricings where fundamental data disagrees with the crowd. Best for crypto, macro, and geopolitical markets.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "category",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "crypto",
        "economics",
        "geopolitics",
        "politics"
       ]
      },
      "description": "Market category: crypto (BTC/ETH/DeFi outcomes), economics (Fed rate/inflation/recession), geopolitics (war/conflict/sanctions), politics (elections/legislation).",
      "example": "crypto"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Prediction market value opportunities ranked by edge",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "category": {
           "type": "string"
          },
          "scan_summary": {
           "type": "string"
          },
          "value_opportunities": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "question": {
              "type": "string"
             },
             "market_yes_pct": {
              "type": "number"
             },
             "our_yes_estimate_pct": {
              "type": "number"
             },
             "edge_pct": {
              "type": "number"
             },
             "direction": {
              "type": "string",
              "enum": [
               "YES",
               "NO"
              ]
             },
             "confidence": {
              "type": "string",
              "enum": [
               "high",
               "medium",
               "low"
              ]
             },
             "rationale": {
              "type": "string"
             },
             "key_data_points": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "risk_to_thesis": {
              "type": "string"
             }
            }
           }
          },
          "generated_at": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/futures": {
   "get": {
    "operationId": "signalFutures",
    "summary": "Multi-category futures signal — COT + seasonal + energy + metals + ag + softs + livestock (10 categories)",
    "description": "Full-spectrum futures intelligence engine covering 10 categories. Primary data: CFTC COT (Managed Money + Disaggregated for ag, TFF for financials), EIA weekly energy inventories, USDA FAS PSD for global crop supply/demand, SHFE warehouse inventory (Shanghai metals), CFTC Supplemental CIT for softs/livestock index trader flow, CME warehouse stocks, Treasury term premium. Signal timeframes: scalp (same-session), intraday (1-3 days), position (2-8 weeks). Categories: energy (crude/nat gas/RBOB/heating oil), metals (copper/gold/silver/platinum/palladium), agriculture (corn/wheat/soybeans via USDA), softs (coffee/sugar/cocoa/cotton via CIT), livestock (live cattle/feeder cattle/lean hogs), financial (E-Mini S&P 500/Nasdaq/T-Bonds), rates (SOFR path), fx (DXY/major pairs), crypto (BTC/ETH), all. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Futures intelligence — 10 categories, 3 signal timeframes. Use category=energy for crude/nat gas, metals for copper/gold, agriculture for grain seasonals, softs for coffee/sugar/cotton index flows, financial for equity index futures, all for the best current setup across all categories.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "category",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "energy",
        "metals",
        "agriculture",
        "softs",
        "livestock",
        "financial",
        "rates",
        "fx",
        "crypto",
        "all"
       ],
       "default": "all"
      },
      "description": "Futures category. energy = crude/nat gas/RBOB/heating oil (EIA inventories + COT). metals = copper/gold/silver/platinum (COT + SHFE stocks). agriculture = corn/wheat/soybeans (USDA FAS PSD + seasonal patterns + COT). softs = coffee/sugar/cocoa/cotton (CFTC Supplemental CIT index trader flow). livestock = live cattle/feeder cattle/lean hogs (CIT + seasonal). financial = E-Mini S&P 500/Nasdaq/T-Bonds (TFF COT). rates = SOFR quarterly path. fx = DXY/majors. crypto = BTC/ETH perps. all = best setup across all (default). Note: market=grains is a legacy alias for agriculture.",
      "example": "energy"
     },
     {
      "name": "signal_type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "scalp",
        "intraday",
        "position"
       ],
       "default": "intraday"
      },
      "description": "Signal timeframe: scalp = same-session (session timing + momentum focus); intraday = 1-3 days (catalyst timing + COT extremes); position = 2-8 weeks (COT positioning + fundamentals dominant).",
      "example": "position"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Ranked futures signal with COT positioning analysis",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "market": {
           "type": "string"
          },
          "signal": {
           "type": "string",
           "enum": [
            "LONG",
            "SHORT",
            "NEUTRAL",
            "WAIT"
           ]
          },
          "contract": {
           "type": "string"
          },
          "direction": {
           "type": "string"
          },
          "confidence": {
           "type": "number"
          },
          "positioning_edge": {
           "type": "string"
          },
          "rationale": {
           "type": "string"
          },
          "key_signals": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "signal": {
              "type": "string"
             },
             "category": {
              "type": "string"
             },
             "direction": {
              "type": "string"
             },
             "weight": {
              "type": "string"
             }
            }
           }
          },
          "top_picks": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "rank": {
              "type": "number"
             },
             "contract": {
              "type": "string"
             },
             "direction": {
              "type": "string"
             },
             "confidence": {
              "type": "number"
             },
             "cot_edge": {
              "type": "string"
             },
             "entry_note": {
              "type": "string"
             },
             "stop_note": {
              "type": "string"
             },
             "hold_period": {
              "type": "string"
             }
            }
           }
          },
          "rate_path_signal": {
           "type": [
            "string",
            "null"
           ]
          },
          "cot_extremes": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "avoid": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "data_confidence": {
           "type": "string"
          },
          "generated_at": {
           "type": "string"
          },
          "valid_for": {
           "type": "string"
          },
          "disclaimer": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "market_scope": {
             "type": "string"
            },
            "cot_records": {
             "type": "number"
            },
            "rate_path_available": {
             "type": "boolean"
            },
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/equities": {
   "get": {
    "operationId": "signalEquities",
    "summary": "Institutional single-name equities scan for AI financial & trading agents — multi-layer read for any US ticker: dealer-gamma regime, VWAP/ORB/momentum, short interest and borrow, options skew/VRP, fundamentals, earnings drift, sector relative strength, insider and macro tide, synthesized into a directional signal, confidence, the primary edge, and full rationale.",
    "description": "Desk-quality single-name equity intelligence on demand for autonomous financial/advisor/trading agents. Returns the directional signal (LONG/SHORT/WAIT), confidence, primary_edge, full rationale, and key_signals for any US ticker across three horizons (day_trade/mid_term/long_term). Analysis tier — the exact executable trade plan (entry, stop, target, sizing) is reserved for the premium SignalPulse product. Results cached briefly per ticker/horizon.",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "on-demand",
    "x-agent-chaining": "Combine with /api/signal/screener to first find the best candidate, then call /api/signal/equities?ticker={top_pick} for a detailed signal. For options overlay on the equity: follow with /api/signal/options?ticker={ticker}&signal_type=mid_term.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "ticker",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Stock ticker symbol. US equities work best (NYSE, NASDAQ). For day_trade: SPY, QQQ, AAPL, NVDA, TSLA, AMD, META have highest liquidity and best intraday data. For long_term: any S&P 500 constituent.",
      "example": "NVDA"
     },
     {
      "name": "signal_type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "day_trade",
        "mid_term",
        "long_term"
       ],
       "default": "mid_term"
      },
      "description": "Trading horizon: day_trade = same-day only (VWAP + ORB primary signals; hold until 3:45pm ET max); mid_term = 2-8 week swing (technical + fundamental catalyst primary); long_term = 6-24 months (business quality + valuation primary). Default: mid_term.",
      "example": "day_trade"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Long-only equity signal with entry, stop, target, and detailed rationale",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ticker": {
           "type": "string"
          },
          "company_name": {
           "type": "string"
          },
          "signal_type": {
           "type": "string",
           "enum": [
            "day_trade",
            "mid_term",
            "long_term"
           ]
          },
          "signal": {
           "type": "string",
           "enum": [
            "LONG",
            "WAIT"
           ]
          },
          "confidence": {
           "type": "number"
          },
          "recommended_action": {
           "type": "string"
          },
          "rationale": {
           "type": "string"
          },
          "primary_edge": {
           "type": "object"
          },
          "trade_detail": {
           "type": "object",
           "properties": {
            "entry": {
             "type": "string"
            },
            "stop_loss": {
             "type": "string"
            },
            "target": {
             "type": "string"
            },
            "hold_period": {
             "type": "string"
            },
            "position_sizing": {
             "type": "string"
            }
           }
          },
          "key_signals": {
           "type": "array",
           "items": {
            "type": "object"
           }
          },
          "technical_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "fundamental_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "catalyst_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "squeeze_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "insider_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "analyst_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "avoid_if": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "data_confidence": {
           "type": "string"
          },
          "generated_at": {
           "type": "string"
          },
          "valid_for": {
           "type": "string"
          },
          "disclaimer": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "signal_type": {
             "type": "string"
            },
            "quality_score": {
             "type": [
              "number",
              "null"
             ]
            },
            "growth_score": {
             "type": [
              "number",
              "null"
             ]
            },
            "squeeze_potential": {
             "type": [
              "number",
              "null"
             ]
            },
            "short_volume_pct": {
             "type": [
              "number",
              "null"
             ]
            },
            "vwap_position": {
             "type": [
              "string",
              "null"
             ]
            },
            "or_status": {
             "type": [
              "string",
              "null"
             ]
            },
            "next_earnings": {
             "type": [
              "string",
              "null"
             ]
            },
            "analyst_consensus": {
             "type": [
              "string",
              "null"
             ]
            },
            "analyst_upside_pct": {
             "type": [
              "number",
              "null"
             ]
            },
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Missing ticker parameter"
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     },
     "403": {
      "description": "Wrong credit type"
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/signal/screener": {
   "get": {
    "operationId": "signalScreener",
    "summary": "Global equity screener signal — best setup across 12 exchanges",
    "description": "Scans 10-20 liquid large-caps on any of 12 global exchanges, scores each candidate using a quantitative model (momentum 30pts, RSI 25pts, volume ratio 25pts, technical structure 20pts), then generates an AI-synthesised signal for the single best setup. Covers: NYSE, NASDAQ, LSE (London), ASX (Australia), TSE (Tokyo), HKEX (Hong Kong), NSE (India), TSX (Canada), XETRA (Germany/Frankfurt), KOSPI (Korea), B3 (Brazil), Euronext (Paris/Amsterdam). Criteria modes: momentum (trend + volume), value (oversold bounce), squeeze (short interest reversal), breakout (52-week highs). Includes insider activity signal from SEC EDGAR Form 4 for US tickers. Returns ranked candidates + top pick with entry, target, stop, hold period, and market breadth note. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Equity screening — use when you want the best stock setup on a specific exchange or globally. Best for swing trades (1-3 weeks). Combine with /api/signal/options for the follow-on options play on the screener's top pick.",
    "x-agent-chaining": "Run screener first, then call /api/signal/options?ticker={top_pick}&signal_type=mid_term for the options signal on the highest-scoring equity.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "exchange",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "NYSE",
        "NASDAQ",
        "LSE",
        "ASX",
        "TSE",
        "HKEX",
        "NSE",
        "TSX",
        "XETRA",
        "KOSPI",
        "B3",
        "Euronext"
       ],
       "default": "NASDAQ"
      },
      "description": "Exchange to screen. NYSE/NASDAQ = US large-caps. LSE = UK. ASX = Australia. TSE = Japan. HKEX = Hong Kong/China. NSE = India. TSX = Canada. XETRA = Germany. KOSPI = Korea. B3 = Brazil. Euronext = Paris/Amsterdam. Default: NASDAQ.",
      "example": "NASDAQ"
     },
     {
      "name": "criteria",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "momentum",
        "value",
        "squeeze",
        "breakout",
        "all"
       ],
       "default": "all"
      },
      "description": "Screening strategy: momentum = strong price + volume trend. value = oversold at support, bounce setup. squeeze = high short interest + volume surge + reversal. breakout = 52-week highs + resistance cleared. all = best setup across all criteria (default).",
      "example": "momentum"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Screener signal with ranked candidates and top pick",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "exchange": {
           "type": "string"
          },
          "criteria": {
           "type": "string"
          },
          "top_pick": {
           "type": "object",
           "properties": {
            "ticker": {
             "type": "string"
            },
            "name": {
             "type": "string"
            },
            "direction": {
             "type": "string"
            },
            "confidence": {
             "type": "number"
            },
            "signal_type": {
             "type": "string"
            },
            "entry_note": {
             "type": "string"
            },
            "target_note": {
             "type": "string"
            },
            "stop_note": {
             "type": "string"
            },
            "hold_period": {
             "type": "string"
            },
            "rationale": {
             "type": "string"
            }
           }
          },
          "ranked_picks": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "rank": {
              "type": "number"
             },
             "ticker": {
              "type": "string"
             },
             "name": {
              "type": "string"
             },
             "score": {
              "type": "number"
             },
             "signal": {
              "type": "string"
             },
             "key_reason": {
              "type": "string"
             }
            }
           }
          },
          "market_breadth": {
           "type": "string"
          },
          "exchange_context": {
           "type": "string"
          },
          "avoid": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "generated_at": {
           "type": "string"
          },
          "disclaimer": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "exchange": {
             "type": "string"
            },
            "criteria": {
             "type": "string"
            },
            "candidates_scanned": {
             "type": "number"
            },
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid exchange or criteria parameter"
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/signal/options": {
   "get": {
    "operationId": "signalOptions",
    "summary": "Options intelligence signal — 0DTE / Mid-Term / LEAPs (GEX + VRP + UOA + VIX term structure)",
    "description": "Three-tier options signal engine covering the full options lifecycle. Signal type determines the primary intelligence stack: 0DTE (same-day) focuses on GEX (gamma exposure) — whether market makers are suppressing or amplifying moves; Mid-Term (7-45 DTE) focuses on VRP (variance risk premium) + unusual activity + IV term structure; LEAPs (>1 year) focuses on long-dated IV premium and VIX1Y/VIX ratio. Intelligence nodes include: GEX (Black-Scholes computed from Yahoo Finance chains, with call wall/put wall/gamma flip level), VIX full term structure (VIX1D through VIX1Y), CBOE P/C ratios (equity/total/index), NSE India VIX + NIFTY PCR (global vol regime), VRP, UOA (volume/OI sweeps), max pain, IV term structure. Returns specific strategy structure with strikes, expiry, entry/exit conditions, and key signal breakdown. Costs 1 signal credit ($2.49).",
    "x-price-usd": 2.49,
    "x-credit-type": "signal",
    "x-agent-use-case": "Options intelligence — call with signal_type=0dte for same-day gamma plays (SPY/QQQ/SPX best), mid_term for weekly/monthly VRP and flow-based setups, leaps for 12-18 month structural vol plays. Combine with /api/analysis for macro context before entering.",
    "x-agent-chaining": "For 0DTE: call at market open (9:35am ET) or after 2pm ET for final-hour pinning setup. For mid-term: call anytime for UOA and VRP edge. For LEAPs: call once per week — VIX1Y signal changes slowly.",
    "security": [
     {
      "signalCredit": []
     }
    ],
    "parameters": [
     {
      "name": "ticker",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Stock or ETF ticker. For 0DTE: SPY, QQQ, IWM, SPX work best (highest 0DTE liquidity). For mid-term: any liquid equity with options (AAPL, NVDA, TSLA, META). For LEAPs: major indices and mega-caps (SPY, QQQ, AAPL, MSFT, NVDA).",
      "example": "SPY"
     },
     {
      "name": "signal_type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "0dte",
        "mid_term",
        "leaps"
       ],
       "default": "mid_term"
      },
      "description": "Options timeframe: 0dte = same-day expiry (GEX + max pain + VIX1D primary); mid_term = 7-45 DTE weekly/monthly (VRP + UOA + IV structure primary); leaps = >1 year expiry (VIX1Y/VIX ratio + long-dated IV premium primary). Default: mid_term.",
      "example": "0dte"
     },
     {
      "name": "strategy",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "buy_vol",
        "sell_vol",
        "directional"
       ]
      },
      "description": "Optional strategy filter. buy_vol = cheap vol / straddle opportunities. sell_vol = expensive premium to sell. directional = call or put buys. Omit for best available signal.",
      "example": "sell_vol"
     },
     {
      "name": "X-API-KEY",
      "in": "header",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "SignalPulse API key with signal credits."
     }
    ],
    "responses": {
     "200": {
      "description": "Options intelligence signal with strategy recommendation",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ticker": {
           "type": "string"
          },
          "signal_type": {
           "type": "string",
           "enum": [
            "0dte",
            "mid_term",
            "leaps"
           ]
          },
          "spot_price": {
           "type": "number"
          },
          "recommended_strategy": {
           "type": "string"
          },
          "signal": {
           "type": "string",
           "enum": [
            "SELL_VOL",
            "BUY_VOL",
            "BULLISH",
            "BEARISH",
            "NEUTRAL"
           ]
          },
          "confidence": {
           "type": "number"
          },
          "rationale": {
           "type": "string"
          },
          "primary_edge": {
           "type": "object",
           "properties": {
            "type": {
             "type": "string"
            },
            "description": {
             "type": "string"
            },
            "weight": {
             "type": "string"
            }
           }
          },
          "strategy_detail": {
           "type": "object",
           "properties": {
            "structure": {
             "type": "string"
            },
            "strikes": {
             "type": "string"
            },
            "expiry": {
             "type": "string"
            },
            "max_risk": {
             "type": "string"
            },
            "target_exit": {
             "type": "string"
            },
            "entry_note": {
             "type": "string"
            }
           }
          },
          "key_signals": {
           "type": "array",
           "items": {
            "type": "object"
           }
          },
          "gex_context": {
           "type": [
            "string",
            "null"
           ],
           "description": "GEX regime, call wall, put wall, gamma flip level. Required for 0dte."
          },
          "vrp_signal": {
           "type": [
            "string",
            "null"
           ]
          },
          "unusual_activity": {
           "type": [
            "string",
            "null"
           ]
          },
          "max_pain_context": {
           "type": [
            "string",
            "null"
           ]
          },
          "iv_structure": {
           "type": [
            "string",
            "null"
           ]
          },
          "leaps_context": {
           "type": [
            "string",
            "null"
           ],
           "description": "VIX1Y/VIX ratio, long-dated vol premium. Required for leaps."
          },
          "avoid_if": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "opex_week": {
           "type": "boolean"
          },
          "data_confidence": {
           "type": "string"
          },
          "generated_at": {
           "type": "string"
          },
          "valid_for": {
           "type": "string"
          },
          "disclaimer": {
           "type": "string"
          },
          "_meta": {
           "type": "object",
           "properties": {
            "signal_type": {
             "type": "string"
            },
            "gex_regime": {
             "type": [
              "string",
              "null"
             ]
            },
            "gex_total_bn": {
             "type": [
              "number",
              "null"
             ]
            },
            "call_wall": {
             "type": [
              "number",
              "null"
             ]
            },
            "put_wall": {
             "type": [
              "number",
              "null"
             ]
            },
            "vix1d": {
             "type": [
              "number",
              "null"
             ]
            },
            "vix": {
             "type": [
              "number",
              "null"
             ]
            },
            "vix1y": {
             "type": [
              "number",
              "null"
             ]
            },
            "cboe_total_pc": {
             "type": [
              "number",
              "null"
             ]
            },
            "nse_india_vix": {
             "type": [
              "number",
              "null"
             ]
            },
            "credits_remaining": {
             "type": "number"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Missing required ticker parameter"
     },
     "401": {
      "description": "Invalid or missing API key"
     },
     "402": {
      "description": "No signal credits remaining"
     },
     "403": {
      "description": "Wrong credit type"
     }
    }
   }
  },
  "/api/auth/usage": {
   "get": {
    "operationId": "checkUsage",
    "summary": "Check API key usage and credits remaining",
    "description": "Returns the current status, credit type, and remaining balance for an API key. Use to check how many credits remain before making signal or analysis calls.",
    "x-price-usd": 0,
    "x-credit-type": "none",
    "parameters": [
     {
      "name": "key",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "The API key to check",
      "example": "sp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
     }
    ],
    "responses": {
     "200": {
      "description": "Key status and credit balance",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "active": {
           "type": "boolean"
          },
          "status": {
           "type": "string",
           "enum": [
            "active",
            "pending",
            "cancelled",
            "expired"
           ]
          },
          "plan": {
           "type": "string"
          },
          "credit_type": {
           "type": "string",
           "enum": [
            "analysis",
            "signal"
           ],
           "description": "Which product this key's credits work for"
          },
          "signals_remaining": {
           "type": "number",
           "description": "Credits remaining (analysis or signal, depending on credit_type)"
          },
          "signals_total": {
           "type": "number"
          },
          "expires_at": {
           "type": [
            "string",
            "null"
           ]
          },
          "is_expired": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "Key not found"
     }
    }
   }
  },
  "/api/scan/crypto": {
   "get": {
    "summary": "Institutional-grade crypto market scan for AI financial & trading agents — 40+ live intelligence layers (regime, breadth, on-chain cycle, derivatives positioning, funding extremes, liquidation context, ETF/stablecoin flows) synthesized into a decision-ready read: directional bias, confidence, full rationale, key factors, adversarial pre-mortem.",
    "description": "Desk-quality crypto intelligence on demand for autonomous financial/advisor/trading agents, for a fraction of a terminal subscription. Returns market_theme + best_opportunity (instrument, signal, confidence, bias, the FULL multi-layer rationale, weighted key_factors, premortem). Analysis tier — exact executable entries/stops/targets and post-cost expectancy are reserved for the premium SignalPulse product. Results cached briefly per style for fast, low-cost delivery.",
    "x-agent-use-case": "on-demand",
    "parameters": [
     {
      "name": "style",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "scalp",
        "intraday",
        "swing"
       ],
       "example": "intraday"
      },
      "description": "Scan horizon"
     }
    ],
    "responses": {
     "200": {
      "description": "Analysis-tier crypto scan (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/signal/pre-ipo": {
   "get": {
    "summary": "Pre-IPO intelligence for AI financial & trading agents — built for pre-IPO perpetual futures (reference a private companys TOTAL EQUITY VALUATION). Synthesizes last private valuation, funding history, growth, public-comp implied range, perp-implied valuation vs private marks, perp positioning, IPO-timing, catalysts & risks into a decision-ready read. Covers SpaceX, OpenAI, Anthropic, Stripe & more.",
    "description": "Analysis tier for agents (valuation read, premium/discount, funding signal, bias, full rationale). The executable perp trade (entry valuation, sizing, EV) is premium-only.",
    "x-agent-use-case": "on-demand",
    "x-agent-audience": "financial-agents, pre-ipo-trading-agents, advisor-agents",
    "parameters": [
     {
      "name": "company",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "example": "spacex"
      },
      "description": "Private company (spacex|openai|anthropic|stripe|...)"
     },
     {
      "name": "comp_ticker",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "example": "NVDA"
      },
      "description": "Optional public comparable ticker for the comp cross-check"
     },
     {
      "name": "lang",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Response language code"
     }
    ],
    "responses": {
     "200": {
      "description": "Decision-ready pre-IPO brief (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($1.00) for the agent analysis tier."
     }
    }
   }
  },
  "/api/scan/options": {
   "get": {
    "summary": "Institutional equity-options volatility scan for AI financial & trading agents — VRP (variance risk premium), IV term structure, GEX regime, max-pain and unusual options activity across liquid optionable names, synthesized into a decision-ready read: best ticker, vol/directional bias, confidence, full rationale, key factors.",
    "description": "Desk-quality options intelligence on demand for autonomous financial/advisor/trading agents. Returns best_opportunity (ticker, signal, confidence, bias, the FULL multi-layer rationale across VRP + IV structure + GEX, key_factors) plus market context. Analysis tier — the exact executable trade structure (strikes, expiry, premium/credit) is reserved for the premium SignalPulse product. Results cached briefly per signal_type/strategy for fast, low-cost delivery.",
    "x-agent-use-case": "on-demand",
    "parameters": [
     {
      "name": "signal_type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "0dte",
        "mid_term",
        "leaps"
       ],
       "example": "mid_term"
      },
      "description": "Options horizon"
     },
     {
      "name": "strategy",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "sell_vol",
        "buy_vol",
        "directional",
        "best_available"
       ],
       "example": "best_available"
      },
      "description": "Strategy filter"
     }
    ],
    "responses": {
     "200": {
      "description": "Analysis-tier options scan (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/scan/futures": {
   "get": {
    "summary": "Institutional futures market scan for AI financial & trading agents — multi-layer read across the futures complex (equity index, rates, energy, metals, grains): COT positioning (disaggregated + financial), seasonality, term structure, and macro regime, synthesized into a decision-ready read: best contract, directional bias, confidence, full rationale, key factors.",
    "description": "Desk-quality futures intelligence on demand for autonomous financial/advisor/trading agents. Returns market_theme + best_opportunity (contract, signal, confidence, bias, the FULL multi-layer rationale, key_factors). Analysis tier — exact executable entries/stops/targets and post-cost expectancy are reserved for the premium SignalPulse product. Results cached briefly per style.",
    "x-agent-use-case": "on-demand",
    "parameters": [
     {
      "name": "style",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "scalp",
        "intraday",
        "longterm"
       ],
       "example": "intraday"
      },
      "description": "Scan horizon"
     }
    ],
    "responses": {
     "200": {
      "description": "Analysis-tier futures scan (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/signal/tokenized": {
   "get": {
    "summary": "Tokenized-equity premium/discount scan for AI financial & trading agents — the live gap between a 24/7 on-chain tokenized stock (NVDAx, TSLAx, GOOGLx and peers) and its underlying share: premium/discount in bps, rich-or-cheap, US session state, on-chain liquidity, and a mean-reversion read. Unique alpha that exists only on-chain.",
    "description": "Desk-quality tokenized-equity intelligence on demand for autonomous financial/advisor/trading agents managing tokenized-stock books. Returns underlying vs tokenized price, the premium/discount in bps, token_rich_or_cheap, US market session, on-chain liquidity, mean_reversion_read, confidence and rationale. Analysis tier — the executable arbitrage (leg sizing, entry/exit gap levels, net capture after fees and gas, venues) is reserved for the premium SignalPulse product. Cached briefly per ticker.",
    "x-agent-use-case": "on-demand",
    "parameters": [
     {
      "name": "ticker",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "example": "NVDA"
      },
      "description": "Tokenized US equity ticker (NVDA, TSLA, GOOGL, AAPL, SPY)"
     }
    ],
    "responses": {
     "200": {
      "description": "Analysis-tier tokenized premium/discount read (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.50) for the agent analysis tier."
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents, trading-agents"
   }
  },
  "/api/signal/tokenization-radar": {
   "get": {
    "summary": "Equity tokenization radar for AI financial & advisor agents — what is going on-chain and when: tokenization status for any US ticker (live / pending / none), on-chain dividend handling, and forward tokenization catalysts (new tokenized-stock listings, RWA issuance, DTCC pilots). The cheap top-of-funnel read for agents tracking tokenized equities.",
    "description": "Low-cost discovery intelligence for autonomous financial/advisor agents tracking the migration of equities on-chain. With a ticker: tokenization_status (verified live via on-chain DEX presence), dividend yield, on-chain dividend handling note, and sourced catalysts. Without a ticker: the forward tokenization-catalyst radar across issuers and venues. Cached per ticker.",
    "x-agent-use-case": "on-demand",
    "parameters": [
     {
      "name": "ticker",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "example": "NVDA"
      },
      "description": "Optional US equity ticker; omit for the forward radar"
     }
    ],
    "responses": {
     "200": {
      "description": "Tokenization radar (JSON)."
     },
     "402": {
      "description": "Payment required — x402 USDC ($0.25) for the agent tier."
     }
    },
    "x-agent-audience": "financial-agents, advisor-agents"
   }
  }
 },
 "components": {
  "securitySchemes": {
   "analysisCredit": {
    "type": "apiKey",
    "in": "header",
    "name": "X-API-KEY",
    "description": "SignalPulse API key loaded with analysis credits. Analysis credits are purchased at signalpulse.app (1 credit = $1.49, 10 credits = $9.99). One credit is deducted per call to /api/analysis. Purchase URL: https://signalpulse.app#analysis"
   },
   "signalCredit": {
    "type": "apiKey",
    "in": "header",
    "name": "X-API-KEY",
    "description": "SignalPulse API key loaded with signal credits. Signal credits are purchased at signalpulse.app (1 credit = $2.49, 10 credits = $16.99). One credit is deducted per call to any /api/scan/* or /api/signal/* endpoint. Purchase URL: https://signalpulse.app#signals"
   }
  }
 }
}
