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

# Add Users to a Group

API documentation for the FusionAuth Add Users to a Group API.

# Add Users to a Group

This API is used to add Users to a Group. A User that is added to a Group is called a member, a user can belong to one to many Groups.

Adding a User to a Group can be used to logically group users, Group members can be returned by the Search API by searching by the Group Id. Application Roles may also be managed by a Group membership. When a User becomes a member of a Group they will inherit the Application Roles assigned to the Group for their registered Applications. If a User is not registered for an Application the Application Roles for that Application will not be applied to the User.

## Request

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

Add Users to Group

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