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

> Sends Threaded Message on behalf of a user.

# Send Threaded Message

For the complete error reference, see [Error Guide](/articles/error-guide).


## OpenAPI

````yaml post /messages/{id}/thread
openapi: 3.0.0
info:
  title: Chat APIs
  description: Manage messages, users, groups for a particular app using our Chat API.
  version: '3.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: API Keys
    description: The API keys are used to authorise the APIs
  - name: Roles
    description: The roles are used to give user access rights
  - name: Users
    description: The REST collection for users.
  - name: Auth Tokens
    description: The auth tokens are used to login end users using client SDKs.
  - name: Blocked Users
    description: The REST collections for blocked users.
  - name: Friends
    description: List,add and remove friends by passing UID in path variables
  - name: Groups
    description: The REST collections for groups.
  - name: Banned Users
    description: Ban and Unban user by passing other UID in path variables.
  - name: Group Members
    description: The REST collections for group members.
  - name: Messages
    description: The REST collections for messages.
  - name: Conversations
    description: The REST collections for conversations.
  - name: Restrict Features
    description: Allows Restricting Features
  - name: Metrics
    description: Allows accessing Data Metrics
  - name: Triggers
    description: Allows adding triggers to a webhook.
  - name: Webhooks
    description: Allows accessing Webhooks.
  - name: Notifications
    description: Allows configuring Notifications core.
paths:
  /messages/{id}/thread:
    post:
      tags:
        - Messages
      summary: Send Threaded Message
      description: Sends Threaded Message on behalf of a user.
      operationId: send-thread-message
      parameters:
        - $ref: '#/components/parameters/requiredonBehalfOf'
        - name: id
          in: path
          description: Id of the message for which thread message to be sent
          required: true
          schema:
            type: string
          examples:
            string:
              summary: Message ID
              value: '100'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                receiver:
                  description: The receiver of the message.
                  type: string
                receiverType:
                  description: The receiverType of the message. either user or group
                  type: string
                  enum:
                    - user
                    - group
                category:
                  description: >-
                    Category of the message. The available categories are
                    message and custom.
                  type: string
                  default: message
                  enum:
                    - message
                    - custom
                type:
                  description: >-
                    Type of the message. The available values are text, image,
                    file, audio, video.
                  type: string
                  default: text
                  enum:
                    - text
                    - image
                    - file
                    - audio
                    - video
                data:
                  description: JSON containing message attributes.
                  type: object
                  default:
                    text: Hi Tom!
                    metadata:
                      key1: value1
                      key2: value2
                multipleReceivers:
                  description: >-
                    JSON containing array of UIDs and GUID for whom the message
                    must be sent. Format for multiple receivers - {"uids":
                    ["uid1","uid2"], "guids":["guid1"]}
                  type: object
                  default:
                    uids:
                      - uid1
                      - uid2
                    guids:
                      - guid1
                tags:
                  description: A list of tags to identify specific messages.
                  type: array
                  items:
                    type: string
                  default:
                    - tag1
              type: object
      responses:
        '200':
          description: Create Message
          content:
            application/json:
              schema:
                properties:
                  data:
                    type: object
                    allOf:
                      - properties:
                          parentId:
                            readOnly: false
                        type: object
                      - $ref: '#/components/schemas/messageSchema'
                type: object
              example:
                data:
                  id: '2'
                  conversationId: cometchat-uid-3_user_cometchat-uid-5
                  sender: cometchat-uid-3
                  receiverType: user
                  receiver: cometchat-uid-5
                  category: message
                  type: text
                  data:
                    text: test     hello
                    metadata:
                      key1: val1
                    entities:
                      sender:
                        entity:
                          uid: cometchat-uid-3
                          name: Nancy Grace
                          avatar: >-
                            https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp
                          status: offline
                          role: default
                          createdAt: 1638361550
                        entityType: user
                      receiver:
                        entity:
                          uid: cometchat-uid-5
                          name: John Paul
                          avatar: >-
                            https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp
                          status: offline
                          role: default
                          createdAt: 1638361550
                          conversationId: cometchat-uid-3_user_cometchat-uid-5
                        entityType: user
                  sentAt: 1638423490
                  updatedAt: 1638423490
                  parentId: '1'
      security:
        - apiKey: []
components:
  parameters:
    requiredonBehalfOf:
      name: onBehalfOf
      in: header
      description: UID of the user on whose behalf the action is performed.
      required: true
      schema:
        type: string
  schemas:
    messageSchema:
      description: Response data
      properties:
        id:
          type: string
        conversationId:
          type: string
        sender:
          type: string
        receiverType:
          type: string
        receiver:
          type: string
        category:
          type: string
        type:
          type: string
        data:
          properties:
            text:
              type: string
            metadata:
              type: object
            entities:
              properties:
                sender:
                  properties:
                    entity:
                      properties:
                        uid:
                          type: string
                        name:
                          type: string
                        role:
                          type: string
                        avatar:
                          type: string
                        status:
                          type: string
                        createdAt:
                          type: integer
                        conversationId:
                          type: string
                      type: object
                    entityType:
                      type: string
                  type: object
                receiver:
                  properties:
                    entity:
                      properties:
                        uid:
                          type: string
                        name:
                          type: string
                        role:
                          type: string
                        avatar:
                          type: string
                        status:
                          type: string
                        createdAt:
                          type: integer
                        conversationId:
                          type: string
                      type: object
                    entityType:
                      type: string
                  type: object
              type: object
          type: object
        sentAt:
          type: integer
        updatedAt:
          type: integer
      type: object
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````