{"openapi":"3.1.0","info":{"title":"AdaptIQ API","description":"AI-powered adaptive learning platform for individuals. Create courses on any topic, practice with AI-generated exercises, and track mastery with spaced repetition. ⚠️ AI-generated content may contain inaccuracies.","version":"0.2.0"},"paths":{"/health":{"get":{"tags":["system","system"],"summary":"Health check","description":"Check system health and component status","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service unavailable"}}}},"/":{"get":{"tags":["system","system"],"summary":"API information","description":"Get basic API information and available endpoints","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service unavailable"}}}},"/api/v1/questions/generate":{"post":{"summary":"Generate a new question","description":"Generate a personalized question based on course and user context","operationId":"generate_question_api_v1_questions_generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionGenerateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionResponse"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/questions/evaluate":{"post":{"summary":"Evaluate Answer","description":"Evaluate answer with integrated progress tracking","operationId":"evaluate_answer_api_v1_questions_evaluate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerSubmissionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionEvalResponse"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/quiz/generate":{"post":{"summary":"Generate a new quiz","description":"Generate a personalized quiz. Returns 201+quiz for the static path, 202+job_id for the agentic (multi-agent) path that takes 30-60s.","operationId":"generate_quiz_api_v1_quiz_generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizGenerateRequest"}}}},"responses":{"201":{"description":"Quiz returned synchronously","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"202":{"description":"Generation dispatched; poll /quiz/jobs/{job_id}","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncJobResponse"}}}}}}},"/api/v1/quiz/jobs/{job_id}":{"get":{"summary":"Poll an async quiz generation job","description":"Poll the status of an async quiz generation. Tenant- and user-scoped:\nother users' jobs return 404, never the actual data.","operationId":"get_quiz_job_api_v1_quiz_jobs__job_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizJobStatusResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/quiz/evaluate":{"post":{"summary":"Evaluate a completed quiz","description":"Evaluate user's quiz answers and provide detailed feedback","operationId":"evaluate_quiz_api_v1_quiz_evaluate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizEvaluationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizEvaluationResponse"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/quiz/{quiz_id}":{"get":{"summary":"Get quiz details","description":"Retrieve detailed information about a specific quiz","operationId":"get_quiz_api_v1_quiz__quiz_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"quiz_id","in":"path","required":true,"schema":{"type":"string","title":"Quiz Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/quiz/{quiz_id}/abandon":{"post":{"summary":"Abandon a quiz session","description":"Mark a quiz as abandoned and clean up the session","operationId":"abandon_quiz_api_v1_quiz__quiz_id__abandon_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"quiz_id","in":"path","required":true,"schema":{"type":"string","title":"Quiz Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/overview":{"get":{"summary":"Get Progress Overview","description":"Get complete progress overview with all KPIs","operationId":"get_progress_overview_api_v1_progress_overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/stats":{"get":{"summary":"Get Quick Stats","description":"Quick stats for UI header","operationId":"get_quick_stats_api_v1_progress_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/domain/{domain}":{"get":{"summary":"Get Domain Progress","description":"Get KPIs for a specific domain","operationId":"get_domain_progress_api_v1_progress_domain__domain__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/domains":{"get":{"summary":"Get All Domains Progress","description":"Get KPIs for all domains","operationId":"get_all_domains_progress_api_v1_progress_domains_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/activity":{"get":{"summary":"Get Recent Activity","description":"Get recent activity with basic info","operationId":"get_recent_activity_api_v1_progress_activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/courses-summary":{"get":{"summary":"Get Courses Summary","description":"Per-course mastery summary for the current user, one call for the\nwhole course library: {course_id: {tested, dist, due}}.","operationId":"get_courses_summary_api_v1_progress_courses_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/mastery":{"get":{"summary":"Get Mastery Dashboard","description":"Get per-concept mastery dashboard data.\nShows mastery level, score, trend, streak, and spaced repetition schedule\nfor every concept the user has practiced.","operationId":"get_mastery_dashboard_api_v1_progress_mastery_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/streak":{"get":{"summary":"Get Learning Streak","description":"Get learning streak data (current streak, longest, heatmap)","operationId":"get_learning_streak_api_v1_progress_streak_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/study-plan":{"get":{"summary":"Get Study Plan","description":"Get a personalized daily study plan + readiness score.\nThe core \"open the app and know exactly what to do\" experience.","operationId":"get_study_plan_api_v1_progress_study_plan_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/progress/insights":{"get":{"summary":"Get Learning Insights","description":"User-facing analytics: misconceptions, per-concept timing, cadence +\nactivity histogram, domain momentum, and ranked next-best-actions.\n\nPure read path — aggregates signals the AI already consumes so the user\ncan see the same picture of their own learning.","operationId":"get_learning_insights_api_v1_progress_insights_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses":{"post":{"tags":["courses","courses"],"summary":"Create a new course","description":"Create a custom course with domains and concepts","operationId":"create_course_api_v1_courses_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCourseRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Course"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/generate":{"post":{"tags":["courses"],"summary":"AI-generate course structure","description":"Generate course structure from natural language prompt","operationId":"generate_course_structure_api_v1_courses_generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CourseGenerationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/my-courses":{"get":{"tags":["courses","courses"],"summary":"Get user's courses","description":"Get all courses for the current user, creating default courses if needed","operationId":"get_user_courses_api_v1_courses_my_courses_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Course"},"title":"Response Get User Courses Api V1 Courses My Courses Get"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/initialize-defaults":{"post":{"tags":["courses","courses"],"summary":"Initialize default courses","description":"Manually trigger creation of default courses (BASICW, CKA)","operationId":"initialize_default_courses_api_v1_courses_initialize_defaults_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/{course_code}":{"get":{"tags":["courses","courses"],"summary":"Get course details","description":"Get detailed information about a specific course, creating if default course doesn't exist","operationId":"get_course_api_v1_courses__course_code__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_code","in":"path","required":true,"schema":{"type":"string","title":"Course Code"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Course"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/{course_code}/apply-edit":{"post":{"tags":["courses","courses"],"summary":"Apply a tutor-proposed curriculum edit","description":"Commit a tutor-proposed curriculum edit (add concept / domain / rebalance / edit_metadata) to a course the user owns. Server re-validates the per-kind payload before applying.","operationId":"apply_curriculum_edit_api_v1_courses__course_code__apply_edit_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_code","in":"path","required":true,"schema":{"type":"string","title":"Course Code"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCurriculumEditRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/courses/{course_id}":{"delete":{"tags":["courses","courses"],"summary":"Delete a course","description":"Archive a course you own","operationId":"delete_course_api_v1_courses__course_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."},"403":{"description":"Forbidden — insufficient access."}}}},"/api/v1/content/status/{course_id}":{"get":{"summary":"Get Content Status","description":"Get content completion status for all concepts in a course","operationId":"get_content_status_api_v1_content_status__course_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentStatusResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/save":{"post":{"summary":"Save Concept Content","description":"Save content for a concept","operationId":"save_concept_content_api_v1_content_save_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConceptContentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConceptContentResponse"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/generate":{"post":{"summary":"Generate Concept Content","description":"Generate AI content for a concept","operationId":"generate_concept_content_api_v1_content_generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConceptContentResponse"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/domain/{course_id}/{domain}":{"get":{"summary":"Get Domain Content","description":"Get all content for concepts in a domain","operationId":"get_domain_content_api_v1_content_domain__course_id___domain__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"content_type","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ContentType","default":"material"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ConceptContentResponse"},"title":"Response Get Domain Content Api V1 Content Domain  Course Id   Domain  Get"}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/{course_id}/{domain}/{concept}":{"get":{"summary":"Get Concept Content","description":"Get content for a specific concept","operationId":"get_concept_content_api_v1_content__course_id___domain___concept__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"concept","in":"path","required":true,"schema":{"type":"string","title":"Concept"}},{"name":"content_type","in":"query","required":true,"schema":{"$ref":"#/components/schemas/ContentType"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConceptContentResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/generate-domain":{"post":{"summary":"Generate Domain Content","description":"Generate AI content for all concepts in a domain","operationId":"generate_domain_content_api_v1_content_generate_domain_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateContentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/generate-course":{"post":{"summary":"Generate Course Content","description":"Generate AI content for all concepts in all domains","operationId":"generate_course_content_api_v1_content_generate_course_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"content_type","in":"query","required":false,"schema":{"type":"string","default":"material","title":"Content Type"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Generate Course Content Api V1 Content Generate Course Post"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/export/{course_id}":{"get":{"summary":"Export Course Content","description":"Export all course content as a single markdown document","operationId":"export_course_content_api_v1_content_export__course_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"content_type","in":"query","required":false,"schema":{"type":"string","default":"material","title":"Content Type"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/search/{course_id}":{"get":{"summary":"Search Content","description":"Search content across all concepts in a course","operationId":"search_content_api_v1_content_search__course_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"q","in":"query","required":true,"schema":{"type":"string","title":"Q"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/refine":{"post":{"summary":"Refine saved concept content via the AI editor agent","description":"User instruction + current draft → agent uses tools (list_concepts, read_concept_content, propose_edit) to produce a rewrite. Returns the new content + a one-line summary. Caller decides whether to save.","operationId":"refine_content_endpoint_api_v1_content_refine_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefineContentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefineContentResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error."},"500":{"description":"Internal server error."}}}},"/api/v1/content/drafts":{"get":{"tags":["content"],"summary":"Pending-draft summary for the Opener 'you left a draft' line","description":"Read-only pending-draft summary consumed by the client-composed\nOpener (#77). Mirrors the query shape of `make_list_my_drafts_tool`\nin `learner_tools/drafts.py`: tenant + user scoped, unexpired only,\nmost-recent first. `count == 0` ⇒ `latest is null`.\n\nCarries `expires_in_minutes` so the Opener can render the\n\"expires in {h}h\" copy without a second round-trip.","operationId":"list_pending_drafts_api_v1_content_drafts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Pending Drafts Api V1 Content Drafts Get"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/drafts/{draft_id}/commit":{"post":{"tags":["content"],"summary":"Commit a tutor-generated concept draft into ConceptContent","operationId":"commit_draft_api_v1_content_drafts__draft_id__commit_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"draft_id","in":"path","required":true,"schema":{"type":"string","title":"Draft Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Commit Draft Api V1 Content Drafts  Draft Id  Commit Post"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/content/drafts/{draft_id}":{"delete":{"tags":["content"],"summary":"Discard a tutor-generated concept draft","operationId":"discard_draft_api_v1_content_drafts__draft_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"draft_id","in":"path","required":true,"schema":{"type":"string","title":"Draft Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tenants":{"post":{"tags":["tenants"],"summary":"Create a new tenant/organization","description":"Create a new tenant. The requesting user becomes the owner.","operationId":"create_tenant_api_v1_tenants_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tenants/my-tenants":{"get":{"tags":["tenants"],"summary":"Get all tenants the current user belongs to","description":"List all tenants the current user is a member of.","operationId":"get_my_tenants_api_v1_tenants_my_tenants_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tenants/current":{"get":{"tags":["tenants"],"summary":"Get details of the current tenant","description":"Get the currently active tenant (resolved from header or user mapping).","operationId":"get_current_tenant_api_v1_tenants_current_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tenants/members":{"post":{"tags":["tenants"],"summary":"Add a user to the current tenant","description":"Add a user to the current tenant. Only owners/admins can do this.","operationId":"add_tenant_member_api_v1_tenants_members_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteUserRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}},"get":{"tags":["tenants"],"summary":"List members of the current tenant","description":"List all members of the current tenant.","operationId":"list_tenant_members_api_v1_tenants_members_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/start":{"post":{"tags":["workbench"],"summary":"Author and start a repair session","operationId":"start_workbench_api_v1_workbench_start_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartWorkbenchRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/{session_id}":{"get":{"tags":["workbench"],"summary":"Get a repair session","operationId":"get_workbench_api_v1_workbench__session_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/{session_id}/file":{"put":{"tags":["workbench"],"summary":"Save one file's content","operationId":"save_workbench_file_api_v1_workbench__session_id__file_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveFileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/{session_id}/check":{"post":{"tags":["workbench"],"summary":"Run the deterministic checks against the live files","operationId":"check_workbench_api_v1_workbench__session_id__check_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/{session_id}/submit":{"post":{"tags":["workbench"],"summary":"Submit the repair: grade the diff into mastery","operationId":"submit_workbench_api_v1_workbench__session_id__submit_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad request — invalid input."},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/workbench/{session_id}/abandon":{"post":{"tags":["workbench"],"summary":"Abandon a repair","operationId":"abandon_workbench_api_v1_workbench__session_id__abandon_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/feedback/report":{"post":{"tags":["feedback"],"summary":"Report a question issue","description":"Report an issue with a generated question (wrong answer, unclear, etc.).\nThis helps detect AI hallucinations and improve quality.","operationId":"report_question_api_v1_feedback_report_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/feedback/stats":{"get":{"tags":["feedback"],"summary":"Get feedback statistics for a course","description":"Get aggregated feedback stats to identify quality issues","operationId":"get_feedback_stats_api_v1_feedback_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"query","required":true,"schema":{"type":"string","title":"Course Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/agent-traces/failures":{"get":{"tags":["agent-traces"],"summary":"Recent degraded tutor turns (fallback or error)","description":"Return recent `AgentTrace` rows for the caller's tenant where the turn\ndegraded (``fallback_reply_used is True`` OR ``error is not None``), newest\nfirst, bounded by ``limit``, projecting only diagnostic fields.","operationId":"list_failure_traces_api_v1_agent_traces_failures_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Max rows to return (newest first). Hard ceiling 200.","default":50,"title":"Limit"},"description":"Max rows to return (newest first). Hard ceiling 200."},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tutor/start":{"post":{"tags":["tutor"],"summary":"Start a tutor chat session","operationId":"start_tutor_api_v1_tutor_start_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorStartRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorTurnResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."},"409":{"description":"A tutor turn is already running"}}}},"/api/v1/tutor/end-active":{"post":{"tags":["tutor"],"summary":"End any active tutor session for the user","description":"Force the next /tutor/start to create a fresh session.\nUse case: user wants to start over (the active session got into a\nweird state — agent looping, references a deleted course, or just\nwants a clean slate). No-op if no active session.","operationId":"end_active_tutor_api_v1_tutor_end_active_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tutor/sessions/{session_id}/clear-capture":{"post":{"tags":["tutor"],"summary":"Clear pending_action / proposal on the session","description":"Wipe the session's pending_action and proposal. Called by the\npanel when the user clicks a propose_action button — without this,\nthe button persists in the sidecar across refreshes (the next\n/start hydrates state from the stale capture) even though the\nuser has already taken the action.","operationId":"clear_capture_api_v1_tutor_sessions__session_id__clear_capture_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tutor/sessions/{session_id}":{"get":{"tags":["tutor"],"summary":"Fetch a tutor session by id","operationId":"get_tutor_session_api_v1_tutor_sessions__session_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorTurnResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Resource not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error."}}}},"/api/v1/tutor/message/stream":{"post":{"tags":["tutor"],"summary":"Send a message in the tutor chat — SSE-streamed response","operationId":"stream_tutor_message_api_v1_tutor_message_stream_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"client_surface","in":"query","required":false,"schema":{"type":"string","default":"web","title":"Client Surface"}},{"name":"x-tenant-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}},"text/event-stream":{}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"AnswerSubmissionRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier"},"question_id":{"type":"string","minLength":1,"title":"Question Id","description":"ID of the question being answered"},"user_answer":{"items":{"type":"string"},"type":"array","minItems":1,"title":"User Answer","description":"List of selected option IDs (e.g., ['A'] or ['A', 'C'])"},"time_taken":{"type":"integer","minimum":0.0,"title":"Time Taken","description":"Time taken to answer in seconds"}},"type":"object","required":["course_id","question_id","user_answer","time_taken"],"title":"AnswerSubmissionRequest","description":"Request to submit an answer for evaluation"},"ApplyCurriculumEditRequest":{"properties":{"kind":{"type":"string","enum":["add_concept","add_domain","rebalance","edit_metadata","rename_concept","remove_concept"],"title":"Kind"},"payload":{"additionalProperties":true,"type":"object","title":"Payload","description":"Per-kind payload — see CurriculumEditPayload schemas."},"expected_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Updated At","description":"ISO-8601 timestamp of the course's `updated_at` when the edit was proposed. If set and the course has changed since, the endpoint returns 409 so the client can re-fetch."}},"type":"object","required":["kind","payload"],"title":"ApplyCurriculumEditRequest","description":"Apply a tutor-proposed curriculum edit. Server re-validates the\npayload against the per-kind schema in\n`backend/app/tutor/curriculum_edit.py` and runs the mutation\nvia `Course.apply_curriculum_edit`.\n\nConcurrency: clients pass `expected_updated_at` (the `updated_at`\ntimestamp they read on the proposal); the endpoint rejects with 409\nif the course was modified since. Optional — clients that omit it\naccept last-writer-wins."},"AsyncJobResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"type":"string","title":"Status"},"progress":{"additionalProperties":true,"type":"object","title":"Progress"}},"type":"object","required":["job_id","status","progress"],"title":"AsyncJobResponse","description":"Returned with HTTP 202 when quiz generation is dispatched in the background.\nClient polls GET /quiz/jobs/{job_id} until status is 'done' or 'failed'."},"ConceptContentRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier"},"domain":{"type":"string","title":"Domain","description":"Domain key"},"concept":{"type":"string","title":"Concept","description":"Concept name"},"content_type":{"$ref":"#/components/schemas/ContentType","description":"Type of content"},"content":{"type":"string","title":"Content","description":"Markdown content"}},"type":"object","required":["course_id","domain","concept","content_type","content"],"title":"ConceptContentRequest","description":"Request to save concept content"},"ConceptContentResponse":{"properties":{"course_id":{"type":"string","title":"Course Id"},"domain":{"type":"string","title":"Domain"},"concept":{"type":"string","title":"Concept"},"content_type":{"$ref":"#/components/schemas/ContentType"},"content":{"type":"string","title":"Content"},"status":{"$ref":"#/components/schemas/ContentStatus"},"word_count":{"type":"integer","title":"Word Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"generated_by_ai":{"type":"boolean","title":"Generated By Ai"}},"type":"object","required":["course_id","domain","concept","content_type","content","status","word_count","created_at","updated_at","generated_by_ai"],"title":"ConceptContentResponse","description":"Response for concept content"},"ContentStatus":{"type":"string","enum":["empty","draft","complete"],"title":"ContentStatus","description":"Content completion status"},"ContentStatusResponse":{"properties":{"course_id":{"type":"string","title":"Course Id"},"content_status":{"additionalProperties":{"$ref":"#/components/schemas/ContentStatus"},"type":"object","title":"Content Status","description":"Map of 'domain_concept' to status"},"total_concepts":{"type":"integer","title":"Total Concepts"},"completed_concepts":{"type":"integer","title":"Completed Concepts"},"draft_concepts":{"type":"integer","title":"Draft Concepts"},"empty_concepts":{"type":"integer","title":"Empty Concepts"},"completion_percentage":{"type":"number","title":"Completion Percentage"}},"type":"object","required":["course_id","content_status","total_concepts","completed_concepts","draft_concepts","empty_concepts","completion_percentage"],"title":"ContentStatusResponse","description":"Response for content status overview"},"ContentType":{"type":"string","enum":["material","examples","exercises","guide"],"title":"ContentType","description":"Types of content that can be created"},"Course":{"properties":{"_id":{"anyOf":[{"type":"string","example":"5eb7cf5a86d9755df3a6c593"},{"type":"null"}],"title":"Id","description":"MongoDB document ObjectID"},"name":{"type":"string","title":"Name","description":"Course name"},"code":{"type":"string","title":"Code","description":"Course code (e.g., 'CKA')"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Course description"},"domains":{"items":{"$ref":"#/components/schemas/CourseDomain"},"type":"array","title":"Domains","description":"Course domains"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant this course belongs to"},"created_by":{"type":"string","title":"Created By","description":"User ID who owns this course"},"is_shared":{"type":"boolean","title":"Is Shared","description":"When True, this course is discoverable across tenants via the reuse search.","default":false},"forked_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Forked From","description":"ObjectId of the source course this one was forked from. None for from-scratch."},"status":{"$ref":"#/components/schemas/CourseStatus","default":"active"},"version":{"type":"string","title":"Version","description":"Course version","default":"1.0"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["name","code","domains","tenant_id","created_by"],"title":"Course","description":"Course configuration model - each user has their own courses, scoped by tenant"},"CourseDomain":{"properties":{"key":{"type":"string","title":"Key","description":"Domain identifier (e.g., 'troubleshooting')"},"name":{"type":"string","title":"Name","description":"Human-readable name"},"weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Weight","description":"Weight in course (0.0-1.0)"},"concepts":{"items":{"type":"string"},"type":"array","title":"Concepts","description":"list of concepts in this domain"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Domain description"},"sandbox_eligible":{"type":"boolean","title":"Sandbox Eligible","description":"Whether this domain supports the hands-on sandbox playground (CLI/code/config/debugging/troubleshooting).","default":false}},"type":"object","required":["key","name","weight","concepts"],"title":"CourseDomain","description":"Domain configuration within a course"},"CourseGenerationRequest":{"properties":{"prompt":{"type":"string","maxLength":1000,"minLength":10,"title":"Prompt"}},"type":"object","required":["prompt"],"title":"CourseGenerationRequest"},"CourseStatus":{"type":"string","enum":["active","draft","archived"],"title":"CourseStatus","description":"Course status options"},"CreateCourseRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Course name"},"code":{"type":"string","maxLength":10,"minLength":1,"title":"Code","description":"Course code"},"description":{"type":"string","maxLength":500,"title":"Description","description":"Course description","default":""},"domains":{"items":{"$ref":"#/components/schemas/CreateDomainRequest"},"type":"array","minItems":1,"title":"Domains","description":"Course domains"}},"type":"object","required":["name","code","domains"],"title":"CreateCourseRequest","description":"Request model for creating a course"},"CreateDomainRequest":{"properties":{"key":{"type":"string","minLength":1,"title":"Key","description":"Domain key (e.g., 'storage')"},"name":{"type":"string","minLength":1,"title":"Name","description":"Domain display name"},"weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Weight","description":"Domain weight (0.0-1.0)"},"concepts":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Concepts","description":"List of concepts"},"description":{"type":"string","title":"Description","description":"Domain description","default":""},"sandbox_eligible":{"type":"boolean","title":"Sandbox Eligible","description":"Whether this domain supports the hands-on sandbox playground.","default":false}},"type":"object","required":["key","name","weight","concepts"],"title":"CreateDomainRequest","description":"Request model for creating a domain"},"CreateTenantRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"slug":{"type":"string","maxLength":100,"minLength":1,"pattern":"^[a-z0-9\\-]+$","title":"Slug"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["name","slug"],"title":"CreateTenantRequest"},"DifficultyLevel":{"type":"string","enum":["easy","medium","hard"],"title":"DifficultyLevel","description":"Question difficulty levels"},"ErrorResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":false},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"error":{"type":"string","title":"Error","description":"Error type or code"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"Detailed error message"},"errors":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Errors","description":"Validation errors"}},"type":"object","required":["error"],"title":"ErrorResponse","description":"Error response model"},"FeedbackReason":{"type":"string","enum":["wrong_answer","unclear","irrelevant","too_easy","too_hard","duplicate","other"],"title":"FeedbackReason","description":"Why the user is reporting this question"},"GenerateContentRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier"},"domain":{"type":"string","title":"Domain","description":"Domain key"},"concept":{"type":"string","title":"Concept","description":"Concept name"},"content_type":{"$ref":"#/components/schemas/ContentType","description":"Type of content to generate"},"course_context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Course Context","description":"Additional course context"}},"type":"object","required":["course_id","domain","concept","content_type"],"title":"GenerateContentRequest","description":"Request to generate AI content for a concept"},"HealthData":{"properties":{"status":{"type":"string","title":"Status","description":"Overall system health"},"version":{"type":"string","title":"Version","description":"API version"},"environment":{"type":"string","title":"Environment","description":"Environment (development/production)"},"uptime":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Uptime","description":"System uptime in seconds"},"database_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Database Status","description":"Database connection status"},"cache_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cache Status","description":"Cache system status"},"response_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Response Time","description":"Average response time"},"memory_usage":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Memory Usage","description":"Memory usage percentage"}},"type":"object","required":["status","version","environment"],"title":"HealthData","description":"Health check data"},"HealthResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"health":{"$ref":"#/components/schemas/HealthData","description":"System health information"}},"type":"object","required":["health"],"title":"HealthResponse","description":"Response for health check"},"InviteUserRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"Firebase UID of the user to invite"},"role":{"$ref":"#/components/schemas/TenantRole","default":"member"}},"type":"object","required":["user_id"],"title":"InviteUserRequest"},"QuestionEvalResponse":{"properties":{"is_correct":{"type":"boolean","title":"Is Correct","description":"Whether answer is correct"},"grade":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Grade","description":"Grade (1-10)"},"explanation":{"type":"string","title":"Explanation","description":"Concise Explanation of correct answer"},"concepts_demonstrated":{"items":{"type":"string"},"type":"array","title":"Concepts Demonstrated","description":"list of concepts demonstrated by the answer, Use EXACT concept names from concepts_tested"},"concepts_to_review":{"items":{"type":"string"},"type":"array","title":"Concepts To Review","description":"Very concise list of concepts to review"}},"type":"object","required":["is_correct","grade","explanation","concepts_demonstrated","concepts_to_review"],"title":"QuestionEvalResponse","description":"Answer evaluation data for API responses"},"QuestionEvaluation":{"properties":{"question_id":{"type":"string","title":"Question Id","description":"Question identifier"},"is_correct":{"type":"boolean","title":"Is Correct","description":"Whether answer is correct"},"grade":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Grade","description":"Grade (0-10)"},"explanation":{"type":"string","title":"Explanation","description":"Answer explanation"},"concepts_demonstrated":{"items":{"type":"string"},"type":"array","title":"Concepts Demonstrated","description":"Concepts user demonstrated"},"concepts_to_review":{"items":{"type":"string"},"type":"array","title":"Concepts To Review","description":"Concepts to review"}},"type":"object","required":["question_id","is_correct","grade","explanation","concepts_demonstrated","concepts_to_review"],"title":"QuestionEvaluation","description":"Individual question evaluation result"},"QuestionGenerateRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier (e.g., 'CKA')"},"domain":{"type":"string","title":"Domain","description":"Target domain within the course"},"focus_concept":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Focus Concept","description":"Specific concept to focus on within the domain"}},"type":"object","required":["course_id","domain"],"title":"QuestionGenerateRequest","description":"Request to generate a new question"},"QuestionOption":{"properties":{"option_id":{"type":"string","pattern":"^[A-Z]$","title":"Option Id","description":"Option identifier (A, B, C, D)"},"text":{"type":"string","minLength":1,"title":"Text","description":"Option text content is markdown"}},"type":"object","required":["option_id","text"],"title":"QuestionOption","description":"A single question option/choice"},"QuestionResponse":{"properties":{"difficulty":{"$ref":"#/components/schemas/DifficultyLevel","description":"Question difficulty level"},"question_type":{"$ref":"#/components/schemas/QuestionType","description":"Type of question"},"question_text":{"type":"string","title":"Question Text","description":"Main question text"},"options":{"items":{"$ref":"#/components/schemas/QuestionOption"},"type":"array","title":"Options","description":"Multiple choice options (empty for open_ended)"},"correct_option_ids":{"items":{"type":"string"},"type":"array","title":"Correct Option Ids","description":"Correct option IDs (empty for open_ended)"},"expected_answer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Answer","description":"For open_ended: description of what a correct answer looks like"},"concepts_tested":{"items":{"type":"string"},"type":"array","maxItems":3,"minItems":1,"title":"Concepts Tested","description":"Concepts being tested"},"time_limit":{"type":"integer","maximum":3600.0,"minimum":30.0,"title":"Time Limit","description":"Time limit in seconds","default":300},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords","description":"Short and few Keywords for searchability"},"id":{"type":"string","title":"Id","description":"Question ID"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp"}},"type":"object","required":["difficulty","question_type","question_text","concepts_tested","id","created_at"],"title":"QuestionResponse","description":"Question data for API responses","example":{"concepts_tested":["Kubernetes","Networking"],"created_at":"2025-06-07T10:30:00Z","difficulty":"medium","domain":"networking","id":"507f1f77bcf86cd799439011","keywords":["Kubernetes","service type","ClusterIP"],"options":[{"option_id":"A","text":"ClusterIP"},{"option_id":"B","text":"NodePort"}],"question_text":"What is the default service type in Kubernetes?","question_type":"multiple_choice","time_limit":300}},"QuestionType":{"type":"string","enum":["single_choice","multiple_choice","true_false","practical","open_ended"],"title":"QuestionType","description":"Types of questions"},"QuizEvaluationRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier","default":"CKA"},"quiz_id":{"type":"string","minLength":1,"title":"Quiz Id","description":"Quiz identifier"},"user_answers":{"items":{"items":{"type":"string"},"type":"array"},"type":"array","minItems":1,"title":"User Answers","description":"User's answers for each question (list of option lists)"},"times_taken":{"items":{"type":"integer"},"type":"array","minItems":1,"title":"Times Taken","description":"Time taken for each question in seconds"}},"type":"object","required":["quiz_id","user_answers","times_taken"],"title":"QuizEvaluationRequest","description":"Request to evaluate a completed quiz"},"QuizEvaluationResponse":{"properties":{"quiz_id":{"type":"string","title":"Quiz Id","description":"Quiz identifier"},"domain":{"type":"string","title":"Domain","description":"Quiz domain"},"summary":{"$ref":"#/components/schemas/QuizSummary","description":"Overall quiz performance"},"question_evaluations":{"items":{"$ref":"#/components/schemas/QuestionEvaluation"},"type":"array","title":"Question Evaluations","description":"Individual question results"},"domain_mastery_level":{"type":"string","title":"Domain Mastery Level","description":"Current mastery level in domain"},"study_recommendations":{"items":{"type":"string"},"type":"array","title":"Study Recommendations","description":"Study recommendations"},"next_focus_areas":{"items":{"type":"string"},"type":"array","title":"Next Focus Areas","description":"Next areas to focus on"}},"type":"object","required":["quiz_id","domain","summary","question_evaluations","domain_mastery_level","study_recommendations","next_focus_areas"],"title":"QuizEvaluationResponse","description":"Complete quiz evaluation response"},"QuizGenerateRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier","default":"CKA"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain","description":"Domain to focus quiz on (if not provided, will select randomly)"},"quiz_length":{"type":"integer","maximum":10.0,"minimum":3.0,"title":"Quiz Length","description":"Number of questions in quiz","default":5}},"type":"object","title":"QuizGenerateRequest","description":"Request to generate a new quiz"},"QuizJobStatusResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"type":"string","title":"Status"},"progress":{"additionalProperties":true,"type":"object","title":"Progress"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"quiz":{"anyOf":[{"$ref":"#/components/schemas/QuizResponse"},{"type":"null"}]}},"type":"object","required":["job_id","status","progress"],"title":"QuizJobStatusResponse","description":"Status of an async quiz generation job. Includes the full quiz when done."},"QuizResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Quiz identifier"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp"},"expires_at":{"type":"string","format":"date-time","title":"Expires At","description":"Expiration timestamp"},"domain":{"type":"string","title":"Domain","description":"Quiz domain"},"questions":{"items":{"$ref":"#/components/schemas/QuestionResponse"},"type":"array","minItems":1,"title":"Questions"},"quiz_theme":{"type":"string","title":"Quiz Theme","description":"Coherent theme tying questions together"},"estimated_duration_minutes":{"type":"integer","title":"Estimated Duration Minutes","description":"Estimated completion time","default":25}},"type":"object","required":["id","created_at","expires_at","domain","questions","quiz_theme"],"title":"QuizResponse","description":"Response for quiz retrieval"},"QuizSummary":{"properties":{"total_questions":{"type":"integer","title":"Total Questions","description":"Total questions in quiz"},"correct_answers":{"type":"integer","title":"Correct Answers","description":"Number of correct answers"},"success_rate":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Success Rate","description":"Percentage correct"},"overall_score":{"type":"number","maximum":10.0,"minimum":0.0,"title":"Overall Score","description":"Average score"},"overall_grade":{"type":"string","title":"Overall Grade","description":"Letter grade (A-F)"},"total_time_seconds":{"type":"integer","title":"Total Time Seconds","description":"Total time taken"},"time_efficiency":{"type":"string","title":"Time Efficiency","description":"Time efficiency rating"}},"type":"object","required":["total_questions","correct_answers","success_rate","overall_score","overall_grade","total_time_seconds","time_efficiency"],"title":"QuizSummary","description":"Overall quiz performance summary"},"RefineContentRequest":{"properties":{"course_id":{"type":"string","title":"Course Id","description":"Course identifier"},"domain":{"type":"string","title":"Domain","description":"Domain key"},"concept":{"type":"string","title":"Concept","description":"Concept name"},"content_type":{"$ref":"#/components/schemas/ContentType","description":"Type of content"},"instruction":{"type":"string","maxLength":2000,"minLength":1,"title":"Instruction","description":"What the user wants changed"},"current_content":{"type":"string","maxLength":50000,"title":"Current Content","description":"Current draft (markdown)","default":""}},"type":"object","required":["course_id","domain","concept","content_type","instruction"],"title":"RefineContentRequest","description":"Request to ask the content-editor agent to rewrite saved content."},"RefineContentResponse":{"properties":{"new_content":{"type":"string","title":"New Content"},"summary":{"type":"string","title":"Summary"},"tools_used":{"items":{"type":"string"},"type":"array","title":"Tools Used"}},"type":"object","required":["new_content","summary"],"title":"RefineContentResponse"},"ReportRequest":{"properties":{"question_id":{"type":"string","title":"Question Id"},"reason":{"$ref":"#/components/schemas/FeedbackReason"},"details":{"type":"string","maxLength":1000,"title":"Details","default":""},"course_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Course Id"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"}},"type":"object","required":["question_id","reason"],"title":"ReportRequest"},"SaveFileRequest":{"properties":{"path":{"type":"string","maxLength":256,"minLength":1,"title":"Path"},"content":{"type":"string","title":"Content"}},"type":"object","required":["path","content"],"title":"SaveFileRequest"},"StartWorkbenchRequest":{"properties":{"course_id":{"type":"string","title":"Course Id"},"domain":{"type":"string","title":"Domain"}},"type":"object","required":["course_id","domain"],"title":"StartWorkbenchRequest"},"TenantRole":{"type":"string","enum":["owner","admin","member"],"title":"TenantRole"},"TutorContext":{"properties":{"course_code":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Course Code"},"domain":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Domain"},"concept":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Concept"},"surface":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Surface"}},"type":"object","title":"TutorContext","description":"Where in the app the user is when they open the tutor.\nUsed to seed a focused cold-open (\"you opened the tutor from\nthe indexing concept — want to drill it?\"). All fields optional\nso callers attach as much or as little as they have."},"TutorMessageRequest":{"properties":{"session_id":{"type":"string","maxLength":100,"minLength":1,"title":"Session Id"},"text":{"type":"string","maxLength":8000,"minLength":1,"title":"Text"},"context":{"anyOf":[{"$ref":"#/components/schemas/TutorContext"},{"type":"null"}]}},"type":"object","required":["session_id","text"],"title":"TutorMessageRequest"},"TutorMessageView":{"properties":{"role":{"type":"string","title":"Role"},"text":{"type":"string","title":"Text"},"ts":{"type":"string","format":"date-time","title":"Ts"}},"type":"object","required":["role","text","ts"],"title":"TutorMessageView"},"TutorPendingActionView":{"properties":{"kind":{"type":"string","title":"Kind"},"course_code":{"type":"string","title":"Course Code"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"concept":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Concept"},"label":{"type":"string","title":"Label"}},"type":"object","required":["kind","course_code","label"],"title":"TutorPendingActionView","description":"Mirrors PendingAction in the domain model — the frontend renders\nthis as a single confirm button in the panel; click pushes the main\nviewport to the matching route while the panel stays in place."},"TutorPendingCurriculumEditView":{"properties":{"course_code":{"type":"string","title":"Course Code"},"kind":{"type":"string","title":"Kind"},"rationale":{"type":"string","title":"Rationale"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"}},"type":"object","required":["course_code","kind","rationale","payload"],"title":"TutorPendingCurriculumEditView","description":"Mirrors PendingCurriculumEdit in the domain model — frontend\nrenders this as an EditProposalCard with Apply / Discard buttons.\nApply → POST /courses/{code}/apply-edit with {kind, payload}."},"TutorProposalView":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"why_this":{"type":"string","title":"Why This"}},"type":"object","required":["name","description","why_this"],"title":"TutorProposalView"},"TutorSessionView":{"properties":{"session_id":{"type":"string","title":"Session Id"},"status":{"type":"string","title":"Status"},"messages":{"items":{"$ref":"#/components/schemas/TutorMessageView"},"type":"array","title":"Messages"},"proposal":{"anyOf":[{"$ref":"#/components/schemas/TutorProposalView"},{"type":"null"}]},"pending_action":{"anyOf":[{"$ref":"#/components/schemas/TutorPendingActionView"},{"type":"null"}]},"pending_curriculum_edit":{"anyOf":[{"$ref":"#/components/schemas/TutorPendingCurriculumEditView"},{"type":"null"}]},"converted_course_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Converted Course Id"}},"type":"object","required":["session_id","status","messages"],"title":"TutorSessionView"},"TutorStartRequest":{"properties":{"initial_message":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}],"title":"Initial Message"},"context":{"anyOf":[{"$ref":"#/components/schemas/TutorContext"},{"type":"null"}]}},"type":"object","title":"TutorStartRequest","description":"Optional opening hint + optional surface context.\ninitial_message → treated like a first user turn.\ncontext        → only used when there's no initial_message; lets\n                 the agent open with a suggestion specific to the\n                 surface the user came from."},"TutorTurnResponse":{"properties":{"session":{"$ref":"#/components/schemas/TutorSessionView"}},"type":"object","required":["session"],"title":"TutorTurnResponse","description":"Returned by /tutor/start with the full session view. The frontend\nrenders the chat from this for the initial turn; subsequent turns\nflow through the SSE stream at `/tutor/message/stream`."}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}