openapi: 3.0.0
info:
  title: Threads
  description: |
    Threads are a new way to organize discussions in a channel by grouping messages by specific topics. With threads, replies to channel messages can be organized in separate spaces. <br><br> You can use the Threads API to create threads, send messages, get and manage thread followers, manage the thread's state (reopening or closing it), and retrieve threads from a specific channel, among other functionalities.
  contact: {}
  version: 1.0.0
externalDocs:
  description: Find out more about Zoho Cliq APIs V2
  url: https://www.zoho.com/cliq/help/restapi/v2/
servers:
  - url: https://cliq.zoho.com/api/v2
    description: Zoho Cliq US DC
tags:
  - name: threads
    description: Threads Module
paths:
  /channels/{CHANNEL_ID}/message:
    post:
      summary: Create and send a thread message
      operationId: Create and send a thread message
      description: |
        Use this API to create a thread from a message sent in a channel. <br><br> 
          <p>
            <b>Threshold limit</b>: 20 requests per min per user<br>
            Number of API calls allowed within a minute.<br><br>
            <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
          </p>
      parameters:
        - name: CHANNEL_ID
          in: path
          required: true
          schema:
            type: string
          example: CHANNEL_ID
          description: Unique identifier of a channel in which a thread needs to be created To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_ID">CHANNEL_ID</a> in the Glossary page.
        - name: bot_unique_name
          in: query
          required: false
          schema:
            type: string
          description: |
            Use this parameter to send a message in a channel as a bot.   <b>Note</b>: The bot should already be a participant in the channel.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/thread-creation-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thread-creation-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - threads
  /chats/{THREAD_CHAT_ID}/message:
    post:
      summary: Send a message to an existing thread
      operationId: Send a message to an existing thread
      description: |
        Use this API to send a message to an existing thread.
          <br><br>  
          <p>
            <b>Threshold limit</b>: 20 requests per min per user<br>
            Number of API calls allowed within a minute.<br><br>
            <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
          </p>  
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: Chat ID of the thread where the message should be sent To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
        - name: bot_unique_name
          in: query
          required: false
          schema:
            type: string
          description: |
            Use this parameter to send a message in a thread as a bot.   Note that the bot should already be a participant in the channel.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/send-message-in-thread-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thread-creation-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Webhooks.CREATE
      tags:
        - threads
  /channels/{CHANNEL_ID}/threads:
    get:
      summary: Get threads of a channel
      operationId: Get threads of a channel
      description: |
        Use this API to retrieve all the threads in a chat.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
        </p>  
      parameters:
        - name: CHANNEL_ID
          in: path
          required: true
          schema:
            type: string
          example: CHANNEL_ID
          description: Channel ID from which the threads need to be retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_ID">CHANNEL_ID</a> in the Glossary page.
        - name: state
          in: query
          required: false
          schema:
            type: string
          description: |
            Determines the follow status of the threads to be retrieved. Allowed values: <ul>
              <li><b>followed</b> - Returns only the threads the user is following.</li>
              <li><b>not_followed</b> - Returns only the threads the user is not following.</li> 
              <li><b>all</b> - Returns all threads, regardless of follow status.</li>
            </ul> If the state parameter is not specified, the default value will be all.
        - name: type
          in: query
          required: false
          schema:
            type: string
          description: |
            Filters threads based on their current status. Allowed values: <ul>
              <li><b>open</b> - Returns threads that are currently active or ongoing.</li>
              <li><b>closed</b> - Returns threads that have been marked as closed or resolved.</li>
            </ul> If a type parameter is not specified, all threads in the parent chat will be returned.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/get-threads-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-threads-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.READ
      tags:
        - threads
  /channels/{CHANNEL_ID}:
    put:
      summary: Auto follow
      operationId: Auto follow a thread
      description: |
        Use this API to auto-follow all threads created in a channel.
        <br><br>
          <p>
            <b>Threshold limit</b>: 20 requests per min per user<br>
            Number of API calls allowed within a minute.<br><br>
            <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
          </p>
      parameters:
        - name: CHANNEL_ID
          in: path
          required: true
          schema:
            type: string
          example: CHANNEL_ID
          description: The ID of the channel from which threads should be automatically followed To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#CHANNEL_ID">CHANNEL_ID</a> in the Glossary page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/auto-follow-threads-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/auto-follow-threads-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Channels.UPDATE
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}/followers:
    get:
      summary: Get thread followers
      operationId: Get thread followers
      description: |
        Use this API to get the followers of the thread.
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: Chat ID of the thread for which the list of followers needs to be retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-thread-followers-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.READ
      tags:
        - threads
    post:
      summary: Add followers to a thread
      operationId: Add followers to a thread
      description: |
        Use this API to add one or more users as followers to an existing thread.
        <br><br>  
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>  
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: Chat ID of the thread for which the list of followers needs to be added To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/add-followers-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.UPDATE
      tags:
        - threads
    delete:
      summary: Remove followers from a thread
      operationId: Remove followers from a thread
      description: |
        Removes one or more specified users from the followers list of a given thread.
        <br><br>
         <p>
           <b>Threshold limit</b>: 20 requests per min per user<br>
           Number of API calls allowed within a minute.<br><br>
           <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
         </p>
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: Chat ID of the thread for which the list of followers needs to be removed To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/remove-followers-payload'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.DELETE
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}/nonfollowers:
    get:
      summary: Get non-followers of a thread
      operationId: Get non-followers of a thread
      description: |
        Use this API to retrieve the list of channel members who are not currently following the specified thread.
        <br><br>
          <p>
            <b>Threshold limit</b>: 20 requests per min per user<br>
            Number of API calls allowed within a minute.<br><br>
            <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
          </p>
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: Chat ID of the thread for which the list of non-followers needs to be retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-thread-followers-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.READ
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}/follow:
    post:
      summary: Join (follow) a thread
      operationId: Join-follow a thread
      description: |
        Allows the authenticated user to join a thread as a follower
        <br>><br>
         <p>
           <b>Threshold limit</b>: 20 requests per min per user<br>
           Number of API calls allowed within a minute.<br><br>
           <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
         </p>   
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: CHAT ID of the thread to which the authenticated user should be added as a follower To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.UPDATE
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}/unfollow:
    post:
      summary: Leave (unfollow) a thread
      operationId: Leave-unfollow a thread
      description: |
        Allows the authenticated user to leave a thread they are currently following.
        <br>><br>
         <p>
           <b>Threshold limit</b>: 20 requests per min per user<br>
           Number of API calls allowed within a minute.<br><br>
           <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
         </p>
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: CHAT ID of the thread to which the authenticated user should be removed as a follower To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.UPDATE
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}:
    put:
      summary: Update the state of a thread
      operationId: Update the state of a thread
      description: |
        Use this API to close or reopen a thread. This can be performed by a user or by a bot.
        <br><br>  
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>
          Number of API calls allowed within a minute.<br><br>
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>
        </p>  
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: CHAT ID of the thread whose state is to be updated (closed or reopened) To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
        - name: bot_unique_name
          in: query
          required: false
          schema:
            type: string
          description: To use when the action is to be performed by a bot that is already a participant in the channel.
        - name: appkey
          in: query
          required: false
          schema:
            type: string
          description: Must be provided if the specified bot is from an extension. This parameter is to be used along with bot_unique_name.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update-state-of-thread-request'
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post-message-in-a-channel-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Chats.UPDATE
      tags:
        - threads
  /threads/{THREAD_CHAT_ID}/messages/main:
    get:
      summary: Get main message of a thread
      operationId: Get main message of a thread
      description: |
        Use this API to retrieve the main message from which the thread was created.
        <br><br>
        <p>
          <b>Threshold limit</b>: 20 requests per min per user<br>  
          Number of API calls allowed within a minute.<br><br>    
          <b>Lock period</b>: 10 minutes<br>Wait time before consecutive API requests.<br>  
        </p>  
      parameters:
        - name: THREAD_CHAT_ID
          in: path
          required: true
          schema:
            type: string
          example: THREAD_CHAT_ID
          description: The CHAT_ID of the thread whose main (original) message is to be retrieved To learn how to retrieve this ID, see <a href="/cliq/help/restapi/v2/glossary/#THREAD_CHAT_ID">THREAD_CHAT_ID</a> in the Glossary page.
      responses:
        '200':
          description: The request was successfully completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-main-message-response'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request cannot be performed. Usually because of malformed parameter or missing parameter.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Request was rejected because of invalid AuthToken.
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The user does not have enough permission or possibly not an user of the respective organization to access the resource.
        '404':
          description: Invalid URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The URL you've sent is wrong. It's possible that the resource you've requested has been moved to another URL.
        '405':
          description: Method Not Allowed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
        '406':
          description: Not Acceptable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The response has been received but the requested response type is not supported by the browser.
        '429':
          description: Too many requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Too many requests within a certain time frame.
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Cliq server encountered an error which prevents it from fulfilling the request.
      security:
        - Cliq_Auth:
            - ZohoCliq.Messages.READ
      tags:
        - threads
components:
  schemas:
    post-message-in-a-channel-response:
      type: object
      description: Response returned when a message is posted in a channel. A '204 No response' indicates successful posting without returning any content.
      properties:
        Response Code:
          type: string
          description: HTTP response code when message is posted.
          example: 204 No response
    get-thread-followers-response:
      type: object
      description: Response containing the list of followers for a particular thread.
      properties:
        data:
          type: array
          description: List of users following the thread.
          items:
            type: object
            properties:
              user_id:
                type: string
                description: Unique identifier of the user.
                example: '15066855'
              email_id:
                type: string
                format: email
                description: Email ID of the user.
                example: scott.fisher@zylker.com
              name:
                type: string
                description: Name of the user.
                example: Scott
          example:
            - user_id: '15066855'
              email_id: scott.fisher@zylker.com
              name: Scott
            - user_id: '15071629'
              email_id: mark.twine@zylker.com
              name: Mark
    thread-creation-payload:
      type: object
      description: Request body to create a new thread from an existing message.
      required:
        - text
        - thread_message_id
      properties:
        text:
          type: string
          description: 'Text to post as the initial message in the thread. Maximum length: 5000 characters.'
          example: Follow this thread for daily updates on ticket resolutions.
        thread_message_id:
          type: string
          description: ID of the parent message from which the thread should be created.
          example: '1599044334698_117280617320'
        reply_to:
          type: string
          description: Optional. ID of a message to reply to within the thread.
        post_in_parent:
          type: boolean
          description: Optional. If true, posts the thread message in the parent chat as well.
          example: true
        thread_title:
          type: string
          description: Optional. Title for the thread.
          example: Ticket Resolution Summary for the Day
        sync_message:
          type: boolean
          description: Optional. If true, posts the message synchronously and returns the message ID.
          example: true
    send-message-in-thread-payload:
      type: object
      description: Request body to send a message in an existing thread.
      required:
        - text
      properties:
        text:
          type: string
          description: 'Text to post in the thread. Maximum length: 5000 characters.'
          example: Let's automate these cases so we can address them during testing.
        reply_to:
          type: string
          description: Optional. Message ID to reply to within the thread.
        post_in_parent:
          type: boolean
          description: Optional. If true, posts the message in the parent chat as well.
          example: true
        sync_message:
          type: boolean
          description: Optional. If true, posts the message synchronously and returns the message ID.
          example: true
    thread-creation-response:
      type: object
      description: Response returned after creating a thread.
      properties:
        message_id:
          type: string
          description: ID of the created thread message.
          example: '1275417686584_20804595296'
    get-threads-payload:
      type: object
      description: Request parameters to retrieve threads from a channel.
      properties:
        next_token:
          type: string
          description: Used for pagination. Pass the next_token received in the previous API response to get the next page.
          example: MTV8MTYxNjEzNTI3ODYzNnwxNzc1OTk4MDAxMTcwMDczMzAx
        limit:
          type: string
          description: Maximum number of threads to return in the response.
          example: '50'
    auto-follow-threads-payload:
      type: object
      description: Request body to enable or disable auto-follow for threads in a channel.
      properties:
        auto_follow_threads:
          type: string
          description: 'Set auto-follow behavior. Allowed values: enable - automatically follow all threads; disable - stop auto-following threads.'
          example: enable
    add-followers-payload:
      type: object
      description: Request body to add followers to a thread.
      required:
        - user_ids
      properties:
        user_ids:
          type: array
          description: List of user IDs to add as followers to the thread.
          items:
            type: string
            description: Unique identifier of a user to be added as a follower.
          example:
            - '15067889'
            - '35068981'
            - '5120923'
    remove-followers-payload:
      type: object
      description: Request body to remove followers from a thread.
      required:
        - user_ids
      properties:
        user_ids:
          type: array
          description: List of user IDs to remove from followers of the thread.
          items:
            type: string
            description: Unique identifier of a user to be removed from the thread.
          example:
            - '15067889'
            - '35068981'
            - '5120923'
    update-state-of-thread-request:
      type: object
      description: Request body to update the state of a thread (open or closed).
      required:
        - action
      properties:
        action:
          type: string
          description: 'State action to apply to the thread. Allowed values: close - close the thread; reopen - reopen a closed thread.'
          example: close
    auto-follow-threads-response:
      type: object
      description: Response returned after updating auto-follow settings for threads.
      properties:
        status:
          type: string
          description: Current auto-follow status of the channel.
          example: enabled
    get-threads-response:
      type: object
      description: Response containing the list of threads in a channel.
      properties:
        url:
          type: string
          description: API endpoint for fetching threads.
          example: /api/v2/threads
        next_token:
          type: string
          description: Token for pagination to retrieve next set of threads.
          example: MTV8MTYxNjEzNTI3ODYzNnwxNzc1OTk4MDAxMTcwMDczMzAx
        type:
          type: string
          description: Type of response.
          example: chat_thread
        sync_token:
          type: string
          description: Token for synchronizing thread data.
          example: MTV8MTYyODgzNTQ3OTkyOHwxNzc1OTk4MDAxMTg2NzU5NDUx
        data:
          type: array
          description: List of threads.
          items:
            type: object
            properties:
              parent_chat_id:
                type: string
                description: ID of the parent chat.
                example: CT_9001245010012354810_3467821
              is_follower:
                type: boolean
                description: Indicates if the current user is following this thread.
                example: true
              follower_count:
                type: integer
                description: Number of followers of the thread.
                example: 5
              chat_id:
                type: string
                description: ID of the thread chat.
                example: CT_9001245010012354810_3467821-T-9001245010938461210
              last_message_information:
                type: object
                description: Details of the last message in the thread.
                properties:
                  sender_id:
                    type: string
                    example: '45321098'
                  message_type:
                    type: string
                    example: text
                  time:
                    type: string
                    format: date-time
                    example: '2024-12-12T10:45:00+05:30'
                  text:
                    type: string
                    example: Final report has been uploaded to the portal.
                  sender_name:
                    type: string
                    example: Olivia Palmer
              title:
                type: string
                description: Thread title.
                example: Final Report Submission
              thread_message_id:
                type: string
                description: Unique message ID for the thread.
                example: 1702119024356%2097654301123490
              parent_message_sender:
                type: string
                description: User ID of the parent message sender.
                example: '673892104'
              thread_state:
                type: string
                enum:
                  - open
                  - closed
                description: State of the thread.
                example: open
    get-main-message-response:
      type: object
      description: Response containing the details of a main message and its thread information.
      properties:
        is_read:
          type: boolean
          description: Indicates whether the main message has been read.
          example: false
        thread_state_info:
          type: object
          description: State information of the thread.
          properties:
            thread_state:
              type: string
              example: open
        parent_resource_id:
          type: string
          description: Resource ID of the parent entity.
          example: Customer support
        sender:
          type: object
          description: Information about the sender of the message.
          properties:
            name:
              type: string
              example: Zylker
            id:
              type: string
              example: '15067889'
        ack_key:
          type: string
          description: Acknowledgment key for the message.
          example: '1629426730133'
        thread_message:
          type: object
          description: Details of the thread message.
          properties:
            msg:
              type: string
              example: Team, any update on this issue?
            lmsgtime:
              type: string
              example: '1629465324688'
            msgid:
              type: string
              example: '1629465328058'
            msguid:
              type: string
              example: 1629465328414%2083277101498
            is_read:
              type: boolean
              example: false
            ctype:
              type: integer
              example: 11
            sender:
              type: string
              example: '15066855'
            threadmsg:
              type: boolean
              example: true
            meta:
              type: object
              properties:
                revision:
                  type: integer
                  example: 1
            sequence_id:
              type: integer
              example: 19
            id:
              type: string
              example: '1629465328414_83277101498'
            time:
              type: string
              example: '1629465328414'
            dname:
              type: string
              example: Zylker
        thread_information:
          type: object
          description: Additional thread information.
          properties:
            is_follower:
              type: boolean
              example: true
            message_count:
              type: integer
              example: 19
            follower_count:
              type: integer
              example: 2
            thread_message_id:
              type: string
              example: 1629426730589%2040288830613
            title:
              type: string
              example: Client slowness
            chat_id:
              type: string
              example: CT_1256254372211218512_15067887-T-1256254377053952763
        id:
          type: string
          example: '1629426730589_40288830613'
        time:
          type: integer
          example: 1629426730589
        type:
          type: string
          example: text
        content:
          type: object
          properties:
            text:
              type: string
              example: Customer has reported performance issues with the web client experiencing lag.
        revision:
          type: integer
          example: 2
  securitySchemes:
    Cliq_Auth:
      type: oauth2
      x-authorization-example: Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f
      flows:
        implicit:
          authorizationUrl: https://accounts.zoho.com/oauth/v2/auth
          scopes:
            ZohoCliq.Webhooks.CREATE: Post messages to your conversations directly or by using incoming webhooks
            ZohoCliq.Chats.UPDATE: Modify Chats
            ZohoCliq.Chats.DELETE: Delete Chats
            ZohoCliq.Messages.READ: Read messages
