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

# List Messages

> Retrieve message history with optional filters



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/realtime.yaml get /api/realtime/messages
openapi: 3.0.3
info:
  title: Insforge Realtime API
  version: 1.0.0
  description: >-
    Realtime channel management, message history, permissions, and retention
    API. Live pub/sub uses Socket.IO.
servers: []
security: []
tags:
  - name: Channels
    description: Configure realtime channel patterns, webhooks, and availability.
  - name: Messages
    description: Inspect realtime message history and delivery stats.
  - name: Permissions
    description: Manage helper endpoints for realtime RLS examples.
  - name: Configuration
    description: Manage realtime retention settings.
paths:
  /api/realtime/messages:
    get:
      tags:
        - Messages
      summary: List Messages
      description: Retrieve message history with optional filters
      parameters:
        - name: channelId
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: Filter messages by channel ID
          example: 550e8400-e29b-41d4-a716-446655440000
        - name: eventName
          in: query
          required: false
          schema:
            type: string
          description: Filter messages by event name
          example: order.created
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
          description: Maximum number of messages to return
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Number of messages to skip
      responses:
        '200':
          description: List of messages
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Message'
              example:
                - id: 660e8400-e29b-41d4-a716-446655440000
                  eventName: order.created
                  channelId: 550e8400-e29b-41d4-a716-446655440000
                  channelName: order:123
                  payload:
                    orderId: '123'
                    status: pending
                  senderType: user
                  senderId: 770e8400-e29b-41d4-a716-446655440000
                  wsAudienceCount: 5
                  whAudienceCount: 1
                  whDeliveredCount: 1
                  createdAt: '2024-01-15T10:30:00Z'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_INPUT
                message: 'channelId: Invalid uuid'
                statusCode: 400
      security:
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    Message:
      type: object
      required:
        - id
        - eventName
        - channelName
        - payload
        - senderType
        - wsAudienceCount
        - whAudienceCount
        - whDeliveredCount
        - createdAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the message
          example: 660e8400-e29b-41d4-a716-446655440000
        eventName:
          type: string
          minLength: 1
          description: Name of the event
          example: order.created
        channelId:
          type: string
          format: uuid
          nullable: true
          description: ID of the channel this message belongs to
          example: 550e8400-e29b-41d4-a716-446655440000
        channelName:
          type: string
          minLength: 1
          description: Resolved channel name (instance of the pattern)
          example: order:123
        payload:
          type: object
          additionalProperties: true
          description: Message payload data
          example:
            orderId: '123'
            status: pending
        senderType:
          type: string
          enum:
            - system
            - user
          description: Type of sender that published the message
          example: user
        senderId:
          type: string
          format: uuid
          nullable: true
          description: ID of the user who sent the message (null for system messages)
          example: 770e8400-e29b-41d4-a716-446655440000
        wsAudienceCount:
          type: integer
          minimum: 0
          description: Number of WebSocket clients who received the message
          example: 5
        whAudienceCount:
          type: integer
          minimum: 0
          description: Number of webhooks that should receive the message
          example: 1
        whDeliveredCount:
          type: integer
          minimum: 0
          description: Number of webhooks that successfully received the message
          example: 1
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the message was created
          example: '2024-01-15T10:30:00Z'
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: INVALID_INPUT
        message:
          type: string
          description: Human-readable error message
          example: Invalid request
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check your request parameters
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````