# Update Users in a Group API

API documentation for the FusionAuth Update Users in a Group API.

> For the index of this section of the site, see [llms.txt](https://fusionauth.io/docs/llms.txt)

Available since `1.36.0`

This API is used to completely replace the existing membership of a Group. Calling this API is equivalent to removing all Users from a Group and then making a `POST` request to the `/api/group/member` to add Users to the Group. Use this API with caution.

## Request

[API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#api-key-authentication)

Update Users in a Group

`PUT /api/group/member`

#### Request Headers

`X-FusionAuth-TenantId`

*   String
*   optional

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon the request parameters or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See [Making an API request using a Tenant Id](https://fusionauth.io/docs/apis/authentication.md#making-an-api-request-using-a-tenant-id) for additional information.

##### Request Body

`members[groupId]`

*   Array
*   required

The key is the Id of the Group to which to add Users. The value is an array of objects which specify the Members to be added.

`members[groupId][x].data`

*   Object
*   optional

An object that can hold any information about the Group Member that should be persisted.

`members[groupId][x].id`

*   UUID
*   optional

The unique Id of this Group Member. If not specified a secure random UUID will be generated.

`members[groupId][x].userId`

*   UUID
*   required

The User Id to add as a Member of this Group.

*Example Request JSON*

```json
{
  "members": {
    "1188edfc-cef3-4555-910e-181ddf6153c0": [
      {
        "data": {
          "fruit": "orange"
        },
        "userId": "00000000-0000-0001-0000-000000000000"
      }
    ]
  }
}
```

## Response

*Response Codes*

| Code | Description |
| --- | --- |
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an [Errors](https://fusionauth.io/docs/apis/errors.md) JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See [Authentication](https://fusionauth.io/docs/apis/authentication.md). |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |

### Response Body

`members[groupId][x].data`

*   Object

An object that can hold any information about the Group Member that should be persisted.

`members[groupId][x].id`

*   UUID

The unique Id of this Group Member. This is not the User Id, but a unique Id for the membership.

`members[groupId][x].insertInstant`

*   Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that this membership was created.

`members[groupId][x].userId`

*   UUID

The User Id of the Group Member.

*Example Response JSON*

```json
{
  "members": {
    "1188edfc-cef3-4555-910e-181ddf6153c0": [
      {
        "data": {
          "fruit": "orange"
        },
        "id": "47ffe8c2-920a-49cc-bfa8-b84889db615e",
        "insertInstant": 1503513015493,
        "userId": "00000000-0000-0001-0000-000000000000"
      }
    ]
  }
}
```
---

## Other pages in Groups

> For the full index of this section, see [Apis](https://fusionauth.io/docs/llms-apis.txt).

- [Add Users to a Group API](https://fusionauth.io/docs/apis/groups/add-users-to-a-group.md): API documentation for the FusionAuth Add Users to a Group API.
- [Create a Group API](https://fusionauth.io/docs/apis/groups/create-a-group.md): API documentation for the FusionAuth Create a Group API.
- [Delete a Group API](https://fusionauth.io/docs/apis/groups/delete-a-group.md): API documentation for the FusionAuth Delete a Group API.
- [Group API](https://fusionauth.io/docs/apis/groups.md): Learn about the APIs for creating, retrieving, updating and deleting groups.
- [Remove Users from a Group API](https://fusionauth.io/docs/apis/groups/remove-users-from-a-group.md): API documentation for the FusionAuth Remove Users from a Group API.
- [Retrieve a Group API](https://fusionauth.io/docs/apis/groups/retrieve-a-group.md): API documentation for the FusionAuth Retrieve a Group API.
- [Search for Group Members API](https://fusionauth.io/docs/apis/groups/search-for-group-members.md): API documentation for the FusionAuth Search for Group Members API.
- [Search for Groups API](https://fusionauth.io/docs/apis/groups/search-for-groups.md): API documentation for the FusionAuth Search for Groups API.
- [Update a Group API](https://fusionauth.io/docs/apis/groups/update-a-group.md): API documentation for the FusionAuth Update a Group API.
