# Retrieves the list of all custom groups Returns details of all custom groups including group ID, name, type (Computers/Users), category (Static/Dynamic/Static Unique), associated domain, and creation/modification timestamps. By default, auto-generated system groups (All Computers, All Users) are excluded. The returned `groupId` values can be passed as `cgId` to [Delete CG](https://www.manageengine.com/products/desktop-central/custom-groups-delete-cg.html) or as `groupId` in the request body of [Update Static CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-cg.html), [Update Static Unique CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-unique-cg.html), or [Update Dynamic CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-dynamic-cg.html). The returned `groupName` values can be used with [Retrieve Custom Group Details](https://www.manageengine.com/products/desktop-central/custom-groups-get-cgdetails.html). ## Endpoint **GET** `/api/1.4/customgroup/getCGList` ## Request URL ``` https://{serverurl}/api/1.4/customgroup/getCGList ``` `{serverurl}`: See [OAuth Authentication - Endpoint Domain](https://www.manageengine.com/products/desktop-central/oauth-authentication-endpoint-domain.html) ## Scope ``` DesktopCentralCloud.Common.READ ``` ## Header ``` Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52 ``` ## Request Parameters ### Request Headers - **Accept** (string, Mandatory) `application/json` Must be application/json. Only JSON responses are supported. ### Query Parameters - **isAutoGeneratedCGNeeded** (boolean, Optional) Include auto-generated system groups (e.g., All Computers, All Users) in the response. Default: `false` ## Sample Request ### Curl ```bash curl --request GET \ --url https://appdomain/api/1.4/customgroup/getCGList \ --header 'Accept: application/json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' ``` ### Java ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.io.IOException; import java.net.http.HttpTimeoutException; public class Main { public static void main(String[] args) { HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://appdomain/api/1.4/customgroup/getCGList")) .header("Accept", "application/json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("GET", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ### Python ```python import http.client conn = http.client.HTTPSConnection("appdomain") headers = { 'Accept': "application/json", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("GET", "/api/1.4/customgroup/getCGList", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript headersMap = Map(); headersMap.put("Accept", "application/json"); response = invokeUrl [ url: "https://appDomain/api/1.4/customgroup/getCGList" type: GET headers: headersMap connection: connection_name ] info response; ``` ### PowerShell ```powershell $headers=@{} $headers.Add("Accept", "application/json") $headers.Add("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") $response = Invoke-WebRequest -Uri 'https://appdomain/api/1.4/customgroup/getCGList' -Method GET -Headers $headers ``` ## Response Parameters ### HTTP 200 **Response Body**: `application/json` - **message_type** (string) Always `'getCGList'` for this endpoint. - **message_response** (JSON object) Response payload container. - **getcglist** (JSON object) Response payload. - **operation_status** (string) Operation result: `'success'` when the request completed without errors. - **response** (JSON object) Wrapper containing the success message and result payload. - **message** (string) Fixed success string: `'Operation has been completed successfully'`. - **result** (JSON object) Result payload containing the `cg_list` array. - **cg_list** (JSON array) Array of custom group summaries without member details. - **group_id** (long) Unique resource ID of the custom group. Use as `cgId` in [Delete CG](https://www.manageengine.com/products/desktop-central/custom-groups-delete-cg.html), as `groupId` in the request body of [Update Static CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-cg.html) / [Update Static Unique CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-unique-cg.html) / [Update Dynamic CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-dynamic-cg.html), or as `sourceCGId` in [Clone Dynamic CG](https://www.manageengine.com/products/desktop-central/custom-groups-clone-dynamic-cg.html). - **group_name** (string) Display name of the custom group (must be unique). - **group_type** (string) Human-readable type: `'Computers'` (groupType=1) or `'Users'` (groupType=2). - **group_category** (string) Human-readable category: `'Static'` (1), `'Dynamic'` (2), `'Static Unique'` (5), or `'All Computer/User Group'` (10). - **domain_name** (string) NetBIOS domain name. `'NA'` for dynamic groups which are not domain-specific. - **group_created_on** (long) Timestamp (ms since epoch) when the group was first created. - **group_modified_on** (long) Timestamp (ms since epoch) of the last modification to the group or its members. - **message_version** (string) API version: `'1.4'`. - **status** (string) `'success'` when the request completed without errors. ### HTTP 204 **Response Body**: `application/json` - **message_type** (string) Always `'getCGList'` for this endpoint. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'` for error responses. - **error_code** (string) Internal error code: `'20012'` (no custom groups found). - **error_description** (string) Human-readable error message. ### HTTP 417 **Response Body**: `application/json` - **message_type** (string) Always `'getCGList'` for this endpoint. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'` for error responses. - **error_code** (string) Internal error code: `'20003'` (no managed domains). - **error_description** (string) Human-readable error message. ### HTTP 500 **Response Body**: `application/json` - **message_type** (string) Always `'getCGList'` for this endpoint. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'` for error responses. - **error_code** (string) Internal error code: `'1003'` (INTERNAL_ERROR). - **error_description** (string) Resolved I18N message, typically: An internal error occurred while processing the request. ## Possible Response Codes - **200** - **204** - **417** - **500** ## Sample Response: HTTP 200 **List with static, dynamic, static unique computer and user groups.** ```json { "message_type": "getCGList", "message_response": { "getcglist": { "response": { "result": { "cg_list": [ { "domain_name": "CORP", "group_category": "Static", "group_id": 301, "group_name": "Windows Servers", "group_modified_on": 1710412000000, "group_created_on": 1710325600000, "group_type": "Computers" }, { "domain_name": "NA", "group_category": "Dynamic", "group_id": 302, "group_name": "Windows 11 PCs", "group_modified_on": 1710500000000, "group_created_on": 1710325600000, "group_type": "Computers" }, { "domain_name": "CORP", "group_category": "Static Unique", "group_id": 303, "group_name": "Finance OU Computers", "group_modified_on": 1710500000000, "group_created_on": 1710240000000, "group_type": "Computers" }, { "domain_name": "CORP", "group_category": "Static", "group_id": 304, "group_name": "HR Users", "group_modified_on": 1710150000000, "group_created_on": 1710150000000, "group_type": "Users" } ] }, "message": "Operation has been completed successfully" }, "operation_status": "success" } }, "message_version": "1.4", "status": "success" } ``` **List including auto-generated All Computers group when `isAutoGeneratedCGNeeded=true`.** ```json { "message_type": "getCGList", "message_response": { "getcglist": { "response": { "result": { "cg_list": [ { "domain_name": "NA", "group_category": "All Computer/User Group", "group_id": 1, "group_name": "All Computers", "group_modified_on": 1710500000000, "group_created_on": 1700000000000, "group_type": "Computers" }, { "domain_name": "CORP", "group_category": "Static", "group_id": 301, "group_name": "Windows Servers", "group_modified_on": 1710412000000, "group_created_on": 1710325600000, "group_type": "Computers" } ] }, "message": "Operation has been completed successfully" }, "operation_status": "success" } }, "message_version": "1.4", "status": "success" } ``` ## Sample Response: HTTP 204 **No manually created custom groups exist in the system.** ```json { "error_description": "No custom groups found", "message_type": "getCGList", "error_code": "20012", "message_version": "1.4", "status": "error" } ``` ## Sample Response: HTTP 417 **Server has no managed AD/workgroup domains configured.** ```json { "error_description": "No managed domain(s) available", "message_type": "getCGList", "error_code": "20003", "message_version": "1.4", "status": "error" } ``` ## Sample Response: HTTP 500 **Unexpected server-side failure retrieving custom group list.** ```json { "error_description": "An internal error occurred while processing the request.", "message_type": "getCGList", "error_code": "1003", "message_version": "1.4", "status": "error" } ```