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

# Get messages for a thread (UIMessage format)

> Retrieve messages from a conversation thread in AI SDK v6 UIMessage format, ready for assistant-ui rendering. Requires authentication.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/messages
openapi: 3.1.0
info:
  title: Sidenet API
  version: 1.0.0
  description: >-
    Custom HTTP endpoints exposed by the Sidenet Mastra server. All routes
    require a bearer token and resolve org context from the API key (or the
    `X-Organization-Id` header). This reference is generated from the live route
    definitions in `src/mastra/routes`.
servers:
  - url: ''
security:
  - bearerAuth: []
paths:
  /v1/messages:
    servers:
      - url: /
    get:
      tags:
        - V1
      summary: Get messages for a thread (UIMessage format)
      description: >-
        Retrieve messages from a conversation thread in AI SDK v6 UIMessage
        format, ready for assistant-ui rendering. Requires authentication.
      parameters:
        - name: threadId
          in: query
          required: true
          description: Thread identifier
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: Maximum number of messages to return (max 50, default 10)
          schema:
            type: number
            minimum: 1
            maximum: 50
            default: 10
        - name: offset
          in: query
          required: false
          description: Number of messages to skip for pagination
          schema:
            type: number
            minimum: 0
            default: 0
        - name: X-Organization-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Organization to scope the request to. Optional when authenticating
            with an org API key (the org is taken from the key; if sent, it must
            match). Required when authenticating with the trusted key.
        - name: X-User-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            End-user identity for the request; user-scoped data (threads,
            memory) resolves to `{orgId}_{userId}`. Required by endpoints that
            read or write user-scoped resources. A `userId` query param (or body
            field, where documented) is accepted as a fallback.
      responses:
        '200':
          description: Messages in UIMessage format
          content:
            application/json:
              schema:
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        role:
                          type: string
                          enum:
                            - user
                            - assistant
                            - system
                        parts:
                          type: array
                          items:
                            type: object
                        metadata:
                          type: object
                  hasMore:
                    type: boolean
                  totalCount:
                    type: number
                  title:
                    type: string
                    description: The thread title (null if unset or thread not found)
        '400':
          description: Bad request - missing threadId or organization context
        '403':
          description: Forbidden - no permission to access thread
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Org API key (scopes the request to its organization) or the shared
        trusted key (requires `X-Organization-Id` on every request).

````