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

# Subscribe to realtime group events

> Opens an event stream for realtime group updates and heartbeats for a group member.



## OpenAPI

````yaml https://api.superwize.ai/api/openapi.json post /groupChat/subscribeToGroup
openapi: 3.1.1
info:
  title: SuperWize API
  version: 1.1.2
  description: >-
    SuperWize RPC API. Authenticated endpoints support Better Auth session
    cookies, Authorization: Bearer <session_token>, or x-api-key.
servers:
  - url: http://api.superwize.ai/api
security: []
tags:
  - name: System
    description: Service health and internal diagnostics.
  - name: Authentication
    description: Session, email verification, and API token endpoints.
  - name: Audio
    description: Speech-to-text and related audio features.
  - name: Chat
    description: Conversation streaming, history, branching, and feedback.
  - name: Credits
    description: Credit balances, usage history, and reward grants.
  - name: Subscription
    description: Subscription tier and status polling endpoints.
  - name: Mini Apps
    description: Curated mini app catalog endpoints.
  - name: News
    description: Curated news feed, article source, and article feedback endpoints.
  - name: Release Notes
    description: Current app release metadata and features.
  - name: Support
    description: Contact/support request endpoints.
  - name: Images
    description: Image conversion, upload, and retrieval endpoints.
  - name: Files
    description: Generic file upload and retrieval endpoints.
  - name: Notifications
    description: Push token registration and test notifications.
  - name: Group Chat
    description: Group lifecycle, invites, messaging, and realtime events.
  - name: Preferences
    description: User preferences and account-type controls.
  - name: Widgets
    description: Widget thread and interaction endpoints.
  - name: Bookmarks
    description: Bookmark groups and conversation associations.
paths:
  /groupChat/subscribeToGroup:
    post:
      tags:
        - Group Chat
      summary: Subscribe to realtime group events
      description: >-
        Opens an event stream for realtime group updates and heartbeats for a
        group member.
      operationId: groupChat.subscribeToGroup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                groupChatId:
                  type: string
              required:
                - groupChatId
            example:
              groupChatId: grp_01JHKYX1B2CD123456789
      responses:
        '200':
          description: Realtime stream opened.
          content:
            text/event-stream:
              schema:
                oneOf:
                  - type: object
                    properties:
                      event:
                        const: message
                      data:
                        anyOf:
                          - type: object
                            properties:
                              type:
                                const: message.created
                              message:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  type:
                                    type: string
                                  role:
                                    type: string
                                  content:
                                    type: string
                                  parts:
                                    type: array
                                    items:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              const: web_search_tool_call
                                            content:
                                              type: object
                                              properties:
                                                query:
                                                  type: string
                                                num_results:
                                                  type: number
                                                country:
                                                  type: string
                                                safe_search:
                                                  type: boolean
                                              required:
                                                - query
                                                - num_results
                                                - country
                                                - safe_search
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: web_search_tool_output
                                            content:
                                              type: array
                                              items:
                                                type: object
                                                properties:
                                                  link:
                                                    type: string
                                                  title:
                                                    type: string
                                                  snippet:
                                                    type: string
                                                required:
                                                  - link
                                                  - title
                                                  - snippet
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: image_generation_tool_call
                                            content:
                                              type: object
                                              properties:
                                                prompt:
                                                  type: string
                                                style:
                                                  type: string
                                                size:
                                                  type: string
                                                'n':
                                                  type: number
                                              required:
                                                - prompt
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: image_generation_tool_output
                                            content:
                                              type: object
                                              properties:
                                                images:
                                                  type: array
                                                  items:
                                                    type: object
                                                    properties:
                                                      type:
                                                        enum:
                                                          - base64
                                                          - url
                                                      data:
                                                        type: string
                                                      revisedPrompt:
                                                        type: string
                                                    required:
                                                      - type
                                                      - data
                                                model:
                                                  type: string
                                              required:
                                                - images
                                          required:
                                            - type
                                            - content
                                  sender:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                      name:
                                        type: string
                                      image:
                                        anyOf:
                                          - type: string
                                          - type: 'null'
                                    required:
                                      - id
                                      - name
                                      - image
                                  createdAt:
                                    type: string
                                    format: date-time
                                    x-native-type: date
                                required:
                                  - id
                                  - type
                                  - content
                            required:
                              - type
                              - message
                          - type: object
                            properties:
                              type:
                                const: member.joined
                              member:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  userId:
                                    type: string
                                  name:
                                    type: string
                                  image:
                                    anyOf:
                                      - type: string
                                      - type: 'null'
                                  joinedAt:
                                    type: string
                                    format: date-time
                                    x-native-type: date
                                required:
                                  - id
                                  - userId
                                  - name
                                  - image
                                  - joinedAt
                            required:
                              - type
                              - member
                          - type: object
                            properties:
                              type:
                                const: member.left
                              userId:
                                type: string
                            required:
                              - type
                              - userId
                          - type: object
                            properties:
                              type:
                                const: ai.started
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                const: ai.decision.started
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                const: ai.decision.done
                              willRespond:
                                type: boolean
                            required:
                              - type
                              - willRespond
                          - type: object
                            properties:
                              type:
                                const: ai.delta
                              delta:
                                type: string
                            required:
                              - type
                              - delta
                          - type: object
                            properties:
                              type:
                                const: ai.done
                              message:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  type:
                                    type: string
                                  role:
                                    type: string
                                  content:
                                    type: string
                                  parts:
                                    type: array
                                    items:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              const: web_search_tool_call
                                            content:
                                              type: object
                                              properties:
                                                query:
                                                  type: string
                                                num_results:
                                                  type: number
                                                country:
                                                  type: string
                                                safe_search:
                                                  type: boolean
                                              required:
                                                - query
                                                - num_results
                                                - country
                                                - safe_search
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: web_search_tool_output
                                            content:
                                              type: array
                                              items:
                                                type: object
                                                properties:
                                                  link:
                                                    type: string
                                                  title:
                                                    type: string
                                                  snippet:
                                                    type: string
                                                required:
                                                  - link
                                                  - title
                                                  - snippet
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: image_generation_tool_call
                                            content:
                                              type: object
                                              properties:
                                                prompt:
                                                  type: string
                                                style:
                                                  type: string
                                                size:
                                                  type: string
                                                'n':
                                                  type: number
                                              required:
                                                - prompt
                                          required:
                                            - type
                                            - content
                                        - type: object
                                          properties:
                                            type:
                                              const: image_generation_tool_output
                                            content:
                                              type: object
                                              properties:
                                                images:
                                                  type: array
                                                  items:
                                                    type: object
                                                    properties:
                                                      type:
                                                        enum:
                                                          - base64
                                                          - url
                                                      data:
                                                        type: string
                                                      revisedPrompt:
                                                        type: string
                                                    required:
                                                      - type
                                                      - data
                                                model:
                                                  type: string
                                              required:
                                                - images
                                          required:
                                            - type
                                            - content
                                  sender:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                      name:
                                        type: string
                                      image:
                                        anyOf:
                                          - type: string
                                          - type: 'null'
                                    required:
                                      - id
                                      - name
                                      - image
                                  createdAt:
                                    type: string
                                    format: date-time
                                    x-native-type: date
                                required:
                                  - id
                                  - type
                                  - content
                            required:
                              - type
                              - message
                          - type: object
                            properties:
                              type:
                                const: web_search.in_progress
                              itemId:
                                type: string
                              query:
                                type: string
                              numResults:
                                type: number
                              country:
                                type: string
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                const: web_search.completed
                              results:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    link:
                                      type: string
                                    title:
                                      type: string
                                    snippet:
                                      type: string
                                  required:
                                    - link
                                    - title
                                    - snippet
                            required:
                              - type
                              - results
                          - type: object
                            properties:
                              type:
                                const: image_generation.in_progress
                              itemId:
                                type: string
                              prompt:
                                type: string
                              style:
                                type: string
                              size:
                                type: string
                              'n':
                                type: number
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                const: image_generation.completed
                              images:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    type:
                                      enum:
                                        - url
                                        - base64
                                    data:
                                      type: string
                                    revisedPrompt:
                                      type: string
                                  required:
                                    - type
                                    - data
                              model:
                                type: string
                            required:
                              - type
                              - images
                          - type: object
                            properties:
                              type:
                                const: heartbeat
                            required:
                              - type
                      id:
                        type: string
                      retry:
                        type: number
                    required:
                      - event
                      - data
                  - type: object
                    properties:
                      event:
                        const: done
                      data: {}
                      id:
                        type: string
                      retry:
                        type: number
                    required:
                      - event
                  - type: object
                    properties:
                      event:
                        const: error
                      data: {}
                      id:
                        type: string
                      retry:
                        type: number
                    required:
                      - event
              example:
                event: message
                data:
                  type: message.created
                  message:
                    id: obj_01JHKZ0PV2WX123456789
                    type: message
                    role: user
                    content: What are practical AI use-cases for students?
                    parts:
                      - type: web_search_tool_call
                        content:
                          query: null
                          num_results: null
                          country: null
                          safe_search: null
                    sender:
                      id: obj_01JHKZ0PV2WX123456789
                      name: Primary Key
                      image: https://cdn.superwize.ai/assets/avatars/user-1.png
                    createdAt: '2026-01-01T00:00:00.000Z'
                id: obj_01JHKZ0PV2WX123456789
                retry: 3000
        '401':
          description: '401'
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      defined:
                        const: true
                      code:
                        const: UNAUTHORIZED
                      status:
                        const: 401
                      message:
                        type: string
                        default: Authentication is required to access this endpoint.
                      data: {}
                    required:
                      - defined
                      - code
                      - status
                      - message
                  - type: object
                    properties:
                      defined:
                        const: false
                      code:
                        type: string
                      status:
                        type: number
                      message:
                        type: string
                      data: {}
                    required:
                      - defined
                      - code
                      - status
                      - message
        '403':
          description: '403'
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      defined:
                        const: true
                      code:
                        const: FORBIDDEN
                      status:
                        const: 403
                      message:
                        type: string
                        default: You do not have permission to perform this action.
                      data: {}
                    required:
                      - defined
                      - code
                      - status
                      - message
                  - type: object
                    properties:
                      defined:
                        const: false
                      code:
                        type: string
                      status:
                        type: number
                      message:
                        type: string
                      data: {}
                    required:
                      - defined
                      - code
                      - status
                      - message
              example:
                defined: true
                code: FORBIDDEN
                status: 403
                message: You do not have permission to perform this action.
                data: {}

````