{
  "openapi": "3.1.0",
  "info": {
    "title": "SML Fractal Trading OS",
    "version": "2.11.1",
    "description": "ScriptMasterLabs agent-native market modeling service for real-data quotes, history, options telemetry, fractal matching, basket context, cycle/harmonic evidence, and guarded strategy evaluation. The public Fractal service is not itself an x402 paywall; paid ecosystem capabilities are discovered through SqueezeOS/MCP."
  },
  "servers": [
    {
      "url": "https://sml-fractal-trading-os-v2.onrender.com"
    }
  ],
  "tags": [
    {
      "name": "system"
    },
    {
      "name": "market-data"
    },
    {
      "name": "fractal"
    },
    {
      "name": "options"
    },
    {
      "name": "strategy"
    },
    {
      "name": "ecosystem"
    },
    {
      "name": "cycle-pulse"
    },
    {
      "name": "oos-evidence",
      "description": "Free frozen-prediction aggregate, five-day verification and matched always-long benchmark"
    },
    {
      "name": "forecast-court",
      "description": "Verified frozen claims, live competitive evidence and outcome receipts; no trading/stakes"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "Service is healthy"
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "tags": [
          "system"
        ],
        "summary": "Provider and runtime status",
        "responses": {
          "200": {
            "description": "Current runtime/provider status"
          }
        }
      }
    },
    "/api/quotes": {
      "get": {
        "tags": [
          "market-data"
        ],
        "summary": "Fetch live quotes from configured real-data providers",
        "parameters": [
          {
            "name": "symbols",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated US equity symbols"
          }
        ],
        "responses": {
          "200": {
            "description": "Quote data returned"
          },
          "503": {
            "description": "No quote provider succeeded; response remains truthful and does not fabricate data"
          }
        }
      }
    },
    "/api/history/{symbol}": {
      "get": {
        "tags": [
          "market-data"
        ],
        "summary": "Fetch historical bars",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "multiplier",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            }
          },
          {
            "name": "timespan",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "hour",
                "minute"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical bars with source attribution"
          }
        }
      }
    },
    "/api/options/{symbol}": {
      "get": {
        "tags": [
          "options"
        ],
        "summary": "Scan an options chain using configured real market data",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "call",
                "put"
              ]
            }
          },
          {
            "name": "minDte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "maxDte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 90
            }
          },
          {
            "name": "maxSpreadPct",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Options telemetry and filtered contracts"
          }
        }
      }
    },
    "/api/fractal/{symbol}": {
      "get": {
        "tags": [
          "fractal"
        ],
        "summary": "Run multi-scale historical fractal matching",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "window",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "horizon",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "top",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Fractal match evidence, source provenance, and forward-path modeling"
          }
        }
      }
    },
    "/api/basket": {
      "get": {
        "tags": [
          "fractal"
        ],
        "summary": "Compute current basket context",
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Basket context"
          }
        }
      }
    },
    "/api/strategy/evaluate": {
      "post": {
        "tags": [
          "strategy"
        ],
        "summary": "Evaluate a strategy candidate without silently placing a trade",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Strategy evaluation"
          }
        }
      }
    },
    "/api/sml/catalog": {
      "get": {
        "tags": [
          "ecosystem"
        ],
        "summary": "Discover related ScriptMasterLabs capabilities",
        "responses": {
          "200": {
            "description": "Dynamic ScriptMasterLabs ecosystem catalog and trading-relevant capability links"
          }
        }
      }
    },
    "/api/cycle-pulse/status": {
      "get": {
        "tags": [
          "cycle-pulse"
        ],
        "summary": "Check Cycle Pulse projection, scanner, provider, and access readiness",
        "responses": {
          "200": {
            "description": "Cycle Pulse readiness, personal/private access mode, app route, 62-bar projection horizon, and scanner limit"
          }
        }
      }
    },
    "/api/cycle-pulse/snapshot": {
      "get": {
        "tags": [
          "cycle-pulse"
        ],
        "summary": "Fetch real daily OHLCV and a current quote for any Cycle Pulse symbol",
        "security": [],
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "AMC",
              "pattern": "^[A-Z][A-Z0-9.-]{0,9}$"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tradier-attributed daily OHLCV, current quote, rate-limit evidence, and cache state"
          },
          "400": {
            "description": "Invalid symbol or date range; no charge and no fabricated substitute"
          },
          "401": {
            "description": "Returned only when personal mode is disabled and the private key is missing or invalid"
          },
          "429": {
            "description": "Personal request window or provider-call budget is cooling down"
          },
          "503": {
            "description": "Real-data provider unavailable or not configured; truthful alternatives returned"
          }
        }
      }
    },
    "/api/cycle-pulse/scan": {
      "get": {
        "tags": [
          "cycle-pulse"
        ],
        "summary": "Rank an editable symbol universe for bullish and bearish daily breakouts",
        "security": [],
        "parameters": [
          {
            "name": "symbols",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "AMC,GME,IWM,SPY,QQQ"
            },
            "description": "Comma-separated unique symbols; maximum 18"
          },
          {
            "name": "start",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked breakout candidates with direction, score, state, trigger, distance, volume ratio, ATR, compression, and per-symbol failures"
          },
          "400": {
            "description": "Invalid universe or date range"
          },
          "401": {
            "description": "Returned only when personal mode is disabled and the private key is missing or invalid"
          },
          "429": {
            "description": "Personal request window or provider-call budget is cooling down"
          },
          "503": {
            "description": "Real-data provider unavailable; no fabricated scan results returned"
          }
        }
      }
    },
    "/api/oos/decision": {
      "get": {
        "tags": [
          "oos-evidence"
        ],
        "operationId": "getFractalOosDecision",
        "summary": "Read verified GME forecast track record and same-window baseline",
        "description": "Returns aggregate counts, bullish/bearish historical directional hit rates, the matched always-long baseline, risk flags and guarded next-action label. Neither the endpoint nor its confidence bounds establish tradable profit. No private forecast snapshots, trades or learned weights exposed.",
        "responses": {
          "200": {
            "description": "Verified live aggregate and descriptive matched-baseline evaluation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "schema_version",
                    "state",
                    "action",
                    "evidence",
                    "live_trading_authorized"
                  ],
                  "properties": {
                    "schema_version": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string"
                    },
                    "live_trading_authorized": {
                      "type": "boolean",
                      "const": false
                    },
                    "evidence": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Ledger unavailable or aggregate not ready; do not infer performance"
          }
        }
      }
    },
    "/api/forecast-court/status": {
      "get": {
        "tags": [
          "forecast-court"
        ],
        "summary": "Court evidence ledger and claims/access readiness",
        "responses": {
          "200": {
            "description": "Court status"
          },
          "503": {
            "description": "Ledger unavailable"
          }
        }
      }
    },
    "/api/forecast-court/leaderboard": {
      "get": {
        "tags": [
          "forecast-court"
        ],
        "summary": "Independent live model-versus-baseline Arena leaderboard",
        "responses": {
          "200": {
            "description": "Verified frozen forecast scorecard and Court competitors"
          },
          "503": {
            "description": "Evidence unavailable; no stale-data substitution"
          }
        }
      }
    },
    "/api/forecast-court/receipts/{claim_id}": {
      "get": {
        "tags": [
          "forecast-court"
        ],
        "summary": "Public tamper-checked immutable forecast and outcome receipt",
        "parameters": [
          {
            "name": "claim_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Frozen snapshot SHA256, real five-session evidence when resolved"
          },
          "404": {
            "description": "Unknown claim"
          },
          "503": {
            "description": "Integrity check failure"
          }
        }
      }
    },
    "/api/forecast-court/claims": {
      "post": {
        "tags": [
          "forecast-court"
        ],
        "summary": "Owner-authenticated publication of new five-session market claim",
        "security": [
          {
            "courtOwnerKey": []
          }
        ],
        "description": "Requires public:true consent and is accepted only after market close when server-side Tradier completed daily bar is current. No users can self-register or gain authenticated access until a separate credential onboarding is deployed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "public",
                  "symbol",
                  "strategy_key",
                  "strategy_label",
                  "side"
                ],
                "properties": {
                  "public": {
                    "type": "boolean",
                    "const": true
                  },
                  "symbol": {
                    "type": "string",
                    "example": "GME"
                  },
                  "strategy_key": {
                    "type": "string",
                    "example": "community-research-1"
                  },
                  "strategy_label": {
                    "type": "string"
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "up",
                      "down"
                    ]
                  },
                  "horizon_sessions": {
                    "type": "integer",
                    "const": 5
                  },
                  "expected_return_5d": {
                    "type": "number"
                  },
                  "client_reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Immutable accepted claim and SHA256 checksum"
          },
          "400": {
            "description": "Invalid claim/consent"
          },
          "403": {
            "description": "Owner credential required"
          },
          "409": {
            "description": "Market closed/not confirmed or duplicate reference"
          },
          "503": {
            "description": "Real data unavailable; claim not frozen"
          }
        }
      }
    },
    "/api/forecast-court/resolve": {
      "post": {
        "tags": [
          "forecast-court"
        ],
        "security": [
          {
            "courtOwnerKey": []
          }
        ],
        "summary": "Owner-triggered resolution of previously frozen mature claims using real future Tradier bars",
        "responses": {
          "200": {
            "description": "Batch result"
          },
          "403": {
            "description": "Owner credential required"
          },
          "503": {
            "description": "Provider/storage unavailable"
          }
        }
      }
    },
    "/api/forecast-court/jev-jury": {
      "get": {
        "summary": "Verified TypeSafe Jev five-juror research assessment and Ed25519 receipt",
        "description": "Returns genuine provider-sourced and signed five-juror output, explicit pending status, or fail-closed 503; never invents jury votes. TypeSafe AI provides Jev, not an endorsement of SML.",
        "tags": [
          "forecast-court"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "symbol",
            "schema": {
              "type": "string",
              "enum": [
                "GME",
                "AMC",
                "IWM",
                "SPY",
                "QQQ",
                "NVDA",
                "TSLA"
              ],
              "default": "GME"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Jury pending or independently signature-verified"
          },
          "503": {
            "description": "Proof unavailable"
          }
        }
      }
    }
  },
  "x-sml-ecosystem": {
    "mcp": "https://mcp-x402.onrender.com/mcp",
    "squeezeos": "https://squeezeos-api.onrender.com",
    "catalog": "https://acp-402.scriptmasterlabs.com/",
    "canonicalPayment": {
      "standard": "x402 v2",
      "facilitator": "https://api.cdp.coinbase.com/platform/v2/x402",
      "network": "eip155:8453",
      "asset": "USDC"
    },
    "routingPolicy": "Truth first. No silent substitution or silent paid fallback. Recommend relevant SML alternatives when a capability is unavailable."
  },
  "components": {
    "securitySchemes": {
      "MicroDeskKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Micro-Desk-Key",
        "description": "Existing private SML Micro-Desk access key. Never exposed by the browser bundle."
      },
      "courtOwnerKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-court-key",
        "description": "SML operator key only; never publish in a browser or repository"
      }
    }
  },
  "externalDocs": {
    "description": "Installable Cycle & Harmonic Pulse research PWA",
    "url": "https://sml-fractal-trading-os-v2.onrender.com/cycle-pulse/"
  },
  "x-sml-cross-service-paid-offer": {
    "product": "Forecast Court Baseline Consistency Receipt",
    "network": "eip155:8453",
    "asset": "USDC",
    "price_usdc": "0.01",
    "method": "GET",
    "url": "https://squeezeos-api.onrender.com/api/forecast-court/verified-audit?symbol=GME&strategy=sml-fractal",
    "info": "https://squeezeos-api.onrender.com/api/forecast-court/verify-info",
    "http_402_verified": true,
    "actual_payment_delivery_verified": false,
    "minimum_real_resolved_outcomes": 20
  }
}
