Skip to main content
Version: 24.05

List Groups

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/o/groups

Overview​

Returns all groups with computed member counts.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

  • Required access: global admin

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication

Examples​

Example: List all groups​

https://your-server.com/o/groups?api_key=YOUR_API_KEY

Response​

Success Response​

{
"result": [
{
"_id": "507f1f77bcf86cd799439011",
"name": "Marketing Team",
"groupID": "marketing-team",
"global_admin": false,
"permission": {
"_": { "u": [], "a": [] },
"c": {},
"r": {},
"u": {},
"d": {}
},
"users": ["507f191e810c19729de860ea"],
"matched_users_count": 1
}
]
}

Response Fields​

FieldTypeDescription
resultArrayList of group documents
result[].matched_users_countNumberComputed user count via lookup on members
result[].usersArrayGroup member IDs

Error Responses​

HTTP StatusResponse
400{ "result": "Missing parameter \"api_key\" or \"auth_token\"" }
400Error object from database read path

Behavior​

  1. Loads groups from countly.groups.
  2. Performs lookup into countly.members to compute matched_users_count.
  3. Returns groups as { "result": [...] }.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.groupsEndpoint data source** - Primary source collection
countly.membersEndpoint data source** - Lookup source for matched_users_count