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

> ## Agent Instructions
> DualMind Arena API base URL: https://api.dualmindlab.tech. Public endpoints only; admin routes are not part of this API.
> Authenticate with the access token from an Arena session (a Supabase JWT) as `Authorization: Bearer <token>`. There are no API keys yet; never invent one.
> For battles call POST /api/arena/dualchat, then vote with POST /api/arena/model-vote using the returned comparisonId. Keep model names hidden from voters until they vote.
> GET /api/arena/model-stats (leaderboard) and GET /health need no token.

# Get thread messages

> All turns in a thread, oldest first. Same access rules as `GET /api/threads/{threadId}`. With a token, `voteChoice` and `hasVoted` reflect your own votes.

Battle turns fill both `model1*` and `model2*` fields and carry a `comparisonId`; single-model turns only fill `model1*`.


## OpenAPI

````yaml GET /api/threads/{threadId}/messages
openapi: 3.1.0
info:
  title: DualMind Arena API
  version: 1.0.0
  description: >-
    The REST API behind DualMind Arena: blind battles, votes, the leaderboard,
    models and threads.
  contact:
    name: DualMind Labs
    email: support@dualmindlab.tech
    url: https://dualmindlab.tech
servers:
  - url: https://api.dualmindlab.tech
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Arena
    description: Battles and chat.
  - name: Voting
    description: Votes and the leaderboard.
  - name: Models
    description: Available models.
  - name: Threads
    description: Saved conversations and sharing.
  - name: Utilities
    description: Health and feature flags.
paths:
  /api/threads/{threadId}/messages:
    get:
      tags:
        - Threads
      summary: Get thread messages
      description: >-
        All turns in a thread, oldest first. Same access rules as `GET
        /api/threads/{threadId}`. With a token, `voteChoice` and `hasVoted`
        reflect your own votes.
      operationId: getThreadMessages
      parameters:
        - name: threadId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Thread ID.
      responses:
        '200':
          description: Messages.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/ThreadMessage'
        '401':
          description: The thread is private and no valid token was sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The thread is private and belongs to someone else.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such thread.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Unexpected error. `error` carries the message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: Unexpected error while loading the messages.
                code: MESSAGES_ERROR
      security:
        - bearerAuth: []
        - {}
components:
  schemas:
    ThreadMessage:
      type: object
      description: One turn in a thread. Single-model turns only fill the `model1*` fields.
      properties:
        messageId:
          type: string
          format: uuid
        threadId:
          type: string
          format: uuid
        position:
          type: integer
          description: Order within the thread (ascending).
        promptText:
          type: string
        model1Name:
          type: string
        model2Name:
          type: string
        model1Response:
          type: string
        model2Response:
          type: string
        model1TimeMs:
          type: integer
        model2TimeMs:
          type: integer
        comparisonId:
          type: string
          format: uuid
          description: Set for battle turns; use it to vote.
        voteChoice:
          type: string
          enum:
            - left
            - right
            - tie
            - both-bad
          description: Your vote on this turn, if any.
        hasVoted:
          type: boolean
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      description: >-
        Error envelope used by the threads, voting, models and settings
        endpoints.
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
          description: Human-readable message.
        code:
          type: string
          description: >-
            Machine-readable code, e.g. `INVALID_REQUEST`, `NOT_FOUND`,
            `FORBIDDEN`, `UNAUTHORIZED`, `VOTE_ERROR`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        The access token from your DualMind Arena session (a Supabase JWT). See
        Authentication.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.