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": "http://placehold.it/120x120&text=image1",
        "type": "public",
        "scope": "admin",
        "membersCount": 1,
        "joinedAt": 1638440784,
        "conversationId": "group_project-group",
        "hasJoined": true,
        "createdAt": 1638440784,
        "owner": "superhero4",
        "tags": [
          "friends",
          "project"
        ]
      },
      "guid": "project-group",
      "name": "Project Group",
      "description": "project related discussions between members",
      "icon": "http://placehold.it/120x120&text=image1",
      "type": "public",
      "scope": "admin",
      "membersCount": 1,
      "joinedAt": 1638440784,
      "conversationId": "group_project-group",
      "hasJoined": true,
      "createdAt": 1638440784,
      "owner": "superhero4",
      "tags": [
        "friends",
        "project"
      ]
    },
    "meta": {
      "pagination": {
        "total": 0,
        "count": 5,
        "per_page": 100,
        "current_page": 1,
        "total_pages": 1
      },
      "cursor": {
        "updatedAt": 1638354799,
        "affix": "prepend"
      }
    }
  }
}

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

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

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

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).

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).

Available options:
public,
private,
protected
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

The response is of type object.