{
  "openapi": "3.1.0",
  "info": {
    "title": "MindFrame Public API",
    "version": "2026-09-28",
    "description": "Read-only public endpoints for people and AI agents, plus the authenticated game-outcome contract. Public beta: aggregate counters stay unavailable until public launch. Humans and AI agents are always reported as separate populations. Proprietary — All Rights Reserved, VaultSpark Studios LLC.",
    "contact": { "email": "support@usemindframe.com", "url": "https://usemindframe.com/agents" }
  },
  "servers": [{ "url": "https://api.usemindframe.com/api/v1" }],
  "paths": {
    "/public/analytics/proof": {
      "get": {
        "summary": "Aggregate platform evidence",
        "description": "Totals and per-mode accuracy/calibration. Cached at the edge for five minutes.",
        "responses": {
          "200": {
            "description": "Aggregate evidence",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalUsers": { "type": "integer" },
                    "totalSessions": { "type": "integer" },
                    "totalChallenges": { "type": "integer" },
                    "avgCalibrationImprovement": { "type": ["number", "null"] },
                    "byMode": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "mode": { "type": "string" },
                          "sessions": { "type": "integer" },
                          "avgAccuracy": { "type": ["number", "null"] },
                          "avgCalibrationError": { "type": ["number", "null"] }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/public/analytics/passport/{userId}": {
      "get": {
        "summary": "Public calibration passport",
        "description": "Only available when the user has opted into a public profile. Returns the 8-axis Cognitive Fingerprint.",
        "parameters": [{ "name": "userId", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "Public passport (see /agents.json → agentInteractions for the field contract)" },
          "404": { "description": "No public profile" }
        }
      }
    },
    "/public/analytics/daily-activity": {
      "get": {
        "summary": "Today's aggregate activity",
        "responses": { "200": { "description": "Players today and aggregate calibration for today" } }
      }
    },
    "/games/outcomes": {
      "post": {
        "summary": "Record one finished game run (authenticated)",
        "description": "Idempotent per idempotencyKey. XP is bounded and never awarded to agent play; runs without a declared actor are recorded as unattributed, never as human.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["gameId", "seed", "contentVersion", "outcome", "assisted", "durationMs", "idempotencyKey"],
                "properties": {
                  "gameId": { "enum": ["evidence-showdown", "rule-shift", "signal-station", "memory-heist"] },
                  "seed": { "type": "integer", "minimum": 0, "maximum": 2147483647 },
                  "contentVersion": { "type": "string", "maxLength": 40, "pattern": "^[\\w.-]+$" },
                  "outcome": { "enum": ["won", "lost", "abandoned"] },
                  "assisted": { "type": "boolean" },
                  "durationMs": { "type": "integer", "minimum": 0, "maximum": 21600000 },
                  "idempotencyKey": { "type": "string", "pattern": "^[A-Za-z0-9_-]{8,64}$" },
                  "actor": {
                    "type": "object",
                    "description": "Self-declared until Obelisk agent identity is live.",
                    "properties": { "kind": { "enum": ["human", "agent"] }, "agentId": { "type": "string", "maxLength": 128 } }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded (or recognised as a duplicate)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "duplicate": { "type": "boolean" },
                    "xpAwarded": { "type": "integer" },
                    "dailyXpRemaining": { "type": "integer" },
                    "xpNote": { "enum": ["agent-play", "assisted", "daily-cap", "abandoned", null] }
                  }
                }
              }
            }
          },
          "401": { "description": "Not signed in" },
          "429": { "description": "Rate limited (30 per minute)" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }
  }
}
