> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Update Users in a Group

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

# Update Users in a Group

version

This API has been 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

OpenAPI Spec

#### Request Headers

`X-FusionAuth-TenantId`Stringoptional

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]`Arrayrequired

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`Objectoptional

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

`members[groupId][x].id`UUIDoptional

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

`members[groupId][x].userId`UUIDrequired

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"
      }
    ]
  }
}
```