Skip to main content
Quick Reference
// Transfer group ownership
CometChat.transferGroupOwnership("GUID", "UID");
Available via: SDK | REST API
In other words, as a logged-in user, how do I transfer the ownership of any group if I am the owner of the group? In order to transfer the ownership of any group, the first condition is that you must be the owner of the group. In case you are the owner of the group, you can use the transferGroupOwnership() method provided by the CometChat class. This will be helpful as the owner is not allowed to leave the group. In case, you as the owner would like to leave the group, you will have to use this method and transfer your ownership first to any other member of the group and only then you will be allowed to leave the group.
let GUID = "GUID";
let UID = "UID";
CometChat.transferGroupOwnership(GUID, UID).then(
  () => {
      console.log("Successfully transferred ownership of the group.");
  }, error => {
      console.log("Could not transfer ownership of the group: ", error);
  }
)
  • Always confirm with the user before transferring ownership — this action cannot be undone without the new owner’s cooperation
  • Transfer ownership before leaving a group, as the owner is not allowed to leave without doing so
  • After transferring ownership, the previous owner’s scope is automatically changed — update your UI accordingly
  • Consider showing a list of current group members to let the owner pick the new owner easily
  • ERR_NOT_A_MEMBER: The logged-in user is not a member of the group. Ensure the user has joined the group first.
  • ERR_INSUFFICIENT_PERMISSIONS: Only the group owner can transfer ownership. Verify the logged-in user is the owner, not just an admin.
  • Cannot leave group: You must transfer ownership first before leaving. Use transferGroupOwnership() then leaveGroup().
  • Target user not found: Ensure the UID belongs to an existing member of the group. You cannot transfer ownership to a non-member.

Next Steps