---
title: "Generate Exercise Solution"
method: POST
path: "/teacher_exercises/{exercise_id}/generate-solution"
tags: ["teacher_exercises"]
---

# Generate Exercise Solution

`POST /teacher_exercises/{exercise_id}/generate-solution`

Generate a solution for a teacher exercise using AI.

## Path parameters

- `exercise_id` string, required

## Request body

- GenerateExerciseSolutionRequest
  - `custom_instructions` string, nullable
  - `assignment_id` string, nullable

## Response `200`

Successful Response

- TeacherExerciseResponse
  - `id` string, required
  - `teacher_id` string, required
  - `title` string, nullable, required
  - `content` string, required
  - `solution` string, nullable, required
  - `figure_id` string, nullable
  - `solution_figure_id` string, nullable
  - `figure_content` string, nullable
  - `figure_solution` string, nullable
  - `difficulty` string, nullable, required
  - `themes` string[], required
  - `source` string, required
  - `subject` 'maths' | 'physique-chimie'
  - `grade` 'sixieme' | 'cinquieme' | 'quatrieme' | 'troisieme' | 'seconde' | 'premiere' | 'terminale' | 'prepa', nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `is_private` boolean, required
  - `is_saved` boolean, required
  - `school_year` string, required
  - `is_past` boolean
  - `folder_id` string, nullable
  - `likes_count` integer

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/excellence-ai/apis/excellence-learning.md) · [All operations](https://skmtc.dev/excellence-ai/apis/excellence-learning/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/excellence-ai/excellence-learning/revisions/c407f3b5a05b/schema)
