Create
curl --request POST \
--url https://{appId}.api-{region}.cometchat.io/v3/groups \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"guid": "testgroup",
"name": "Test Group",
"type": "public"
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload = {
"guid": "testgroup",
"name": "Test Group",
"type": "public"
}
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: 'testgroup', name: 'Test Group', type: 'public'})
};
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' => 'testgroup',
'name' => 'Test Group',
'type' => 'public'
]),
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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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
Create a group and check its limits, such as 300 members with every feature, or up to 100,000 once receipts and typing indicators switch off.
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": "testgroup",
"name": "Test Group",
"type": "public"
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/groups"
payload = {
"guid": "testgroup",
"name": "Test Group",
"type": "public"
}
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: 'testgroup', name: 'Test Group', type: 'public'})
};
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' => 'testgroup',
'name' => 'Test Group',
'type' => 'public'
]),
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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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\": \"testgroup\",\n \"name\": \"Test Group\",\n \"type\": \"public\"\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
Body
application/json
Was this page helpful?