openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: eden description: Eden AI student app operations - name: openai description: OpenAI AI chat, image, and audio operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /eden/students: post: operationId: createStudent tags: [eden] summary: Create a new student profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateStudentBody" responses: "201": description: Created student content: application/json: schema: $ref: "#/components/schemas/Student" /eden/students/{id}: get: operationId: getStudent tags: [eden] summary: Get student profile parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Student profile content: application/json: schema: $ref: "#/components/schemas/Student" "404": description: Not found put: operationId: updateStudent tags: [eden] summary: Update student profile parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateStudentBody" responses: "200": description: Updated student content: application/json: schema: $ref: "#/components/schemas/Student" /eden/students/{id}/doubt-sessions: post: operationId: createDoubtSession tags: [eden] summary: Start a Socratic doubt session (streaming) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DoubtSessionBody" responses: "200": description: SSE stream of Socratic questions content: text/event-stream: {} /eden/students/{id}/doubt-history: get: operationId: getDoubtHistory tags: [eden] summary: Get doubt session history parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of doubt sessions content: application/json: schema: type: array items: $ref: "#/components/schemas/DoubtSession" /eden/students/{id}/study-plan: get: operationId: getStudyPlan tags: [eden] summary: Get student study plan parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Study plan content: application/json: schema: $ref: "#/components/schemas/StudyPlan" post: operationId: generateStudyPlan tags: [eden] summary: Generate or regenerate study plan parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateStudyPlanBody" responses: "200": description: Generated study plan content: application/json: schema: $ref: "#/components/schemas/StudyPlan" /eden/students/{id}/progress: get: operationId: getStudentProgress tags: [eden] summary: Get student progress and Eden Score parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Student progress content: application/json: schema: $ref: "#/components/schemas/StudentProgress" /eden/students/{id}/notes: get: operationId: getNotes tags: [eden] summary: Get smart notes for student parameters: - name: id in: path required: true schema: type: integer - name: subject in: query schema: type: string responses: "200": description: List of notes content: application/json: schema: type: array items: $ref: "#/components/schemas/SmartNote" post: operationId: generateNote tags: [eden] summary: Generate smart note for a topic parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateNoteBody" responses: "201": description: Generated note content: application/json: schema: $ref: "#/components/schemas/SmartNote" /openai/conversations: get: operationId: listOpenaiConversations tags: [openai] summary: List all conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiConversation" post: operationId: createOpenaiConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOpenaiConversationBody" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/OpenaiConversation" /openai/conversations/{id}: get: operationId: getOpenaiConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationWithMessages" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" delete: operationId: deleteOpenaiConversation tags: [openai] summary: Delete a conversation parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" /openai/conversations/{id}/messages: get: operationId: listOpenaiMessages tags: [openai] summary: List messages in a conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of messages content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiMessage" post: operationId: sendOpenaiMessage tags: [openai] summary: Send a text message and receive a streaming text response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendOpenaiMessageBody" responses: "200": description: SSE stream of assistant text chunks content: text/event-stream: {} /openai/generate-image: post: operationId: generateOpenaiImage tags: [openai] summary: Generate an image from a text prompt requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageBody" responses: "200": description: Generated image data content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: - status Student: type: object properties: id: type: integer fullName: type: string class: type: string board: type: string schoolName: type: string parentWhatsapp: type: string edenScore: type: integer createdAt: type: string format: date-time required: - id - fullName - class - board - schoolName - parentWhatsapp - edenScore - createdAt CreateStudentBody: type: object properties: fullName: type: string class: type: string board: type: string schoolName: type: string parentWhatsapp: type: string password: type: string required: - fullName - class - board - schoolName - parentWhatsapp - password UpdateStudentBody: type: object properties: fullName: type: string class: type: string board: type: string schoolName: type: string parentWhatsapp: type: string DoubtSessionBody: type: object properties: subject: type: string question: type: string conversationHistory: type: array items: type: object properties: role: type: string content: type: string required: - role - content required: - subject - question DoubtSession: type: object properties: id: type: integer studentId: type: integer subject: type: string topic: type: string questionsCount: type: integer resolvedAt: type: string format: date-time createdAt: type: string format: date-time required: - id - studentId - subject - topic - questionsCount - createdAt StudyPlanDay: type: object properties: date: type: string subject: type: string topic: type: string durationMinutes: type: integer completed: type: boolean required: - date - subject - topic - durationMinutes - completed StudyPlan: type: object properties: id: type: integer studentId: type: integer days: type: array items: $ref: "#/components/schemas/StudyPlanDay" examDate: type: string targetSubject: type: string createdAt: type: string format: date-time required: - id - studentId - days - createdAt GenerateStudyPlanBody: type: object properties: examDate: type: string targetSubject: type: string dailyHours: type: number required: - examDate - targetSubject SubjectPerformance: type: object properties: subject: type: string status: type: string enum: [strong, needs_work, urgent] studyMinutesThisWeek: type: integer doubtsAsked: type: integer score: type: integer required: - subject - status - studyMinutesThisWeek - doubtsAsked - score StudentProgress: type: object properties: edenScore: type: integer previousScore: type: integer subjectPerformance: type: array items: $ref: "#/components/schemas/SubjectPerformance" totalStudyMinutesThisWeek: type: integer doubtsAskedThisWeek: type: integer planFollowedDays: type: integer planTotalDays: type: integer required: - edenScore - previousScore - subjectPerformance - totalStudyMinutesThisWeek - doubtsAskedThisWeek - planFollowedDays - planTotalDays SmartNote: type: object properties: id: type: integer studentId: type: integer subject: type: string topic: type: string content: type: string keyTerms: type: array items: type: string createdAt: type: string format: date-time required: - id - studentId - subject - topic - content - keyTerms - createdAt GenerateNoteBody: type: object properties: subject: type: string topic: type: string required: - subject - topic OpenaiConversation: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time required: - id - title - createdAt OpenaiMessage: type: object properties: id: type: integer conversationId: type: integer role: type: string content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt CreateOpenaiConversationBody: type: object properties: title: type: string required: - title SendOpenaiMessageBody: type: object properties: content: type: string required: - content OpenaiConversationWithMessages: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/OpenaiMessage" required: - id - title - createdAt - messages GenerateOpenaiImageBody: type: object properties: prompt: type: string size: type: string enum: ["1024x1024", "512x512", "256x256"] required: - prompt GenerateOpenaiImageResponse: type: object properties: b64_json: type: string required: - b64_json OpenaiError: type: object properties: error: type: string required: - error