Skip to main content
GET
/
groups
List
curl --request GET \
  --url https://{appId}.api-{region}.cometchat.io/v3/groups \
  --header 'apikey: <api-key>'
{
  "data": {
    "0": {
      "0": {
        "guid": "project-group-2",
        "name": "Project Group 2",
        "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"
        ]
      },
      "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"
      ]
    },
    "meta": {
      "pagination": {
        "total": 0,
        "count": 5,
        "per_page": 100,
        "current_page": 1,
        "total_pages": 1
      },
      "cursor": {
        "updatedAt": 1638354799,
        "affix": "prepend"
      }
    }
  }
}

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.

For the complete error reference, see Error Guide.

Authorizations

apikey
string
header
required

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

Headers

onBehalfOf
string

UID of the user on whose behalf the action is performed.

Query Parameters

searchKey
string

Searches for given keyword in group's list (either GUID, name or email).

searchIn
string[]

Searches for specified keyword in name,GUID or both.

sortBy
enum<string>

Sorts the group list by either Name,Guid or Created at . Available values: name, guid, createdAt Sort field for listing groups.

Available options:
name,
guid,
createdAt
sortOrder
enum<string>

Sorts the group list in ascending or descending order. Available values: asc, desc Sort order.

Available options:
asc,
desc
perPage
integer
default:100

Number of groups to be fetched in a request. The default value is 100 and the maximum value is 1000.

affix
enum<string>

Determines whether to fetch the groups either before or after createdAt/updatedAt timestamp. Possible values are append(after) and prepend(before). Cursor pagination direction.

Available options:
append,
prepend
updatedAt
integer

Fetches the groups list after a particular updatedAt timestamp.

withTags
boolean

Includes those groups that have tags.

tags
string[]

Fetches only those groups that have these tags.

type
enum<string>

Fetches groups based on group type(public, protected, password). Group type. public: anyone can join. password: requires password. private: invitation only.

Available options:
public,
private,
password
types
string[]

Fetches groups based on multiple types.

page
integer

Page number.

hasJoined
boolean

Fetches all the joined groups of a user. This will work only with onBehalfOf parameter in header. It accepts only true as a value, setting it as false simply removes this filter.

Response

200 - application/json

A list of groups

data
object[]
meta
object
cursor
object