Skip to main content

Get Group Users

Endpoint

/o/groups/group-users

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Returns members in a group, or members outside a group when inverse is true.

Authentication

  • Authentication methods:
    • API Key (parameter): api_key=YOUR_API_KEY
    • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
    • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Required access: global admin

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
argsObject (JSON string)YesStringified object containing group query options

args Object Fields

FieldTypeRequiredDescription
_idStringYesGroup ID used for filtering
inverseBooleanNoIf true, returns users not in the group

Response

Success Response

{
"result": [
{
"_id": "507f191e810c19729de860ea",
"full_name": "Jane Doe",
"email": "jane.doe@example.com",
"group_id": ["507f1f77bcf86cd799439011"],
"global_admin": false
}
]
}

Response Fields

FieldTypeDescription
resultArrayMatching members
result[]ObjectMember object (password is excluded)
result[].group_idArrayMember group assignments

Error Responses

HTTP StatusResponse
200{ "result": "Not enough args" }
400{ "result": "Missing parameter \"api_key\" or \"auth_token\"" }
400Error object from members query path

Behavior/Processing

  1. Parses args and validates _id.
  2. Builds query:
    • inverse=false or omitted: { "group_id": "<group_id>" }
    • inverse=true: { "group_id": { "$ne": "<group_id>" } }
  3. Returns members as { "result": [...] }.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersEndpoint data source** - Source of returned member list

Examples

Example 1: Members in a Group

Endpoint form:

https://your-server.com/o/groups/group-users?api_key=YOUR_API_KEY&args={"_id":"507f1f77bcf86cd799439011"}

Example 2: Members Not in a Group

Endpoint form:

https://your-server.com/o/groups/group-users?api_key=YOUR_API_KEY&args={"_id":"507f1f77bcf86cd799439011","inverse":true}


Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions


Last Updated

2026-02-16