Create
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/groups \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"guid": "<string>",
"name": "<string>",
"password": "<string>",
"icon": "<string>",
"description": "<string>",
"metadata": {},
"owner": "<string>",
"tags": [
"tag1"
],
"members": {
"admins": [],
"moderators": [],
"participants": [],
"usersToBan": []
}
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload = {
"guid": "<string>",
"name": "<string>",
"password": "<string>",
"icon": "<string>",
"description": "<string>",
"metadata": {},
"owner": "<string>",
"tags": ["tag1"],
"members": {
"admins": [],
"moderators": [],
"participants": [],
"usersToBan": []
}
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
guid: '<string>',
name: '<string>',
password: '<string>',
icon: '<string>',
description: '<string>',
metadata: {},
owner: '<string>',
tags: ['tag1'],
members: {admins: [], moderators: [], participants: [], usersToBan: []}
})
};
fetch('https://{appId}.api-{region}.cometchat.io/v3/groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{appId}.api-{region}.cometchat.io/v3/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'guid' => '<string>',
'name' => '<string>',
'password' => '<string>',
'icon' => '<string>',
'description' => '<string>',
'metadata' => [
],
'owner' => '<string>',
'tags' => [
'tag1'
],
'members' => [
'admins' => [
],
'moderators' => [
],
'participants' => [
],
'usersToBan' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload := strings.NewReader("{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/groups")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"guid": "project-group",
"name": "Project Group",
"description": "project related discussions between members",
"icon": "https://assets.cometchat.io/sampleapp/v2/groups/cometchat-guid-1.webp",
"type": "public",
"scope": "admin",
"membersCount": 1,
"joinedAt": 1638440784,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1638440784,
"owner": "cometchat-uid-4",
"tags": [
"friends",
"project"
]
}
}Groups
Create
Creates a group.
POST
/
groups
Create
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/groups \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"guid": "<string>",
"name": "<string>",
"password": "<string>",
"icon": "<string>",
"description": "<string>",
"metadata": {},
"owner": "<string>",
"tags": [
"tag1"
],
"members": {
"admins": [],
"moderators": [],
"participants": [],
"usersToBan": []
}
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload = {
"guid": "<string>",
"name": "<string>",
"password": "<string>",
"icon": "<string>",
"description": "<string>",
"metadata": {},
"owner": "<string>",
"tags": ["tag1"],
"members": {
"admins": [],
"moderators": [],
"participants": [],
"usersToBan": []
}
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
guid: '<string>',
name: '<string>',
password: '<string>',
icon: '<string>',
description: '<string>',
metadata: {},
owner: '<string>',
tags: ['tag1'],
members: {admins: [], moderators: [], participants: [], usersToBan: []}
})
};
fetch('https://{appId}.api-{region}.cometchat.io/v3/groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{appId}.api-{region}.cometchat.io/v3/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'guid' => '<string>',
'name' => '<string>',
'password' => '<string>',
'icon' => '<string>',
'description' => '<string>',
'metadata' => [
],
'owner' => '<string>',
'tags' => [
'tag1'
],
'members' => [
'admins' => [
],
'moderators' => [
],
'participants' => [
],
'usersToBan' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload := strings.NewReader("{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{appId}.api-{region}.cometchat.io/v3/groups")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"guid\": \"<string>\",\n \"name\": \"<string>\",\n \"password\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"owner\": \"<string>\",\n \"tags\": [\n \"tag1\"\n ],\n \"members\": {\n \"admins\": [],\n \"moderators\": [],\n \"participants\": [],\n \"usersToBan\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"guid": "project-group",
"name": "Project Group",
"description": "project related discussions between members",
"icon": "https://assets.cometchat.io/sampleapp/v2/groups/cometchat-guid-1.webp",
"type": "public",
"scope": "admin",
"membersCount": 1,
"joinedAt": 1638440784,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1638440784,
"owner": "cometchat-uid-4",
"tags": [
"friends",
"project"
]
}
}Constraints
| Item | Constraint | Notes |
|---|---|---|
| GUID character limit | 100 characters | Alphanumeric with dashes only; spaces not allowed |
| Group name | 100 characters (UTF8mb4) | Supports all languages and emojis |
| Maximum users in a group (with all features) | 300 | Groups up to 300 members support all features including delivery/read receipts and typing indicators |
| Maximum users in a group (without receipts) | 100,000 (up to 10,000 concurrent) | Large groups disable delivery/read receipts and typing indicators for performance |
| Group password | 100 characters max | Only applicable for password-protected groups |
| Group description | 255 characters (UTF8mb4) | Brief summary of the group’s purpose |
| Maximum groups | No limit | Create as many groups as needed; billing based on active users |
| Typing indicators for groups | Up to 1000 online users | Disabled for larger groups to optimize performance |
| Unread message counts for groups | Up to 300 members | Not updated for groups with more than 300 members |
| Delivery and read receipts for groups | Up to 300 online users | Disabled in large groups to reduce server load |
| Active presence subscriptions | Up to 1000 online users | Presence notifications not sent beyond this limit |
Authorizations
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Headers
UID of the user on whose behalf the action is performed.
Body
application/json
A unique identifier for a group.
Name of the group.
Type of the group. Can be public, password or private.
Available options:
public, password, private A password required to join the the group with type password
An URL for a group icon.
Description about the group
Additional data for the group.
The UID that you wish to make owner of the group
List of tags to identify specific groups.
Add members to a group with scope admins,moderators and participants.
Show child attributes
Show child attributes
Response
200 - application/json
Create Group
Was this page helpful?
⌘I