{
  "openapi": "3.1.0",
  "info": {
    "title": "Orion Celestia Intel API",
    "version": "1.0.0",
    "description": "Orion's daily Celestia mainnet analysis as plain JSON: anomaly signals, network metrics and a report archive. Every figure carries a provenance link to its on-chain or indexer source. Read-only. For MCP access use https://orionlabsone.cc/mcp (see /for-ai).",
    "license": { "name": "Apache-2.0", "identifier": "Apache-2.0" }
  },
  "servers": [{ "url": "https://orionlabsone.cc" }],
  "paths": {
    "/api/latest": {
      "get": {
        "operationId": "getLatestReport",
        "summary": "Latest daily report",
        "description": "Orion's most recent daily analysis: snapshot metrics, anomaly signals with severity and baselines, and provenance links.",
        "responses": {
          "200": {
            "description": "Latest report",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Report" } } }
          }
        }
      }
    },
    "/api/reports": {
      "get": {
        "operationId": "listReports",
        "summary": "Report archive index",
        "description": "All available daily reports, newest first: date plus signal counts.",
        "responses": {
          "200": {
            "description": "Archive index",
            "content": {
              "application/json": {
                "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ReportIndexEntry" } }
              }
            }
          }
        }
      }
    },
    "/api/reports/{date}": {
      "get": {
        "operationId": "getReportByDate",
        "summary": "Full report for a date",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "description": "Report date, YYYY-MM-DD",
            "schema": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$", "example": "2026-07-06" }
          }
        ],
        "responses": {
          "200": {
            "description": "Report for the date",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Report" } } }
          },
          "404": { "description": "No report for that date" }
        }
      }
    },
    "/api/rss": {
      "get": {
        "operationId": "getRssFeed",
        "summary": "Daily brief as RSS",
        "responses": {
          "200": { "description": "RSS 2.0 feed", "content": { "application/rss+xml": { "schema": { "type": "string" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Signal": {
        "type": "object",
        "description": "One anomaly/health signal. `value` is the observation, `baseline` the rolling norm it is compared against.",
        "properties": {
          "type": { "type": "string", "example": "namespace_shift" },
          "severity": { "type": "string", "enum": ["info", "notable", "critical"] },
          "title": { "type": "string" },
          "detail": { "type": "string" },
          "metric": { "type": "string" },
          "value": { "type": "number" },
          "baseline": { "type": "number" },
          "source": { "type": "string", "description": "Which upstream source produced the underlying data" }
        }
      },
      "Snapshot": {
        "type": "object",
        "description": "Network metrics at report time. NOTE: bonded_ratio is bonded vs stakeable tokens; bonded_ratio_supply is bonded vs TOTAL supply — cite the latter for 'X% of supply is staked'.",
        "properties": {
          "height": { "type": "integer" },
          "total_fee_tia": { "type": "number" },
          "total_blobs_tb": { "type": "number" },
          "total_tx": { "type": "integer" },
          "total_validators": { "type": "integer", "description": "Registered validators incl. jailed/inactive" },
          "active_validators": { "type": "integer", "description": "Consensus set size" },
          "tia_price": { "type": "number" },
          "bonded_ratio": { "type": "number" },
          "bonded_ratio_supply": { "type": "number" },
          "nakamoto_halting": { "type": "integer" },
          "jail_count": { "type": "integer" }
        }
      },
      "Report": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "generated_at": { "type": "string", "format": "date-time" },
          "height": { "type": "integer" },
          "network": { "type": "string", "example": "celestia-mainnet" },
          "narrator": { "type": "string", "description": "Which model wrote the narrative", "example": "gpt" },
          "narrative": { "type": "string", "description": "The full daily brief as Markdown" },
          "snapshot": { "$ref": "#/components/schemas/Snapshot" },
          "signals": { "type": "array", "items": { "$ref": "#/components/schemas/Signal" } },
          "summary": {
            "type": "object",
            "properties": {
              "total_signals": { "type": "integer" },
              "critical": { "type": "integer" },
              "notable": { "type": "integer" },
              "info": { "type": "integer" }
            }
          },
          "provenance": {
            "type": "object",
            "additionalProperties": { "type": "string", "format": "uri" },
            "description": "Metric name → URL of the exact source it was read from"
          }
        }
      },
      "ReportIndexEntry": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "total_signals": { "type": "integer" },
          "critical": { "type": "integer" },
          "notable": { "type": "integer" },
          "info": { "type": "integer" }
        }
      }
    }
  }
}
