---
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`

## 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/teacher/assignments/from-chat-attachment`
- Auth: OAuth 2 (password, token URL `api/login`)

Create a draft assignment from a teacher-chat CTA, or return the assignment
already created from the same chat with identical exercise contents. The
`create_assignment` chat tool runs the same service (EXC-1260).

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

- `400`: Malformed chat_id, or no exercise with an énoncé
- `404`: Resource not found
- `422`: Validation Error

## Changes

> 55 revisions in range; 1 not diffed.

- **2026-10-21** `1d6009058248`: 2 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `404`

[Operation history](https://skmtc.dev/excellence-ai/apis/excellence-learning/changes/teacher/assignments/from-chat-attachment/post.md)

---

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