Delete group


Request description

Endpoint: /users/groups/:id/delete
Method: DELETE

The following parameter must be passed through the URL:

  • id: specifies the unique group identifier
{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication

A group can be deleted even if it has users. Those users are kept, but they are left without a group: Users list returns them with groupId: "NOT-DEFINED". If you want them in another group, move them with Edit user before deleting the group.

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

200

Response structure:

{
  // empty response
}

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  "message": "Unauthorized"
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.

Bad request

Describe the characteristics of a bad request

400

Response body

type DeleteGroupResponseType = {
  errorType: DELETE_GROUP_ERROR_TYPE;
  errorMessage: string;
  message?: string;    // Present on validation errors
  details?: object[];  // Present on validation errors
};

enum DELETE_GROUP_ERROR_TYPE {
  INVALID_REQUEST_FORMAT = "invalidRequestFormat", // invalid id, group not found, or body is not valid JSON
  ERROR_REMOVING_GROUP = "errorRemovingGroup",     // the group could not be deleted
}
Description:
errorTypeerrorMessageMeaning
invalidRequestFormatInvalid rol idthe id in the URL is not a valid group identifier
invalidRequestFormatRole not foundthere is no group with that id
errorRemovingGroup—the group could not be deleted. You can retry later
A group that does not exist returns 400 with errorType: "invalidRequestFormat", not 404.

Forbidden request

Describe the characteristics of a forbidden request

403

Response body

{
  "errorType": "invalidGroupId",
  "errorMessage": "Invalid group id"
}
Description: the group belongs to another organization.