Skip to main content
POST
/
roles
Create
curl --request POST \
  --url https://{appId}.api-{region}.cometchat.io/v3/roles \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "role": "",
  "name": "",
  "description": "",
  "metadata": {},
  "settings": {}
}
'
{
  "data": {
    "role": "manager",
    "name": "manager",
    "description": "This role gives an update access",
    "metadata": {
      "email": "managers@gmail.com"
    },
    "settings": {
      "listUsers": "all",
      "sendMessagesTo": "friendsOnly"
    },
    "createdAt": 1638343994
  }
}

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.

Constraints

ItemConstraintNotes
Role UID100 characters, alpha-dash (a-z, 0-9, -, _)CometChat forces the UID to lowercase
Role name100 characters (UTF8mb4)Supports all languages and emojis
Role description255 characters (UTF8mb4)Describe the role’s purpose and permissions
MetadataNo limitStore additional role configuration as JSON key-value pairs

Authorizations

apikey
string
header
required

API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).

Body

application/json
role
string
default:""
required

A unique identifier for the role.

name
string
default:""
required

Friendly name of the role.

description
string
default:""

Description of the role.

metadata
object

Addition information about the role as JSON.

settings
object

Role settings that is used for restricting list users/send message. Possible values for listUsers & sendMessagesTo are all and friendsOnly

Response

200 - application/json

Created a new Role

data
object