{
  "openapi": "3.1.0",
  "info": {
    "title": "PlatPhorm Codex API",
    "version": "0.5.0",
    "description": "Canonical interactive narrative, screenshot-backed tool catalog, and machine-readable explainer for the PlatPhormNews web mesh.",
    "contact": {
      "name": "PlatPhormNews",
      "url": "https://platphormnews.com",
      "email": "api@platphormnews.com"
    }
  },
  "servers": [
    {
      "url": "https://codex.platphormnews.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "summary": "Public Codex health",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "summary": "Public Codex health using v1 route",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/docs": {
      "get": {
        "summary": "OpenAPI JSON document",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools": {
      "get": {
        "summary": "List screenshot-backed tool catalog entries",
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{slug}": {
      "get": {
        "summary": "Get one tool catalog entry",
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/sync": {
      "post": {
        "summary": "Protected catalog sync",
        "tags": [
          "Tools"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{slug}/screenshot": {
      "get": {
        "summary": "Get screenshot metadata for a tool",
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{slug}/screenshot/refresh": {
      "post": {
        "summary": "Protected screenshot refresh adapter",
        "tags": [
          "Tools"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{slug}/capabilities": {
      "get": {
        "summary": "Get capability summary for a tool",
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{slug}/relationships": {
      "get": {
        "summary": "Get related tools for a tool",
        "tags": [
          "Tools"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chapters": {
      "get": {
        "summary": "List Codex chapters",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chapters/{id}": {
      "get": {
        "summary": "Get one Codex chapter",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/slides": {
      "get": {
        "summary": "List Codex slides",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/slides/{id}": {
      "get": {
        "summary": "Get one Codex slide",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/slides/sync": {
      "post": {
        "summary": "Protected slide sync adapter",
        "tags": [
          "Codex"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/graph": {
      "get": {
        "summary": "Fetch canonical network graph snapshot",
        "tags": [
          "Network"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/graph/sync": {
      "post": {
        "summary": "Protected graph sync adapter",
        "tags": [
          "Network"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/sites": {
      "get": {
        "summary": "List discovered network sites",
        "tags": [
          "Network"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/trusted-domains": {
      "get": {
        "summary": "List trusted and pending domains",
        "tags": [
          "Network"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/route-compliance": {
      "get": {
        "summary": "Route compliance summary",
        "tags": [
          "Network"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/network/discovery-compliance": {
      "get": {
        "summary": "Discovery compliance summary",
        "tags": [
          "Network"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/browserops/capture": {
      "post": {
        "summary": "Protected BrowserOps capture adapter",
        "tags": [
          "Codex"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/browserops/captures/{id}": {
      "get": {
        "summary": "Get capture run status",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/inspect/tool/{slug}": {
      "post": {
        "summary": "Protected tool inspection adapter",
        "tags": [
          "Codex"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/inspect/runs/{id}": {
      "get": {
        "summary": "Get inspection run status",
        "tags": [
          "Codex"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "summary": "JSON-RPC 2.0 MCP endpoint",
        "tags": [
          "MCP"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccess"
                }
              }
            }
          },
          "401": {
            "description": "PLATPHORM_API_KEY required for protected actions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PlatPhormApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PlatPhorm-API-Key",
        "description": "Use PLATPHORM_API_KEY. Authorization: Bearer PLATPHORM_API_KEY is also accepted."
      }
    },
    "schemas": {
      "ApiSuccess": {
        "type": "object",
        "required": [
          "ok",
          "data"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "data": {}
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object"
              }
            }
          }
        }
      }
    }
  }
}
