CometChat Auth Tokens API

Per-user authentication tokens for SDK login

OpenAPI Specification

cometchat-auth-tokens-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: CometChat REST Management Auth Tokens 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: Auth Tokens
  description: Per-user authentication tokens for SDK login
paths:
  /users/{uid}/auth_tokens:
    parameters:
    - $ref: '#/components/parameters/Uid'
    get:
      operationId: listAuthTokens
      tags:
      - Auth Tokens
      summary: List auth tokens for a user
      responses:
        '200':
          description: A list of auth tokens.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthTokenList'
    post:
      operationId: createAuthToken
      tags:
      - Auth Tokens
      summary: Create an auth token for a user
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                force:
                  type: boolean
                  description: Create a new token even if one already exists.
      responses:
        '200':
          description: The created auth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthTokenResponse'
    delete:
      operationId: flushAuthTokens
      tags:
      - Auth Tokens
      summary: Flush all auth tokens for a user
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
  /users/{uid}/auth_tokens/{authToken}:
    parameters:
    - $ref: '#/components/parameters/Uid'
    - name: authToken
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: getAuthToken
      tags:
      - Auth Tokens
      summary: Get an auth token
      responses:
        '200':
          description: The requested auth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthTokenResponse'
    delete:
      operationId: deleteAuthToken
      tags:
      - Auth Tokens
      summary: Delete an auth token
      responses:
        '200':
          description: Acknowledgement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Acknowledgement'
components:
  parameters:
    Uid:
      name: uid
      in: path
      required: true
      schema:
        type: string
      description: Unique user identifier.
  schemas:
    AuthToken:
      type: object
      properties:
        uid:
          type: string
        authToken:
          type: string
        createdAt:
          type: integer
          format: int64
    AuthTokenResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/AuthToken'
    Acknowledgement:
      type: object
      properties:
        data:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
    AuthTokenList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AuthToken'
  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.