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

# Submit Feedback

> Submit feedback on an assistant message.

When positive feedback is received, the conversation exchange is stored
to memory for future context. When negative feedback is received, the
exchange is NOT stored. This enables learning from quality interactions.

Args:
    request: FastAPI request with tenant context
    session_id: Session identifier
    payload: Feedback request

Returns:
    SubmitFeedbackResponse with feedback status

Raises:
    NotFoundError: If session or message not found

Example:
    ```bash
    curl -X POST http://localhost:8000/v1/agents/sessions/ses_abc123/feedback \
      -H "Authorization: Bearer {api_key}" \
      -H "X-Namespace: {namespace_id}" \
      -H "Content-Type: application/json" \
      -d '{
        "message_id": "msg_xyz789",
        "rating": "positive",
        "feedback_text": "Very helpful response!"
      }'
    ```



## OpenAPI

````yaml post /v1/agents/sessions/{session_id}/feedback
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/agents/sessions/{session_id}/feedback:
    post:
      tags:
        - Agent Sessions
      summary: Submit Feedback
      description: |-
        Submit feedback on an assistant message.

        When positive feedback is received, the conversation exchange is stored
        to memory for future context. When negative feedback is received, the
        exchange is NOT stored. This enables learning from quality interactions.

        Args:
            request: FastAPI request with tenant context
            session_id: Session identifier
            payload: Feedback request

        Returns:
            SubmitFeedbackResponse with feedback status

        Raises:
            NotFoundError: If session or message not found

        Example:
            ```bash
            curl -X POST http://localhost:8000/v1/agents/sessions/ses_abc123/feedback \
              -H "Authorization: Bearer {api_key}" \
              -H "X-Namespace: {namespace_id}" \
              -H "Content-Type: application/json" \
              -d '{
                "message_id": "msg_xyz789",
                "rating": "positive",
                "feedback_text": "Very helpful response!"
              }'
            ```
      operationId: submit_feedback_v1_agents_sessions__session_id__feedback_post
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            description: Session ID
            title: Session Id
          description: Session ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitFeedbackRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitFeedbackResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitFeedbackRequest:
      properties:
        message_id:
          type: string
          title: Message Id
          description: Assistant message ID (REQUIRED)
        rating:
          type: string
          pattern: ^(positive|negative)$
          title: Rating
          description: 'Feedback rating: ''positive'' or ''negative'' (REQUIRED)'
        feedback_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Feedback Text
          description: Additional feedback text (OPTIONAL)
      type: object
      required:
        - message_id
        - rating
      title: SubmitFeedbackRequest
      description: |-
        Request payload for submitting feedback on a message.

        Attributes:
            message_id: The assistant message ID to provide feedback for
            rating: Feedback rating (positive or negative)
            feedback_text: Optional additional feedback text

        Example:
            ```python
            request = SubmitFeedbackRequest(
                message_id="msg_abc123",
                rating="positive",
                feedback_text="This was very helpful!"
            )
            ```
      examples:
        - feedback_text: Great response!
          message_id: msg_abc123
          rating: positive
    SubmitFeedbackResponse:
      properties:
        session_id:
          type: string
          title: Session Id
          description: Session identifier
        message_id:
          type: string
          title: Message Id
          description: Message identifier
        rating:
          type: string
          title: Rating
          description: Feedback rating submitted
        stored:
          type: boolean
          title: Stored
          description: Whether exchange was stored to memory
        recorded_at:
          type: string
          format: date-time
          title: Recorded At
          description: Feedback timestamp
      type: object
      required:
        - session_id
        - message_id
        - rating
        - stored
        - recorded_at
      title: SubmitFeedbackResponse
      description: |-
        Response for feedback submission.

        Attributes:
            session_id: Session identifier
            message_id: Message that received feedback
            rating: The feedback rating submitted
            stored: Whether the exchange was stored to memory
            recorded_at: Timestamp when feedback was recorded

        Example:
            ```python
            response = SubmitFeedbackResponse(
                session_id="ses_abc123",
                message_id="msg_xyz789",
                rating="positive",
                stored=True,
                recorded_at=current_time()
            )
            ```
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    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

````