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

# Update A Group

> Update group details such as name, icon, description, and metadata using the CometChat React Native SDK.

<Info>
  **Quick Reference** - Update a group:

  ```javascript theme={null}
  const group = new CometChat.Group("GUID", "Updated Name", CometChat.GROUP_TYPE.PUBLIC);
  await CometChat.updateGroup(group);
  ```
</Info>

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

## Update Group

*In other words, as a group owner, how can I update the group details?*

You can update the existing details of the group using the `updateGroup()` method.

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    var GUID = "GUID";
    var groupName = "Hello Group";
    var groupType = CometChat.GROUP_TYPE.PUBLIC;
    var group = new CometChat.Group(GUID, groupName, groupType);

    CometChat.updateGroup(group).then(
    group => {
      console.log("Groups details updated successfully:", group);
    }, error => {
      console.log("Group details update failed with exception:", error);
    }
    );
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    var GUID: string = "GUID";
    var groupName: string = "Hello Group!";
    var groupType: string = CometChat.GROUP_TYPE.PUBLIC;

    var group: CometChat.Group = new CometChat.Group(GUID, groupName, groupType);

    CometChat.updateGroup(group).then(
      (group: CometChat.Group) => {
          console.log("Group details updated successfully:", group);
      }, (error: CometChat.CometChatException) => {
          console.log("Group details update failed with exception:", error);
      }
    );
    ```
  </Tab>
</Tabs>

This method takes an instance of the `Group` class as a parameter which should contain the data that you wish to update.

| Parameter | Description                  |
| --------- | ---------------------------- |
| `group`   | an instance of class `Group` |

After a successful update of the group, you will receive an instance of `Group` class containing update information of the group.

<Accordion title="Response">
  **On Success** — `updateGroup()` returns the updated `Group` object:

  | Parameter            | Type    | Description                                         | Sample Value                  |
  | -------------------- | ------- | --------------------------------------------------- | ----------------------------- |
  | `hasJoined`          | boolean | Whether the logged-in user has joined the group     | `true`                        |
  | `membersCount`       | number  | Total number of members in the group                | `2`                           |
  | `isBanned`           | boolean | Whether the logged-in user is banned from the group | `false`                       |
  | `guid`               | string  | Unique identifier of the group                      | `"group_1772427551785"`       |
  | `name`               | string  | Updated name of the group                           | `"Comet Group Updated"`       |
  | `type`               | string  | Type of the group (public, private, password)       | `"public"`                    |
  | `scope`              | string  | Scope of the logged-in user in the group            | `"admin"`                     |
  | `joinedAt`           | number  | Unix timestamp when the user joined                 | `1772427556`                  |
  | `conversationId`     | string  | Conversation ID for the group                       | `"group_group_1772427551785"` |
  | `createdAt`          | number  | Unix timestamp when the group was created           | `1772427556`                  |
  | `owner`              | string  | UID of the group owner                              | `"cometchat-uid-6"`           |
  | `updatedAt`          | number  | Unix timestamp when the group was last updated      | `1772427918`                  |
  | `updatedBy`          | string  | UID of the user who updated the group               | `"cometchat-uid-6"`           |
  | `onlineMembersCount` | number  | Number of online members in the group               | `2`                           |
</Accordion>

For more information on the `Group` class, please check [here](/sdk/react-native/create-group#group-class)

## Best Practices

<AccordionGroup>
  <Accordion title="Set the GUID on the Group object">
    The `Group` object passed to `updateGroup()` must have the correct GUID set. Only the fields you set on the object will be updated — unset fields remain unchanged.
  </Accordion>

  <Accordion title="Only owners and admins can update groups">
    The `updateGroup()` method requires the logged-in user to be the owner or an admin of the group. Participants and moderators cannot update group details.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Update fails with permission error">
    Verify the logged-in user is the owner or an admin of the group. Use `getGroup()` to check the user's scope in the group.
  </Accordion>

  <Accordion title="Group type not changing after update">
    The `type` field of a group is not editable after creation. To change a group's type, you would need to create a new group with the desired type.
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Retrieve Groups" icon="layer-group" href="/sdk/react-native/retrieve-groups">
    Fetch group lists, search groups, and get group details
  </Card>

  <Card title="Group Members" icon="users" href="/sdk/react-native/group-members">
    Manage members, roles, and permissions within groups
  </Card>

  <Card title="Delete a Group" icon="trash" href="/sdk/react-native/delete-group">
    Delete groups and handle related cleanup
  </Card>

  <Card title="Create a Group" icon="plus" href="/sdk/react-native/create-group">
    Create public, private, or password-protected groups
  </Card>
</CardGroup>
