> ## 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 - Student Answer Sheet

>  The API allows clients to upload and associate documents with an existing student answer sheet for a specific exam. Only one type of file format (either PDF, multiple images like JPEG or public pdf link) is allowed for a single answer sheet. Mixing formats in a single answer sheet is not permitted. 

**Key Notes:**
 -  You can supply a PDF using **`fileUrl`** instead of uploading via `documents`.
 -  **`fileUrl`** must be a **public** HTTPS URL, and the URL path must end with **`.pdf`**.
 -  Use only one of **`documents`**, **`fileUrl`**, or **`isFinal`** in a single request (do not combine them).
 

**Scenarios:**

1. **Uploading PDF Document to a Student’s Answer Sheet:**
   - The teacher provides the Answer Sheet ID and uploads a PDF.
   - **Outcome:**
     - The student’s scanned answer sheet is successfully uploaded in PDF format, replacing the placeholder document.

2. **Uploading Multiple JPEG Images for a Student’s Answer Sheet:**
   - A student’s handwritten answer sheet is scanned in parts and saved as multiple JPEG images.
   - The teacher uploads each image sequentially using the same Answer Sheet ID.
   - **Outcome:**
     - All images are uploaded, completing the student's answer sheet and associating them for grading.


 <Danger> If both `documents` and `isFinal` are provided in the same request, a validation error is returned. Use the two-step flow: first submit `documents` (file/image/public PDF link), then send `isFinal` in a separate request. For link-based uploads, the PDF URL must be publicly accessible. </Danger>



<div
  style={{
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
borderRadius: '16px',
padding: '4px',
marginTop: '20px',
marginBottom: '20px',
boxShadow: '0 10px 40px rgba(102, 126, 234, 0.3)'
}}
>
  <iframe
    className="w-full aspect-video rounded-xl"
    src="https://www.youtube.com/embed/3Xh1BQpzlcs"
    title="Evaluation Platform | PATCH | API Reference Guide"
    frameBorder="0"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
    allowFullScreen
    style={{
  borderRadius: '12px',
  boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
}}
  />
</div>

**Video link -** [https://youtu.be/3Xh1BQpzlcs?si=4EKU4MeoY60VfW7I](https://youtu.be/3Xh1BQpzlcs?si=4EKU4MeoY60VfW7I)


## OpenAPI

````yaml PATCH /evaluation-platform/v1/exam/{examId}/answer-sheet/{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:
  /evaluation-platform/v1/exam/{examId}/answer-sheet/{id}/:
    patch:
      summary: Update student answer sheet for an exam
      operationId: update_student_answer_sheet
      parameters:
        - name: examId
          in: path
          required: true
          schema:
            type: string
            example: 4340132f-50fa-4877-9ffa-e9b7ee59d51f
        - in: path
          name: id
          required: true
          schema:
            type: string
            example: f5f2576f-1e3a-4869-88ae-a2c6cd2b9eab
      requestBody:
        description: The details to update for the student answer sheet.
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                documents:
                  type: string
                  format: binary
                  description: The student answer file to be uploaded.
                fileUrl:
                  type: string
                  format: uri
                  description: >-
                    Public HTTPS URL to a PDF. Use instead of uploading
                    `documents`. The URL must be publicly accessible without
                    authentication and must end with a `.pdf` extension.
                  example: https://cdn.example.com/answer-sheet/answer-sheet-101.pdf
                isFinal:
                  type: boolean
                  description: >-
                    After successfully uploaded files pass this parameter as
                    **true** for the extraction for your exam.
                  example: true
          application/json:
            schema:
              type: object
              properties:
                fileUrl:
                  type: string
                  format: uri
                  description: >-
                    Public HTTPS URL to a PDF. Alternative to
                    `multipart/form-data` file uploads via `documents`. The URL
                    must be publicly accessible without authentication and must
                    end with a `.pdf` extension. Mutually exclusive with
                    `documents` in the same request.
                  example: https://cdn.example.com/answer-sheet/answer-sheet-101.pdf
                isFinal:
                  type: boolean
                  description: >-
                    After successfully uploaded files pass this parameter as
                    **true** for the extraction for your exam.
                  example: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique identifier of the student answer sheet
                    example: f5f2576f-1e3a-4869-88ae-a2c6cd2b9eab
                  studentId:
                    type: string
                    description: Unique identifier of the student
                    example: '2017009807'
                  instituteId:
                    type: string
                    description: Unique identifier of the institute
                    example: '98765'
                  teacherId:
                    type: string
                    description: Unique identifier of the teacher
                    example: '54321'
                  studentName:
                    type: string
                    description: Name of the student
                    example: John Doe
                  parentId:
                    type: string
                    description: Unique identifier of the parent
                    example: '11223'
                  documents:
                    type: array
                    description: List of documents associated with the student answer sheet
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Unique identifier of the document
                          example: 10d5661d-df3a-4d22-aa58-fddfa1230040
                        status:
                          type: integer
                          description: Status of the document
                          example: 1
                        pageNo:
                          type: integer
                          nullable: true
                          description: Page number of the document
                          example: null
                        uploadTime:
                          type: string
                          format: date-time
                          description: Time of document upload
                          example: '2025-01-06T12:28:22.992639Z'
                        url:
                          type: string
                          description: URL of the document
                          example: >-
                            https://cgfblob.blob.core.windows.net/ielts/evaluation/2017009807.pdf
                        fileType:
                          type: integer
                          description: Type of the document
                          example: 1
        '400':
          description: Invalid input provided, including blurred image error.
          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: >-
                                Blured image, Please try to capture the image
                                again
              example:
                error:
                  code: 400
                  message:
                    non_field_errors:
                      - Blured image, Please try to capture the image again
        '403':
          description: Authentication failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Token has expired
              example:
                detail: Token has expired
        '404':
          description: Answer Sheet 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: Answer Sheet not found
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````