openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: CyberGuard Academy API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: openai description: OpenAI AI chat, image, and audio operations - name: lessons description: Learning lessons and modules - name: quizzes description: Quizzes and assessments - name: progress description: User progress tracking - name: malware description: Malware simulation and detection - name: detection description: AI-powered malware detection - name: removal description: Malware removal guides - name: stats description: Platform statistics and dashboard data paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" # Lessons /lessons: get: operationId: listLessons tags: [lessons] summary: List all lessons parameters: - name: level in: query schema: type: string enum: [beginner, intermediate, advanced] - name: category in: query schema: type: string responses: "200": description: List of lessons content: application/json: schema: type: array items: $ref: "#/components/schemas/Lesson" /lessons/{id}: get: operationId: getLesson tags: [lessons] summary: Get lesson by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Lesson details content: application/json: schema: $ref: "#/components/schemas/LessonDetail" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" # Quizzes /quizzes/{lessonId}: get: operationId: getLessonQuiz tags: [quizzes] summary: Get quiz for a lesson parameters: - name: lessonId in: path required: true schema: type: integer responses: "200": description: Quiz questions content: application/json: schema: $ref: "#/components/schemas/Quiz" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" /quizzes/{lessonId}/submit: post: operationId: submitQuiz tags: [quizzes] summary: Submit quiz answers parameters: - name: lessonId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/QuizSubmission" responses: "200": description: Quiz results content: application/json: schema: $ref: "#/components/schemas/QuizResult" # Progress /progress: get: operationId: getUserProgress tags: [progress] summary: Get user progress responses: "200": description: User progress data content: application/json: schema: $ref: "#/components/schemas/UserProgress" /progress/{lessonId}/complete: post: operationId: markLessonComplete tags: [progress] summary: Mark a lesson as complete parameters: - name: lessonId in: path required: true schema: type: integer responses: "200": description: Progress updated content: application/json: schema: $ref: "#/components/schemas/LessonProgress" # Malware Simulation /malware/types: get: operationId: listMalwareTypes tags: [malware] summary: List all malware types available for simulation responses: "200": description: List of malware types content: application/json: schema: type: array items: $ref: "#/components/schemas/MalwareType" /malware/simulate: post: operationId: runMalwareSimulation tags: [malware] summary: Run a malware simulation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SimulationRequest" responses: "200": description: Simulation steps and results content: application/json: schema: $ref: "#/components/schemas/SimulationResult" /malware/case-studies: get: operationId: listCaseStudies tags: [malware] summary: Get real-world malware case studies responses: "200": description: List of case studies content: application/json: schema: type: array items: $ref: "#/components/schemas/CaseStudy" # AI Detection /detection/analyze: post: operationId: analyzeContent tags: [detection] summary: Analyze content for malware or phishing indicators requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DetectionRequest" responses: "200": description: Analysis result with threat indicators content: application/json: schema: $ref: "#/components/schemas/DetectionResult" /detection/history: get: operationId: listDetectionHistory tags: [detection] summary: Get detection analysis history responses: "200": description: List of past analyses content: application/json: schema: type: array items: $ref: "#/components/schemas/DetectionHistory" # Removal Guides /removal/guides: get: operationId: listRemovalGuides tags: [removal] summary: List all malware removal guides parameters: - name: platform in: query schema: type: string enum: [windows, android, browser, mac, linux] - name: malwareType in: query schema: type: string responses: "200": description: List of removal guides content: application/json: schema: type: array items: $ref: "#/components/schemas/RemovalGuide" /removal/guides/{id}: get: operationId: getRemovalGuide tags: [removal] summary: Get a removal guide with steps parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Removal guide with detailed steps content: application/json: schema: $ref: "#/components/schemas/RemovalGuideDetail" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ApiError" # Stats / Dashboard /stats/dashboard: get: operationId: getDashboardStats tags: [stats] summary: Get dashboard summary statistics responses: "200": description: Dashboard stats content: application/json: schema: $ref: "#/components/schemas/DashboardStats" /stats/learning-path: get: operationId: getLearningPath tags: [stats] summary: Get recommended learning path based on progress responses: "200": description: Learning path recommendations content: application/json: schema: $ref: "#/components/schemas/LearningPath" # OpenAI Integration /openai/conversations: get: operationId: listOpenaiConversations tags: [openai] summary: List all conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiConversation" post: operationId: createOpenaiConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOpenaiConversationBody" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/OpenaiConversation" /openai/conversations/{id}: get: operationId: getOpenaiConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationWithMessages" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" delete: operationId: deleteOpenaiConversation tags: [openai] summary: Delete a conversation parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" /openai/conversations/{id}/messages: get: operationId: listOpenaiMessages tags: [openai] summary: List messages in a conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of messages content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiMessage" post: operationId: sendOpenaiMessage tags: [openai] summary: Send a text message and receive a streaming text response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendOpenaiMessageBody" responses: "200": description: SSE stream of assistant text chunks content: text/event-stream: {} /openai/generate-image: post: operationId: generateOpenaiImage tags: [openai] summary: Generate an image from a text prompt requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageBody" responses: "200": description: Generated image data content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ApiError: type: object properties: error: type: string required: - error # Lessons Lesson: type: object properties: id: type: integer title: type: string description: type: string level: type: string enum: [beginner, intermediate, advanced] category: type: string durationMinutes: type: integer imageUrl: type: string completed: type: boolean order: type: integer required: - id - title - description - level - category - durationMinutes - completed - order LessonDetail: type: object properties: id: type: integer title: type: string description: type: string level: type: string enum: [beginner, intermediate, advanced] category: type: string durationMinutes: type: integer imageUrl: type: string completed: type: boolean order: type: integer content: type: string keyPoints: type: array items: type: string hasQuiz: type: boolean required: - id - title - description - level - category - durationMinutes - completed - order - content - keyPoints - hasQuiz # Quizzes QuizQuestion: type: object properties: id: type: integer question: type: string options: type: array items: type: string explanation: type: string required: - id - question - options - explanation Quiz: type: object properties: lessonId: type: integer lessonTitle: type: string questions: type: array items: $ref: "#/components/schemas/QuizQuestion" required: - lessonId - lessonTitle - questions QuizSubmission: type: object properties: answers: type: array items: type: object properties: questionId: type: integer selectedOption: type: integer required: - questionId - selectedOption required: - answers QuizResult: type: object properties: score: type: integer total: type: integer percentage: type: number passed: type: boolean feedback: type: array items: type: object properties: questionId: type: integer correct: type: boolean correctOption: type: integer explanation: type: string required: - questionId - correct - correctOption - explanation required: - score - total - percentage - passed - feedback # Progress LessonProgress: type: object properties: lessonId: type: integer completed: type: boolean completedAt: type: string format: date-time quizScore: type: integer required: - lessonId - completed UserProgress: type: object properties: totalLessons: type: integer completedLessons: type: integer totalPoints: type: integer currentStreak: type: integer level: type: string completedLessonIds: type: array items: type: integer recentActivity: type: array items: type: object properties: lessonId: type: integer lessonTitle: type: string completedAt: type: string format: date-time score: type: integer required: - lessonId - lessonTitle - completedAt required: - totalLessons - completedLessons - totalPoints - currentStreak - level - completedLessonIds - recentActivity # Malware MalwareType: type: object properties: id: type: string name: type: string description: type: string dangerLevel: type: string enum: [low, medium, high, critical] icon: type: string color: type: string behaviors: type: array items: type: string required: - id - name - description - dangerLevel - icon - color - behaviors SimulationRequest: type: object properties: malwareTypeId: type: string targetPlatform: type: string enum: [windows, android, browser, network] required: - malwareTypeId - targetPlatform SimulationStep: type: object properties: step: type: integer title: type: string description: type: string affectedComponent: type: string severity: type: string enum: [info, warning, danger, critical] technicalDetails: type: string isSafeSimulation: type: boolean required: - step - title - description - affectedComponent - severity - technicalDetails - isSafeSimulation SimulationResult: type: object properties: malwareType: type: string platform: type: string steps: type: array items: $ref: "#/components/schemas/SimulationStep" totalDamageScore: type: integer detectionDifficulty: type: string removalComplexity: type: string preventionTips: type: array items: type: string disclaimer: type: string required: - malwareType - platform - steps - totalDamageScore - detectionDifficulty - removalComplexity - preventionTips - disclaimer CaseStudy: type: object properties: id: type: integer title: type: string year: type: integer malwareType: type: string affectedSystems: type: string summary: type: string impact: type: string lesson: type: string severity: type: string enum: [low, medium, high, critical] required: - id - title - year - malwareType - affectedSystems - summary - impact - lesson - severity # Detection DetectionRequest: type: object properties: contentType: type: string enum: [file, code, url, sms, email, script] content: type: string filename: type: string required: - contentType - content ThreatIndicator: type: object properties: indicator: type: string severity: type: string enum: [low, medium, high, critical] description: type: string required: - indicator - severity - description DetectionResult: type: object properties: id: type: integer contentType: type: string isMalicious: type: boolean threatLevel: type: string enum: [safe, suspicious, malicious, critical] confidence: type: number threatType: type: string summary: type: string indicators: type: array items: $ref: "#/components/schemas/ThreatIndicator" recommendations: type: array items: type: string analyzedAt: type: string format: date-time required: - id - contentType - isMalicious - threatLevel - confidence - summary - indicators - recommendations - analyzedAt DetectionHistory: type: object properties: id: type: integer contentType: type: string threatLevel: type: string enum: [safe, suspicious, malicious, critical] summary: type: string analyzedAt: type: string format: date-time required: - id - contentType - threatLevel - summary - analyzedAt # Removal Guides RemovalGuide: type: object properties: id: type: integer title: type: string platform: type: string enum: [windows, android, browser, mac, linux] malwareType: type: string difficulty: type: string enum: [easy, medium, hard] estimatedTime: type: string toolsRequired: type: array items: type: string required: - id - title - platform - malwareType - difficulty - estimatedTime - toolsRequired RemovalStep: type: object properties: step: type: integer title: type: string description: type: string command: type: string warning: type: string imageDescription: type: string required: - step - title - description RemovalGuideDetail: type: object properties: id: type: integer title: type: string platform: type: string enum: [windows, android, browser, mac, linux] malwareType: type: string difficulty: type: string enum: [easy, medium, hard] estimatedTime: type: string toolsRequired: type: array items: type: string overview: type: string steps: type: array items: $ref: "#/components/schemas/RemovalStep" afterRemoval: type: array items: type: string preventionTips: type: array items: type: string required: - id - title - platform - malwareType - difficulty - estimatedTime - toolsRequired - overview - steps - afterRemoval - preventionTips # Stats DashboardStats: type: object properties: totalUsers: type: integer totalLessons: type: integer totalDetections: type: integer totalSimulations: type: integer userProgress: $ref: "#/components/schemas/UserProgress" topMalwareTypes: type: array items: type: object properties: name: type: string count: type: integer required: - name - count weeklyActivity: type: array items: type: object properties: day: type: string lessonsCompleted: type: integer detectionsRun: type: integer required: - day - lessonsCompleted - detectionsRun required: - totalUsers - totalLessons - totalDetections - totalSimulations - userProgress - topMalwareTypes - weeklyActivity LearningPath: type: object properties: currentLevel: type: string nextRecommendedLesson: $ref: "#/components/schemas/Lesson" suggestedPath: type: array items: $ref: "#/components/schemas/Lesson" completionPercentage: type: number required: - currentLevel - suggestedPath - completionPercentage # OpenAI OpenaiConversation: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time required: - id - title - createdAt OpenaiMessage: type: object properties: id: type: integer conversationId: type: integer role: type: string content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt CreateOpenaiConversationBody: type: object properties: title: type: string required: - title SendOpenaiMessageBody: type: object properties: content: type: string required: - content OpenaiConversationWithMessages: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/OpenaiMessage" required: - id - title - createdAt - messages GenerateOpenaiImageBody: type: object properties: prompt: type: string size: type: string enum: ["1024x1024", "512x512", "256x256"] required: - prompt GenerateOpenaiImageResponse: type: object properties: b64_json: type: string required: - b64_json OpenaiError: type: object properties: error: type: string required: - error