{"openapi":"3.1.0","info":{"title":"Gradenza API","description":"Backend API for OCR, grading, and material generation.","version":"1.0.0"},"paths":{"/v1/analytics/student-insight":{"post":{"tags":["analytics"],"summary":"Ask the LLM questions about a student's performance","operationId":"student_insight_v1_analytics_student_insight_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudentInsightRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StudentInsightResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/materials/generate":{"post":{"tags":["materials"],"summary":"Generate educational material from a prompt","operationId":"generate_material_v1_materials_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/ocr/image-to-text":{"post":{"tags":["ocr"],"summary":"Extract text from a base64-encoded image","operationId":"image_to_text_v1_ocr_image_to_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OcrRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OcrResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/submissions/{submission_id}/process":{"post":{"tags":["submissions"],"summary":"Enqueue OCR + grading for a submission","operationId":"process_submission_v1_submissions__submission_id__process_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string","title":"Submission Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/submissions/{submission_id}/processing-status":{"get":{"tags":["submissions"],"summary":"Get the current OCR/grading status for a submission","operationId":"get_processing_status_v1_submissions__submission_id__processing_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string","title":"Submission Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessingStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"tags":["meta"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Health Health Get"}}}}}}}},"components":{"schemas":{"ChatTurn":{"properties":{"role":{"type":"string","pattern":"^(user|assistant)$","title":"Role"},"content":{"type":"string","maxLength":4000,"minLength":1,"title":"Content"}},"type":"object","required":["role","content"],"title":"ChatTurn"},"ContextOptions":{"properties":{"overall_mastery":{"type":"boolean","title":"Overall Mastery","default":true},"topic_mastery":{"type":"boolean","title":"Topic Mastery","default":true},"recent_submissions":{"type":"boolean","title":"Recent Submissions","default":true},"question_level_results":{"type":"boolean","title":"Question Level Results","default":false},"trust_layer_breakdown":{"type":"boolean","title":"Trust Layer Breakdown","default":false},"attendance_and_lessons":{"type":"boolean","title":"Attendance And Lessons","default":false},"teacher_notes":{"type":"boolean","title":"Teacher Notes","default":false},"attempt_progression":{"type":"boolean","title":"Attempt Progression","default":false},"window_days":{"type":"integer","maximum":365.0,"minimum":1.0,"title":"Window Days","default":90}},"type":"object","title":"ContextOptions"},"GenerateRequest":{"properties":{"prompt":{"type":"string","minLength":1,"title":"Prompt"}},"type":"object","required":["prompt"],"title":"GenerateRequest"},"GenerateResponse":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"content":{"type":"string","title":"Content"}},"type":"object","required":["title","content"],"title":"GenerateResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"OcrRequest":{"properties":{"imageBase64":{"type":"string","minLength":1,"title":"Imagebase64"},"mimeType":{"type":"string","title":"Mimetype","default":"image/jpeg"}},"type":"object","required":["imageBase64"],"title":"OcrRequest"},"OcrResponse":{"properties":{"text":{"type":"string","title":"Text"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["text","confidence"],"title":"OcrResponse"},"ProcessRequest":{"properties":{"submission_id":{"type":"string","title":"Submission Id"},"assignment_question_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assignment Question Id"}},"additionalProperties":false,"type":"object","required":["submission_id"],"title":"ProcessRequest"},"ProcessResponse":{"properties":{"enqueued":{"type":"boolean","title":"Enqueued"},"job_id":{"type":"string","title":"Job Id"}},"type":"object","required":["enqueued","job_id"],"title":"ProcessResponse"},"ProcessingStatusResponse":{"properties":{"submission_id":{"type":"string","title":"Submission Id"},"submission_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Submission Status"},"total_photos":{"type":"integer","title":"Total Photos"},"photos_ocr_done":{"type":"integer","title":"Photos Ocr Done"},"all_ocr_done":{"type":"boolean","title":"All Ocr Done"},"processing_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Error"},"processing_error_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Processing Error At"}},"type":"object","required":["submission_id","submission_status","total_photos","photos_ocr_done","all_ocr_done"],"title":"ProcessingStatusResponse"},"StudentInsightRequest":{"properties":{"class_id":{"type":"string","title":"Class Id"},"student_id":{"type":"string","title":"Student Id"},"prompt":{"type":"string","maxLength":2000,"minLength":1,"title":"Prompt"},"context_options":{"$ref":"#/components/schemas/ContextOptions"},"conversation":{"items":{"$ref":"#/components/schemas/ChatTurn"},"type":"array","title":"Conversation","default":[]}},"type":"object","required":["class_id","student_id","prompt"],"title":"StudentInsightRequest"},"StudentInsightResponse":{"properties":{"answer":{"type":"string","title":"Answer"},"context_used":{"items":{"type":"string"},"type":"array","title":"Context Used"},"tokens":{"$ref":"#/components/schemas/TokenUsage"}},"type":"object","required":["answer","context_used","tokens"],"title":"StudentInsightResponse"},"TokenUsage":{"properties":{"prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Tokens"},"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens"}},"type":"object","title":"TokenUsage"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}