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

# List messages

> List messages with offset pagination and optional role filter.



## OpenAPI

````yaml /public/api/openapi.json get /v1/public/agents/conversations/{conversation_id}/messages
openapi: 3.1.0
info:
  title: Quintus Public Chat API
  description: >-
    Quintus Public Chat API - for embedding agent conversations in
    customer-facing

    front-ends (websites, apps).


    **Authentication.** Two schemes:


    1. **API Key** (`X-API-Key` header) - used to **start** a conversation and
    to
       **refresh** its session token. Scoped per agent via `api_key.resources["agents"]`.
    2. **Session Token** (`Authorization: Bearer ...`) - short-lived JWT
    returned by
       `POST /conversations`. Used for everything inside an existing conversation
       (send messages, upload files, fetch state, terminate).

    **Rate limiting.** Requests are rate-limited per API key and per session
    token.

    Exceeding the limit returns `429 Too Many Requests` with a `Retry-After`
    header.

    Limits and headers are subject to change - clients should always honor
    `Retry-After`.


    **Errors.** All non-2xx responses use the standard `ErrorEnvelope` shape
    with a

    stable `error.code` for programmatic handling.
  contact:
    name: Quintus Support
    email: support@quintus.tec.br
  license:
    name: Proprietary - Quintus
    url: https://quintus.tec.br/
  version: 1.0.0
servers:
  - url: https://api.quintus.tec.br
security: []
tags:
  - name: Conversations
    description: Conversation lifecycle and tokens.
  - name: Messages
    description: Send and read messages within a conversation.
  - name: Files
    description: Upload and list files attached to a conversation.
  - name: Feedback
    description: Conversation-level feedback (NPS-style).
paths:
  /v1/public/agents/conversations/{conversation_id}/messages:
    get:
      tags:
        - Messages
      summary: List messages
      description: List messages with offset pagination and optional role filter.
      operationId: listMessages
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
            title: Conversation Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Page size (max 100).
            default: 20
            title: Limit
          description: Page size (max 100).
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Number of items to skip.
            default: 0
            title: Offset
          description: Number of items to skip.
        - name: after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Return messages with id > after.
            title: After
          description: Return messages with id > after.
        - name: before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Return messages with id < before.
            title: Before
          description: Return messages with id < before.
        - name: roles
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: 'Comma-separated roles to include (default: user,assistant).'
            title: Roles
          description: 'Comma-separated roles to include (default: user,assistant).'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageList'
        '401':
          description: Authentication missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Authenticated but not allowed for this resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded - see Retry-After header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - SessionToken: []
components:
  schemas:
    MessageList:
      properties:
        items:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Items
        next_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Next Offset
          description: Pass as `offset` to fetch the next page. Null = no more results.
      type: object
      required:
        - items
      title: MessageList
    ErrorEnvelope:
      example:
        error:
          code: session_token_expired
          context: {}
          message: Session token has expired. Refresh to continue.
          name: SessionTokenExpiredError
        request_id: 5f0c-...
        timestamp: '2026-04-27T12:00:00Z'
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Request ID for support correlation.
          title: Request Id
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: ISO-8601 server timestamp when the error occurred.
          title: Timestamp
      required:
        - error
      title: ErrorEnvelope
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Message:
      properties:
        id:
          type: string
          title: Id
        role:
          type: string
          enum:
            - user
            - assistant
          title: Role
        content:
          items:
            oneOf:
              - $ref: '#/components/schemas/TextBlock'
              - $ref: '#/components/schemas/ImageBlock'
              - $ref: '#/components/schemas/FileBlock'
            discriminator:
              propertyName: type
              mapping:
                file:
                  $ref: '#/components/schemas/FileBlock'
                image:
                  $ref: '#/components/schemas/ImageBlock'
                text:
                  $ref: '#/components/schemas/TextBlock'
          type: array
          title: Content
        created_at:
          type: string
          format: date-time
          title: Created At
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      required:
        - id
        - role
        - content
        - created_at
      title: Message
    ErrorBody:
      properties:
        code:
          type: string
          title: Code
          description: Stable machine-readable error code (snake_case).
        name:
          type: string
          title: Name
          description: Error class name (PascalCase).
        message:
          type: string
          title: Message
          description: Human-readable explanation.
        context:
          additionalProperties: true
          type: object
          title: Context
          description: Error-specific structured context (ids, limits, hints).
      type: object
      required:
        - code
        - name
        - message
      title: ErrorBody
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TextBlock:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          minLength: 1
          title: Text
          description: UTF-8 text content.
      type: object
      required:
        - text
      title: TextBlock
      example:
        text: Hello agent
        type: text
    ImageBlock:
      properties:
        type:
          type: string
          const: image
          title: Type
          default: image
        file_id:
          type: string
          title: File Id
          description: ID returned by POST /conversations/{id}/files.
      type: object
      required:
        - file_id
      title: ImageBlock
      example:
        file_id: f_abc123
        type: image
    FileBlock:
      properties:
        type:
          type: string
          const: file
          title: Type
          default: file
        file_id:
          type: string
          title: File Id
          description: ID returned by POST /conversations/{id}/files.
      type: object
      required:
        - file_id
      title: FileBlock
      example:
        file_id: f_abc123
        type: file
  securitySchemes:
    SessionToken:
      type: http
      scheme: bearer

````