---
title: "Create Or Get Teacher Assignment From Chat Attachment"
method: POST
path: "/teacher/assignments/from-chat-attachment"
tags: ["teacher_assignments"]
---

# Create Or Get Teacher Assignment From Chat Attachment

`POST /teacher/assignments/from-chat-attachment`

Create a draft assignment from a teacher-chat CTA, or return the assignment
already created from the same chat with identical exercise contents.

## Request body

- TeacherAssignmentFromChatAttachmentCreate
  - `chat_id` string, required
  - `exercises` union[]
    - union
      - TeacherAssignmentChatExerciseItem — One exercise proposed by the chat 'nouveau devoir' attachment: full énoncé + optional corrigé and Figure doc ids (figures are created by the frontend via POST /figures/ before this endpoint is called, mirroring the <add_exercise_attachment> apply flow).
        - `title` string, nullable
        - `statement` string, required
        - `solution` string, nullable
        - `figure_id` string, nullable
        - `solution_figure_id` string, nullable
      - string

## Response `200`

Successful Response

- TeacherAssignmentFromChatAttachmentResponse
  - `status` string, required
  - `message` string, required
  - `assignment_id` string, nullable
  - `created` boolean, required

## 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)
