> ## Documentation Index
> Fetch the complete documentation index at: https://magica-adi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List messages



## OpenAPI

````yaml /openapi.yaml get /chats/{chatId}/messages
openapi: 3.1.0
info:
  title: Galaxy Agent API
  version: 1.0.0
  description: |
    Public REST for agent chats, Magica tools, and run status.
    Authenticate with `Authorization: Bearer gxk_live_…`.
servers:
  - url: https://magica-backend-oda9.onrender.com/api/v1
    description: Production
  - url: http://localhost:4000/api/v1
    description: Local
security:
  - bearerAuth: []
tags:
  - name: Chats
  - name: Messages
  - name: Runs
  - name: Magica
paths:
  /chats/{chatId}/messages:
    get:
      tags:
        - Messages
      summary: List messages
      operationId: listMessages
      parameters:
        - $ref: '#/components/parameters/chatId'
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 50
        - name: cursor
          in: query
          schema:
            type: string
      responses:
        '200':
          description: >-
            Messages, newest first. Each item includes `attachments` with `id`
            when the message has files.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageList'
              examples:
                withFile:
                  summary: User message with an uploaded image
                  value:
                    items:
                      - id: 55555555-5555-5555-5555-555555555555
                        chatId: 11111111-1111-4111-8111-111111111111
                        role: USER
                        status: SUCCESS
                        contentBlocks:
                          - type: text
                            text: What is in this photo?
                        createdAt: '2026-09-23T12:00:00.000Z'
                        errorCode: null
                        errorMessage: null
                        attachments:
                          - id: aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa
                            source: DIRECT_UPLOAD
                            filename: photo.jpg
                            mimeType: image/jpeg
                            url: https://cdn.example.com/photo.jpg
                            status: COMPLETE
                            origin: UPLOAD
                    nextCursor: null
        '404':
          description: Chat was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    chatId:
      name: chatId
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    MessageList:
      type: object
      required:
        - items
        - nextCursor
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Message'
        nextCursor:
          type: string
          nullable: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
          examples:
            - UNAUTHORIZED
            - CHAT_NOT_FOUND
            - RUN_ACTIVE
    Message:
      type: object
      required:
        - id
        - chatId
        - role
        - status
        - contentBlocks
        - createdAt
        - attachments
      properties:
        id:
          type: string
          format: uuid
        chatId:
          type: string
          format: uuid
        role:
          type: string
        status:
          type: string
        contentBlocks:
          type: array
          items: {}
        createdAt:
          type: string
          format: date-time
        errorCode:
          type: string
          nullable: true
        errorMessage:
          type: string
          nullable: true
        usage:
          type: object
          properties:
            promptTokens:
              type: integer
            completionTokens:
              type: integer
            credits:
              type: string
            model:
              type: string
              nullable: true
            durationMs:
              type: integer
              nullable: true
        attachments:
          type: array
          description: >-
            Files on this message. User uploads and generated images include
            `id`.
          items:
            $ref: '#/components/schemas/MessageAttachment'
    MessageAttachment:
      type: object
      required:
        - id
        - filename
        - mimeType
        - status
      properties:
        id:
          type: string
          format: uuid
        source:
          type: string
          description: DIRECT_UPLOAD, MEDIA_LIBRARY, or GENERATED
        filename:
          type: string
        mimeType:
          type: string
        byteSize:
          type: integer
        url:
          type: string
          nullable: true
        thumbnailUrl:
          type: string
          nullable: true
        status:
          type: string
        origin:
          type: string
        width:
          type: integer
          nullable: true
        height:
          type: integer
          nullable: true
        durationMs:
          type: integer
          nullable: true
        expiresAt:
          type: string
          format: date-time
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key created in the product. Shown once, prefix `gxk_live_`.

````

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