---
title: "Generate And Import Validation Exercises"
method: POST
path: "/admin/holiday-courses/subchapitres/{sub_chapitre_id}/generate-and-import-validation-exercises"
tags: ["Admin - Holiday Courses"]
---

# Generate And Import Validation Exercises

`POST /admin/holiday-courses/subchapitres/{sub_chapitre_id}/generate-and-import-validation-exercises`

## Request

- Base URL: `https://api.excellence-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.excellence-ai.com/admin/holiday-courses/subchapitres/{sub_chapitre_id}/generate-and-import-validation-exercises`
- Auth: OAuth 2 (password, token URL `api/login`)

Generate exercises from course content using AI and import them automatically.

This endpoint:
1. Fetches the combined content of the SubChapitre's course
2. Uses an LLM (prompt pp-admin-content-to-tex-exercises-01) to generate a LaTeX string containing 9 categorized exercises based on this content
3. Then, reuses the refactored logic from the existing .tex import feature to parse this AI-generated LaTeX, generate solutions/hints for each exercise, create HolidayCourseExercise documents, and link them to the SubChapitre

## Path parameters

- `sub_chapitre_id` string, required: The ID of the holiday course sub-chapitre

## Response `200`

Successful Response

- GenerateAndImportExercisesResponse: Response model for generate-and-import operation
  - `status` string, required
  - `message` string, required
  - `created_exercises_count` integer
  - `processed_exercises` ProcessedExercise[]
    - `statement` string, required
    - `difficulty` 'easy' | 'medium' | 'hard', required
    - `title` string, nullable
    - `solution` string, required
    - `hints1` string, nullable
    - `hints2` string, nullable
    - `hints3` string, nullable
    - `created_exercise_id` string, required
  - `errors` string[]
  - `generated_tex_preview` string, nullable

## 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.dev/excellence-ai/apis/excellence-learning/revisions/379e4a57dee8?raw)
