> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazygoldfish.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PATCH - Assignment

>  This API allows authenticated users to update an existing assignment by modifying its details or uploading assignment documents.


 **Key Notes:** 
 - `id` (required in path): Unique identifier of the assignment to be updated. 
 - Request body accepts `multipart/form-data` for file uploads. 
 - You can update metadata like `assignmentName`, `grade`, `section`, or upload a document file using the `documents` field. 
 - Use the `isFinal` flag to signal that the document upload is complete, which will trigger document extraction.


 **Scenario: Uploading the Final Document** 
 - A teacher updates the assignment by uploading the final assignment PDF and setting `isFinal` to `true`. 
 - This flags the system to begin extracting content from the uploaded file.


 <Danger> If both `documents` and `isFinal` are provided in the same request, a validation error is returned. Use either `documents` to upload, or `isFinal` to trigger extraction — **not both together**. </Danger> 



## OpenAPI

````yaml PATCH /assignment-evaluation/v1/assignment/{id}/
openapi: 3.0.1
info:
  title: Evaluation Report API
  description: An API for retrieving evaluation reports.
  version: 1.0.0
servers:
  - url: https://api-staging.crazygoldfish.com
    description: SandBox endpoint
  - url: https://api.crazygoldfish.com
    description: Prod End Point
security: []
paths:
  /assignment-evaluation/v1/assignment/{id}/:
    patch:
      tags:
        - Assignments
      summary: Update Assignment
      operationId: updateAssignment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Unique identifier of the assignment
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                assignmentName:
                  type: string
                  example: English Assignment
                  description: Name of the assignment
                parentInstituteId:
                  type: string
                  example: '100'
                  description: ID of the parent institute
                instituteId:
                  type: string
                  example: '200'
                  description: ID of the institute
                courseId:
                  type: string
                  example: '300'
                  description: ID of the course
                grade:
                  type: string
                  example: '7'
                  description: Grade of the assignment
                section:
                  type: string
                  example: A
                  description: Section of the assignment
                documents:
                  type: string
                  format: binary
                  description: The assignment file to be uploaded.
                isFinal:
                  type: boolean
                  example: true
                  description: >-
                    After successfully uploaded the assignment then set
                    `isFinal` as `true` it will start extracting your document.
      responses:
        '200':
          description: Assignment updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatedAssignmentResponse'
        '400':
          description: Bad request (validation error or business logic conflict).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 400
                      message:
                        type: object
                        properties:
                          non_field_errors:
                            type: array
                            items:
                              type: string
                              example: >-
                                Only one of documents or isFinal can be
                                processed at a time
        '403':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/403Response'
        '404':
          description: Assignment not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 404
                      message:
                        type: object
                        properties:
                          non_field_errors:
                            type: array
                            items:
                              type: string
                              example: Assignment not found
      security:
        - bearerAuth: []
components:
  schemas:
    UpdatedAssignmentResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 2600413f-7c6e-46ef-8ea9-3e7b5834879f
          description: Unique identifier for the assignment.
        assignmentName:
          type: string
          example: English Assignment
          description: Name of the assignment.
        status:
          type: integer
          example: 2
          description: >-
            Status of the assignment [(refer this doc to get the
            constants)](https://docs.crazygoldfish.com/api-reference/endpoint/assignments/v1-constants)
        grade:
          type: string
          example: '7'
          description: Grade of the assignment.
        marks:
          nullable: true
          type: integer
          example: 10
        section:
          type: string
          example: A
          description: Section of the assignment.
        parentInstituteId:
          type: string
          example: '100'
          description: ID of the parent institute.
        instituteId:
          type: string
          example: '200'
          description: ID of the institute.
        courseId:
          type: string
          example: '300'
          description: ID of the course.
        documents:
          type: array
          description: List of documents associated with the assignment.
          items:
            $ref: '#/components/schemas/AssignmentDocument'
        createdAt:
          type: string
          format: date-time
          example: '2025-04-06T09:03:42.099207Z'
          description: Created date for the assignment.
        modifiedAt:
          type: string
          format: date-time
          example: '2025-04-06T09:06:19.351379Z'
          description: Modified date of the assignment.
    403Response:
      type: object
      properties:
        detail:
          type: string
          example: Token has expired
    AssignmentDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: bec0d0bf-fff6-40de-9750-65f5dcaf470d
          description: Unique identifier for the document.
        status:
          type: integer
          example: 1
          description: Status of the document.
        pageNo:
          nullable: true
          type: integer
          example: 1
        uploadTime:
          type: string
          format: date-time
          example: '2025-04-06T09:04:11.716434Z'
          description: Upload time of the document.
        url:
          type: string
          format: uri
          example: >-
            https://cgfblob.blob.core.windows.net/documents/assignment-evaluation/olfactory_imagery_HW_PDF_2_questions_1_H7dPCAd.pdf
          description: URL of the document.
        fileType:
          type: integer
          example: 1
          description: Type of the file.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````