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

# Course Assistant Turn

> One assistant turn: send the client's message, get the reply and the next
question.

When the course's uploaded documents have been digested, the response may
carry a `suggestion` object for the served question:
`{question_id, theme, say, candidate, evidence, status}`. `candidate` is the
full pre-validated value a confirm would record (every field shown, exactly
as stored); `evidence` quotes the client's own documents. While the digest is
still building (or failed, or the course has no sources) the field is simply
omitted and the turn proceeds normally.

To accept a suggestion, send `confirm: {question_id, value?}` instead of a
message. The server validates and records it exactly like a typed answer
(`source='text'`) with zero model calls; `value` overrides the stored
candidate when the client edited the surface. Errors: 400 `confirm_not_current`
(the id is not the question currently served), 400 `confirm_no_candidate`
(nothing stored to confirm and no value supplied). Confirm turns are
idempotent under `client_turn_id` like any other turn.



## OpenAPI

````yaml /openapi.yaml post /api/v1/courses/{course_id}/assistant/{session_id}/turn
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}/assistant/{session_id}/turn:
    post:
      tags:
        - B2B Assistant
      summary: Course Assistant Turn
      description: >-
        One assistant turn: send the client's message, get the reply and the
        next

        question.


        When the course's uploaded documents have been digested, the response
        may

        carry a `suggestion` object for the served question:

        `{question_id, theme, say, candidate, evidence, status}`. `candidate` is
        the

        full pre-validated value a confirm would record (every field shown,
        exactly

        as stored); `evidence` quotes the client's own documents. While the
        digest is

        still building (or failed, or the course has no sources) the field is
        simply

        omitted and the turn proceeds normally.


        To accept a suggestion, send `confirm: {question_id, value?}` instead of
        a

        message. The server validates and records it exactly like a typed answer

        (`source='text'`) with zero model calls; `value` overrides the stored

        candidate when the client edited the surface. Errors: 400
        `confirm_not_current`

        (the id is not the question currently served), 400
        `confirm_no_candidate`

        (nothing stored to confirm and no value supplied). Confirm turns are

        idempotent under `client_turn_id` like any other turn.
      operationId: >-
        course_assistant_turn_api_v1_courses__course_id__assistant__session_id__turn_post
      parameters:
        - name: course_id
          in: path
          required: true
          schema:
            type: string
            title: Course Id
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TurnRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TurnRequest:
      properties:
        client_turn_id:
          type: string
          maxLength: 128
          minLength: 1
          title: Client Turn Id
        message:
          type: string
          maxLength: 8000
          title: Message
          default: ''
        confirm:
          anyOf:
            - $ref: '#/components/schemas/Confirm'
            - type: 'null'
          description: >-
            Explicit confirmation of the served question's document suggestion.
            A confirm turn makes zero model calls; the answer is validated and
            recorded by the server exactly as a typed answer would be
            (source='text').
      type: object
      required:
        - client_turn_id
      title: TurnRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Confirm:
      properties:
        question_id:
          type: string
          maxLength: 64
          minLength: 1
          title: Question Id
          description: >-
            Must equal the question currently served to this session; any other
            id is rejected with 400 confirm_not_current.
        value:
          anyOf:
            - {}
            - type: 'null'
          title: Value
          description: >-
            The client-edited value to record. Omit (or null) to record the
            suggestion's stored candidate as shown. A confirm with no stored
            candidate and no value is rejected with 400 confirm_no_candidate.
      type: object
      required:
        - question_id
      title: Confirm
      description: >-
        The explicit confirmation of a document-derived suggestion (doc-digest

        design 4.2). This is the SOLE structural write channel for a doc value:
        it is

        an HTTP-supplied field the turn model cannot emit (it exists in no tool

        schema), so no document injection can forge it. When present, the ROUTE
        runs

        the identical gate a typed answer runs (answer_ok, then the engine
        submit and

        record with source='text') and makes ZERO model calls.
    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

````