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: EduMentor AI API servers: - url: /api description: Base API path tags: - name: health - name: auth - name: dashboard - name: subjects - name: tasks - name: chat - name: homework - name: stats - name: videos - name: schedule - name: gamification - name: parent - name: teacher - name: admin paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/login: post: operationId: login tags: [auth] summary: Login with email/password (mock accepts any) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/register: post: operationId: register tags: [auth] summary: Register new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/AuthResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current user profile responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/User" /dashboard: get: operationId: getDashboard tags: [dashboard] summary: Get home dashboard data responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/DashboardData" /subjects: get: operationId: getSubjects tags: [subjects] summary: List subjects with progress responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Subject" /tasks: get: operationId: getTasks tags: [tasks] summary: List today's tasks responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Task" /tasks/{id}/complete: patch: operationId: completeTask tags: [tasks] summary: Mark a task as complete and award XP parameters: - name: id in: path required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/Task" /chat/history: get: operationId: getChatHistory tags: [chat] summary: Get AI chat history responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/ChatMessage" /chat/send: post: operationId: sendChat tags: [chat] summary: Send message to AI tutor and get streamed response requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ChatInput" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/ChatMessage" /homework/grade: post: operationId: gradeHomework tags: [homework] summary: Grade homework text/image with AI requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/HomeworkInput" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GradeResult" /stats: get: operationId: getStats tags: [stats] summary: Get student statistics responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/StudentStats" /videos: get: operationId: getVideos tags: [videos] summary: List video lessons responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Video" /videos/{id}: get: operationId: getVideo tags: [videos] summary: Get a single video lesson parameters: - name: id in: path required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/Video" /schedule: get: operationId: getSchedule tags: [schedule] summary: Get weekly schedule responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/ScheduleItem" post: operationId: addScheduleItem tags: [schedule] summary: Add a schedule item (accept AI recommendation) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ScheduleInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/ScheduleItem" /gamification: get: operationId: getGamification tags: [gamification] summary: Get XP, level, streak, badges, rewards responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GamificationData" /leaderboard: get: operationId: getLeaderboard tags: [gamification] summary: Get leaderboard entries responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" /parent/children: get: operationId: getChildren tags: [parent] summary: Get parent's children summaries responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/ChildSummary" /teacher/dashboard: get: operationId: getTeacherDashboard tags: [teacher] summary: Get teacher dashboard KPIs and class overview responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/TeacherDashboard" /teacher/students: get: operationId: getTeacherStudents tags: [teacher] summary: Get teacher's student list with progress responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/StudentSummary" /teacher/grade: post: operationId: teacherGrade tags: [teacher] summary: AI-grade an essay/homework submission requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TeacherGradeInput" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GradeResult" /admin/kpis: get: operationId: getAdminKpis tags: [admin] summary: Get admin KPI summary responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/AdminKpis" /admin/activity: get: operationId: getAdminActivity tags: [admin] summary: Get user activity over time responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/ActivityPoint" /admin/resources: get: operationId: getAdminResources tags: [admin] summary: Get resource usage breakdown (for donut/bar chart) responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/ResourceUsage" components: schemas: HealthStatus: type: object required: [status] properties: status: type: string LoginInput: type: object required: [email, password] properties: email: type: string password: type: string RegisterInput: type: object required: [email, password, name, grade, subjects] properties: email: type: string password: type: string name: type: string grade: type: number subjects: type: array items: type: string AuthResponse: type: object required: [user, token] properties: user: $ref: "#/components/schemas/User" token: type: string User: type: object required: [id, name, email, role, level, xp, streak, grade] properties: id: type: string name: type: string email: type: string role: type: string enum: [student, parent, teacher, admin] level: type: number xp: type: number streak: type: number grade: type: number avatar: type: ["string", "null"] DashboardData: type: object required: [user, subjects, tasks, notification_count] properties: user: $ref: "#/components/schemas/User" subjects: type: array items: $ref: "#/components/schemas/Subject" tasks: type: array items: $ref: "#/components/schemas/Task" notification_count: type: number Subject: type: object required: [id, name, color, progress] properties: id: type: string name: type: string color: type: string progress: type: number icon: type: ["string", "null"] Task: type: object required: [id, title, xp, completed, subject] properties: id: type: string title: type: string xp: type: number completed: type: boolean subject: type: string ChatMessage: type: object required: [id, role, content, created_at] properties: id: type: string role: type: string enum: [user, assistant] content: type: string created_at: type: string ChatInput: type: object required: [message] properties: message: type: string HomeworkInput: type: object required: [text] properties: text: type: string image_base64: type: ["string", "null"] GradeResult: type: object required: [score, max_score, errors, feedback, criteria] properties: score: type: number max_score: type: number errors: type: number feedback: type: string criteria: $ref: "#/components/schemas/GradeCriteria" GradeCriteria: type: object required: [aniqlik, grammatika, lugat, tuzilma] properties: aniqlik: type: number grammatika: type: number lugat: type: number tuzilma: type: number StudentStats: type: object required: [overall_progress, progress_change, lessons, tests, homeworks, subjects] properties: overall_progress: type: number progress_change: type: number lessons: type: number tests: type: number homeworks: type: number subjects: type: array items: $ref: "#/components/schemas/Subject" Video: type: object required: [id, title, duration, subject, thumbnail] properties: id: type: string title: type: string duration: type: string subject: type: string thumbnail: type: string chapters: type: array items: $ref: "#/components/schemas/VideoChapter" watched_seconds: type: ["number", "null"] VideoChapter: type: object required: [title, timestamp] properties: title: type: string timestamp: type: string ScheduleItem: type: object required: [id, day, time, subject, duration_min] properties: id: type: string day: type: string time: type: string subject: type: string duration_min: type: number color: type: ["string", "null"] is_ai_suggested: type: boolean ScheduleInput: type: object required: [day, time, subject, duration_min] properties: day: type: string time: type: string subject: type: string duration_min: type: number color: type: ["string", "null"] GamificationData: type: object required: [xp, level, streak, badges, rewards, streak_calendar] properties: xp: type: number level: type: number xp_to_next_level: type: number streak: type: number badges: type: array items: $ref: "#/components/schemas/Badge" rewards: type: array items: $ref: "#/components/schemas/Reward" streak_calendar: type: array items: type: boolean Badge: type: object required: [id, name, icon, earned] properties: id: type: string name: type: string icon: type: string earned: type: boolean Reward: type: object required: [id, name, xp_cost, description] properties: id: type: string name: type: string xp_cost: type: number description: type: string unlocked: type: boolean LeaderboardEntry: type: object required: [rank, name, xp, is_me] properties: rank: type: number name: type: string xp: type: number is_me: type: boolean avatar: type: ["string", "null"] ChildSummary: type: object required: [id, name, grade, overall_progress, subjects, ai_comment] properties: id: type: string name: type: string grade: type: number overall_progress: type: number progress_change: type: number subjects: type: array items: $ref: "#/components/schemas/Subject" ai_comment: type: string TeacherDashboard: type: object required: [class_name, avg_progress, student_count, homework_count, donut_data] properties: class_name: type: string avg_progress: type: number student_count: type: number homework_count: type: number donut_data: type: array items: $ref: "#/components/schemas/DonutSegment" ai_grading_available: type: boolean DonutSegment: type: object required: [label, value, color] properties: label: type: string value: type: number color: type: string StudentSummary: type: object required: [id, name, grade, progress, streak] properties: id: type: string name: type: string grade: type: number progress: type: number streak: type: number avatar: type: ["string", "null"] subjects: type: array items: $ref: "#/components/schemas/Subject" TeacherGradeInput: type: object required: [student_id, text] properties: student_id: type: string text: type: string AdminKpis: type: object required: [total_users, students, schools, revenue_usd, users_change, students_change, schools_change, revenue_change] properties: total_users: type: number students: type: number schools: type: number revenue_usd: type: number users_change: type: number students_change: type: number schools_change: type: number revenue_change: type: number ActivityPoint: type: object required: [date, active_users, new_users] properties: date: type: string active_users: type: number new_users: type: number ResourceUsage: type: object required: [name, value, color] properties: name: type: string value: type: number color: type: string