> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-v6-beta2-flutter-uikit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Transfer Group Ownership

> Learn how to transfer group ownership to another member using the CometChat React Native SDK.

<Info>
  **Quick Reference**

  ```javascript theme={null}
  // Transfer group ownership
  CometChat.transferGroupOwnership("GUID", "UID");
  ```
</Info>

<Note>
  Available via: [SDK](/sdk/react-native/transfer-group-ownership) | [REST API](/rest-api/groups/update)
</Note>

*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.

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    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);
      }
    )
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    let GUID: string = "GUID";
    let UID: string = "UID";
    CometChat.transferGroupOwnership(GUID, UID).then(
      (ownershipTransferred: string) => {
          console.log("Successfully transferred ownership of the group.");
      }, error => {
          console.log("Could not transfer ownership of the group: ", error);
      }
    );
    ```
  </Tab>
</Tabs>

<Accordion title="Response">
  **On Success** — `transferGroupOwnership()` returns a success message:

  | Parameter | Type   | Description                  | Sample Value                                                                                                |
  | --------- | ------ | ---------------------------- | ----------------------------------------------------------------------------------------------------------- |
  | `message` | string | Success confirmation message | `"Ownership transferred to user cometchat-uid-2 for the group with guid group_with_members_1772429132099."` |
</Accordion>

<AccordionGroup>
  <Accordion title="Best Practices">
    * 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
  </Accordion>

  <Accordion title="Troubleshooting">
    * **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.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Leave a Group" icon="right-from-bracket" href="/sdk/react-native/leave-group">
    Leave a group after transferring ownership
  </Card>

  <Card title="Change Member Scope" icon="user-gear" href="/sdk/react-native/group-change-member-scope">
    Promote or demote group members
  </Card>

  <Card title="Kick & Ban Members" icon="user-slash" href="/sdk/react-native/group-kick-ban-members">
    Remove or restrict members from a group
  </Card>

  <Card title="Delete a Group" icon="trash" href="/sdk/react-native/delete-group">
    Permanently delete a group
  </Card>
</CardGroup>
