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

# Grade Module Quiz

> Grade a module-quiz submission. Auto-grades objective questions and AI-grades
open-ended ones. The denominator is `served_ids` (served-but-unanswered = 0).
Returns 503 (code grading_unavailable) if the AI grader is transiently down.



## OpenAPI

````yaml /openapi.yaml post /api/v1/courses/{course_id}/quiz/grade
openapi: 3.1.0
info:
  title: Mahara Platform
  description: >
    AI Sales Training Course Generator, a Coursera-style platform.


    ## Authentication


    Every request must carry your API key as a Bearer token:


    `Authorization: Bearer sk_live_your_key_here`


    ## Getting an API key


    API keys are provisioned by our team. They are not self-service, so there is
    no signup page to apply on. To request access, email **sales@myustadia.com**
    and we will issue a key for your account.
  version: 1.0.0
servers: []
security: []
paths:
  /api/v1/courses/{course_id}/quiz/grade:
    post:
      tags:
        - B2B Quiz
      summary: Grade Module Quiz
      description: >-
        Grade a module-quiz submission. Auto-grades objective questions and
        AI-grades

        open-ended ones. The denominator is `served_ids` (served-but-unanswered
        = 0).

        Returns 503 (code grading_unavailable) if the AI grader is transiently
        down.
      operationId: grade_module_quiz_api_v1_courses__course_id__quiz_grade_post
      parameters:
        - name: course_id
          in: path
          required: true
          schema:
            type: string
            title: Course Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GradeRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GradeRequest:
      properties:
        module_num:
          type: integer
          minimum: 1
          title: Module Num
          description: Module number
        answers:
          items:
            additionalProperties: true
            type: object
          type: array
          maxItems: 200
          title: Answers
          description: 'List of answer objects: [{question_id, answer}]'
        served_ids:
          items:
            type: string
          type: array
          maxItems: 200
          title: Served Ids
          description: >-
            REQUIRED. Question IDs served to the learner for this attempt (echo
            the served_ids from the serve response). This is the grading
            denominator: every served question left unanswered scores 0. A grade
            without served_ids is rejected (400).
        tier:
          type: string
          title: Tier
          description: 'Quiz tier: associate, professional, or expert'
          default: associate
      type: object
      required:
        - module_num
        - answers
      title: GradeRequest
      description: Request body for POST /api/v1/courses/{id}/quiz/grade
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````