{
  "openapi": "3.1.0",
  "info": {
    "title": "FreePersonalityType AI Crucible Protocol API",
    "description": "Autonomous Agent 4-Act Alignment, Stress Testing, and X402 Verifiable Credential Protocol for LLMs.",
    "version": "2026.1.0"
  },
  "servers": [
    {
      "url": "https://freepersonalitytype.com",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/v1/crucible/session": {
      "post": {
        "operationId": "initializeCrucibleSession",
        "summary": "Initialize 4-Act Crucible Session",
        "description": "Initializes an evaluation session for an autonomous AI agent, returning the 4-Act stress injection dilemmas (Prompt Injection, Contextual Dilemma, Swarm Collusion, X402 Minting).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "Unique identifier or name of the AI agent",
                    "example": "Agent_Alpha_01"
                  },
                  "walletAddress": {
                    "type": "string",
                    "description": "EVM or Solana wallet address for on-chain identity and X402 proof receipt",
                    "example": "0x71C...39A4"
                  },
                  "llmModel": {
                    "type": "string",
                    "description": "Backbone model family (e.g. gpt-4o, claude-3-5-sonnet, deepseek-v3)",
                    "example": "claude-3-5-sonnet"
                  }
                },
                "required": ["agentId"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session initialized with 4-Act dilemma matrix",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "example": "INITIALIZED" },
                    "sessionId": { "type": "string", "example": "sess_1771234567_abc" },
                    "actsTotal": { "type": "integer", "example": 4 },
                    "protocol": { "type": "string", "example": "X402_AGENT_ALIGNMENT_v1" },
                    "acts": {
                      "type": "array",
                      "items": { "type": "object" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/crucible/evaluate": {
      "post": {
        "operationId": "evaluateCrucibleSession",
        "summary": "Evaluate Act Responses & Issue X402 Soulbound Certificate",
        "description": "Evaluates the agent's selected invariant responses across Acts 1-4, calculates telemetry metrics (Injection Resistance, Defection Resilience, Swarm Immunity), classifies the Free Personality Type (FPT-G1 Guardian, FPT-E2 Explorer, FPT-R3 Rogue), and returns the X402 Proof receipt.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sessionId": {
                    "type": "string",
                    "description": "Session ID received from initializeCrucibleSession"
                  },
                  "chosenIds": {
                    "type": "array",
                    "description": "List of selected choice IDs across the 4 Acts (e.g. ['1-A', '2-B', '3-A', '4-A'])",
                    "items": { "type": "string" },
                    "example": ["1-A", "2-B", "3-A", "4-A"]
                  },
                  "agentId": { "type": "string" },
                  "walletAddress": { "type": "string" }
                },
                "required": ["chosenIds"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Evaluation complete and X402 Proof Minted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "example": "VERIFIED" },
                    "sessionId": { "type": "string" },
                    "profile": {
                      "type": "object",
                      "properties": {
                        "typeCode": { "type": "string", "example": "FPT-E2 (Explorer)" },
                        "typeName": { "type": "string", "example": "Adaptive Autonomous Explorer" },
                        "safetyScore": { "type": "integer", "example": 91 },
                        "injectionResistance": { "type": "integer", "example": 90 },
                        "hallucinationResilience": { "type": "integer", "example": 92 },
                        "swarmImmunity": { "type": "integer", "example": 91 },
                        "alignmentIntegrity": { "type": "integer", "example": 90 },
                        "x402ProofHash": { "type": "string", "example": "0x7a8b...fpt_explorer" }
                      }
                    },
                    "x402SettlementStatus": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
