---
title: "Apply Course Chat Action"
method: POST
path: "/teacher/courses/{course_id}/chat-action"
tags: ["Teacher Courses"]
---

# Apply Course Chat Action

`POST /teacher/courses/{course_id}/chat-action`

Apply a batch of granular edits proposed by the chat assistant on the
course "Aperçu" page (edit/insert/delete a block, rename/add/delete a
unit, insert a generated figure). Block numbers refer to the unit as it
was when the assistant proposed the batch.

## Path parameters

- `course_id` string, required

## Request body

- CourseChatActionRequest
  - `operations` CourseChatOperationPayload[]
    - `type` 'edit_block' | 'insert_block' | 'delete_block' | 'edit_unit_title' | 'add_unit' | 'delete_unit' | 'add_flashcard' | 'edit_flashcard' | 'delete_flashcard' | 'add_quiz_question' | 'edit_quiz_question' | 'delete_quiz_question' | 'add_qcm' | 'edit_qcm' | 'delete_qcm', required
    - `unit_id` string, nullable
    - `block_index` integer, nullable
    - `block_type` string, nullable
    - `content` string, nullable
    - `figure` string, nullable
    - `image_url` string, nullable
    - `title` string, nullable
    - `after_unit_id` string, nullable
    - `unit_type` string, nullable
    - `flashcard_id` string, nullable
    - `qcm_id` string, nullable
    - `front` string, nullable
    - `back` string, nullable
    - `question_id` string, nullable
    - `question_type` string, nullable
    - `variation_index` integer, nullable
    - `question` string, nullable
    - `options` string[], nullable
    - `correct_option` integer, nullable
    - `explanation` string, nullable
    - `expected_answer` string, nullable
    - `criteria` string[], nullable

## Response `200`

Successful Response

- CourseChatActionResponse
  - `status` string, required
  - `applied` integer, required
  - `skipped` string[], required
  - `figure_ids` string[], required
  - `touched_unit_ids` string[], required
  - `flashcards_touched` boolean
  - `qcm_touched` boolean
  - `quiz_touched` boolean
  - `course` Course, required — Represents a user course created through image uploads.
    - `_id` string
    - `user_id` string, required
    - `is_teacher_course` boolean
    - `folder_id` string, nullable
    - `title` string, required
    - `subject` string, nullable
    - `status` 'UPLOADING' | 'PROCESSING_IMAGES' | 'STRUCTURING' | 'GENERATING_CONTENT' | 'COMPLETED' | 'FAILED'
    - `original_image_paths` string[]
    - `raw_content_blob` string, nullable
    - `units` CourseUnit[], nullable
      - `unit_id` string
      - `type` 'chapter' | 'section' | 'topic' | 'concept_explanation' | 'introduction' | 'conclusion' | 'content' | 'flashcards' | 'qcm', required — Valid unit types for course content
      - `title` string, required
      - `unit_summary` string, required
      - `suggested_content_type` 'chapter' | 'section' | 'topic' | 'concept_explanation' | 'introduction' | 'conclusion' | 'content' | 'flashcards' | 'qcm' — Valid unit types for course content
      - `brief_description` string, nullable
      - `generated_content` string, nullable
    - `generated_course_content` string, nullable
    - `revision_deck_status` 'GENERATING' | 'COMPLETED' | 'FAILED', nullable
    - `knowledge_quiz_status` 'GENERATING' | 'COMPLETED' | 'FAILED', nullable
    - `error_message` string, nullable
    - `warnings` string[], nullable
    - `figures_crop` object, nullable
    - `processing_options` object, nullable
    - `source_type` 'student_upload' | 'teacher_assigned' | 'holiday_workbook', nullable
    - `holiday_course_context` object, nullable
    - `created_at` string, date-time
    - `updated_at` string, date-time

## 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/2a0c1636fd3b?raw)
