CometChat Roles API

Custom roles and permissions

OpenAPI Specification

cometchat-roles-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: CometChat REST Management Auth Tokens Roles 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: Roles
  description: Custom roles and permissions
paths:
  /roles:
    get:
      operationId: listRoles
      tags:
      - Roles
      summary: List roles
      responses:
        '200':
          description: A list of roles.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleList'
    post:
      operationId: createRole
      tags:
      - Roles
      summary: Create a role
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRoleRequest'
      responses:
        '200':
          description: The created role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleResponse'
  /roles/{role}:
    parameters:
    - name: role
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getRole
      tags:
      - Roles
      summary: Get a role
      responses:
        '200':
          description: The requested role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleResponse'
    put:
      operationId: updateRole
      tags:
      - Roles
      summary: Update a role
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRoleRequest'
      responses:
        '200':
          description: The updated role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleResponse'
    delete:
      operationId: deleteRole
      tags:
      - Roles
      summary: Delete a role
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
components:
  schemas:
    RoleList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Role'
    Role:
      type: object
      properties:
        role:
          type: string
        name:
          type: string
        description:
          type: string
        permissions:
          type: array
          items:
            type: string
    Acknowledgement:
      type: object
      properties:
        data:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
    CreateRoleRequest:
      type: object
      required:
      - role
      - name
      properties:
        role:
          type: string
        name:
          type: string
        description:
          type: string
        permissions:
          type: array
          items:
            type: string
    RoleResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Role'
  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.