CometChat Conversations API

List conversations and manage read/delivered state

OpenAPI Specification

cometchat-conversations-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: CometChat REST Management Auth Tokens Conversations API
  description: Server-side REST Management API (v3) for CometChat in-app messaging. Manages users, authentication tokens, groups, group members, messages, conversations, reactions, roles, friends, blocked and banned users, and webhooks for a CometChat app. The API is scoped to a single app and region; the host is derived from your App ID and the region your app is provisioned in (us, eu, in). All requests authenticate with a Rest API Key (fullAccess scope) passed in the `apikey` header. Realtime delivery to end users is handled separately by the CometChat client SDKs over a managed WebSocket layer and is not part of this REST surface.
  termsOfService: https://www.cometchat.com/terms-and-conditions
  contact:
    name: CometChat Support
    url: https://www.cometchat.com/contact-sales
  version: '3.0'
servers:
- url: https://{appId}.api-{region}.cometchat.io/v3
  description: Per-app, per-region CometChat REST Management API host
  variables:
    appId:
      default: APP_ID
      description: Your CometChat App ID from the dashboard
    region:
      default: us
      enum:
      - us
      - eu
      - in
      description: The region your CometChat app is provisioned in
security:
- apiKeyAuth: []
tags:
- name: Conversations
  description: List conversations and manage read/delivered state
paths:
  /conversations:
    get:
      operationId: listConversations
      tags:
      - Conversations
      summary: List conversations
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/PerPage'
      - name: conversationType
        in: query
        schema:
          type: string
          enum:
          - user
          - group
      responses:
        '200':
          description: A list of conversations.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationList'
  /conversations/{conversationId}:
    parameters:
    - name: conversationId
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getConversation
      tags:
      - Conversations
      summary: Get a conversation
      parameters:
      - name: conversationType
        in: query
        required: true
        schema:
          type: string
          enum:
          - user
          - group
      responses:
        '200':
          description: The requested conversation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationResponse'
components:
  schemas:
    ConversationList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Conversation'
        meta:
          type: object
          properties:
            pagination:
              $ref: '#/components/schemas/Pagination'
    ConversationResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Conversation'
    Conversation:
      type: object
      properties:
        conversationId:
          type: string
        conversationType:
          type: string
          enum:
          - user
          - group
        lastMessage:
          $ref: '#/components/schemas/Message'
        unreadMessageCount:
          type: integer
        updatedAt:
          type: integer
          format: int64
    Pagination:
      type: object
      properties:
        total:
          type: integer
        count:
          type: integer
        per_page:
          type: integer
        current_page:
          type: integer
        total_pages:
          type: integer
    Message:
      type: object
      properties:
        id:
          type: integer
          format: int64
        conversationId:
          type: string
        sender:
          type: string
        receiver:
          type: string
        receiverType:
          type: string
          enum:
          - user
          - group
        category:
          type: string
          enum:
          - message
          - action
          - call
          - custom
        type:
          type: string
        data:
          type: object
        sentAt:
          type: integer
          format: int64
        updatedAt:
          type: integer
          format: int64
        deletedAt:
          type: integer
          format: int64
  parameters:
    Page:
      name: page
      in: query
      schema:
        type: integer
        default: 1
    PerPage:
      name: perPage
      in: query
      schema:
        type: integer
        default: 25
        maximum: 100
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: Rest API Key with fullAccess scope from the CometChat dashboard. The App ID and region are encoded in the host, not in a header.