# Deletes a custom group by ID Permanently deletes the specified custom group identified by `cgId`. This action is irreversible. Fetch the `cgId` from [Retrieve All Custom Groups](https://www.manageengine.com/products/desktop-central/custom-groups-get-cglist.html). Requires admin or customer-admin privileges, or ownership of the group. System-generated groups (e.g., All Computers, All Users) cannot be deleted. Returns a success message with the deleted group name. ## Endpoints **POST** `/api/1.4/customgroup/deleteCg` ## Request URL ``` https://{serverurl}/api/1.4/customgroup/deleteCg ``` `{serverurl}`: Refer to [OAuth Authentication - Endpoint Domain](https://www.manageengine.com/products/desktop-central/oauth-authentication-endpoint-domain.html) ## Scope ``` DesktopCentralCloud.Common.UPDATE ``` ## 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 - **cgId** (long, Mandatory) Resource ID of the custom group to delete. Fetch from [Retrieve All Custom Groups](https://www.manageengine.com/products/desktop-central/custom-groups-get-cglist.html) ## Sample Request ### Curl ```bash curl --request POST \ --url 'https://appdomain/api/1.4/customgroup/deleteCg?cgId=SOME_INTEGER_VALUE' \ --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/deleteCg?cgId=SOME_INTEGER_VALUE")) .header("Accept", "application/json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", 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("POST", "/api/1.4/customgroup/deleteCg?cgId=SOME_INTEGER_VALUE", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript parameters = "cgId=value"; headersMap = Map(); headersMap.put("Accept", "application/json"); response = invokeUrl [ url: "https://appDomain/api/1.4/customgroup/deleteCg" + "?" + parameters type: POST 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/deleteCg?cgId=SOME_INTEGER_VALUE' -Method POST -Headers $headers ``` ## Response Parameters ### HTTP 200 **Response Body**: `application/json` - **message_type** (string) Always `'deleteCg'` for this endpoint. - **message_response** (JSON object) Response payload container. - **deletecg** (JSON object) Response payload. - **message** (string) Localized message: `'{groupName} was successfully deleted!'`. - **message_version** (string) API version: `'1.4'`. - **status** (string) `'success'` when the request completed without errors. ### HTTP 404 **Response Body**: `application/json` - **message_type** (string) Always `'deleteCg'` for this endpoint. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'` for error responses. - **error_code** (string) `'70506'` (CG_INVALID_DETAILS_TO_UPDATE). - **error_description** (string) Resolved I18N message: `'No such Custom Group found.'`. ### HTTP 500 **Response Body**: `application/json` - **message_type** (string) Always `'deleteCg'` 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** — HTTP code - **404** — HTTP code - **500** — HTTP code ## Sample Response: HTTP 200 Group and all its membership associations removed. ```json { "message_type": "deleteCg", "message_response": { "deletecg": { "message": "Windows Servers was successfully deleted!" } }, "message_version": "1.4", "status": "success" } ``` ## Sample Response: HTTP 404 Group ID does not exist or user lacks admin/owner privileges. ```json { "error_description": "No such Custom Group found.", "message_type": "deleteCg", "error_code": "70506", "message_version": "1.4", "status": "error" } ``` ## Sample Response: HTTP 500 Unexpected server-side failure during deletion. ```json { "error_description": "An internal error occurred while processing the request.", "message_type": "deleteCg", "error_code": "1003", "message_version": "1.4", "status": "error" } ``` ## Rate Limit **Duration:** 1 minute **Threshold:** 30 **Lock period:** 5 minutes - **Duration** — Time window for the threshold. - **Threshold** — Number of API calls allowed within the specified duration. - **Lock Period** — Wait time before consecutive API requests.