- [Resource: Membership](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership)
  - [JSON representation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.SCHEMA_REPRESENTATION)
  - [MembershipState](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipState)
  - [MembershipRole](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipRole)
  - [Group](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Group)
    - [JSON representation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Group.SCHEMA_REPRESENTATION)
  - [Affiliation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Affiliation)
- [Methods](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#METHODS_SUMMARY)

## Resource: Membership

Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.

| JSON representation |
|---|
| ``` { "name": string, "state": enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipState`), "role": enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipRole`), "createTime": string, "deleteTime": string, "affiliation": enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Affiliation`), "member": { object (`https://developers.google.com/workspace/chat/api/reference/rest/v1/User`) }, "groupMember": { object (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Group`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. Resource name of the membership, assigned by the server. Format: `spaces/{space}/members/{member}` |
| `state` | ``enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipState`)`` Output only. State of the membership. |
| `role` | ``enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.MembershipRole`)`` Optional. User's role within a Chat space, which determines their permitted actions in the space. This field can only be used as input in `members.patch`. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Optional. Immutable. The creation time of the membership, such as when a member joined or was invited to join a space. This field is output only, except when used to import historical memberships in import mode spaces. |
| `deleteTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Optional. Immutable. The deletion time of the membership, such as when a member left or was removed from a space. This field is output only, except when used to import historical memberships in import mode spaces. |
| `affiliation` | ``enum (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Affiliation`)`` Output only. A user's relationship to the Workspace organization that owns the space. In spaces owned by consumer accounts, the affiliation of all members is `EXTERNAL`. |
| Member associated with this membership. Other member types might be supported in the future. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `member` | ``object (`https://developers.google.com/workspace/chat/api/reference/rest/v1/User`)`` Optional. The Google Chat user or app the membership corresponds to. If your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output only populates the [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) `name` and `type` fields for both internal and external users, unless they are members of the space or have a prior affinity, like a direct message (DM) conversation, with the calling user. |
| `groupMember` | ``object (`https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.Group`)`` Optional. The Google Group the membership corresponds to. Reading or mutating memberships for Google Groups requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). |
| End of mutually exclusive fields. ||

### MembershipState

Specifies the member's relationship with a space. Other membership states might be supported in the future.

| Enums ||
|---|---|
| `MEMBERSHIP_STATE_UNSPECIFIED` | Default value. Don't use. |
| `JOINED` | The user is added to the space, and can participate in the space. |
| `INVITED` | The user is invited to join the space, but hasn't joined it. |
| `NOT_A_MEMBER` | The user doesn't belong to the space and doesn't have a pending invitation to join the space. |

### MembershipRole

Represents a user's permitted actions in a Chat space. More enum values might be added in the future.

| Enums ||
|---|---|
| `MEMBERSHIP_ROLE_UNSPECIFIED` | Default value. For `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.FIELDS.member`: they aren't a member of the space, but can be invited. For `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#Membership.FIELDS.group_member`: they're always assigned this role (other enum values might be used in the future). |
| `ROLE_MEMBER` | A member of the space. In the Chat UI, this role is called Member. The user has basic permissions, like sending messages to the space. Managers and owners can grant members additional permissions in a space, including: - Add or remove members. - Modify space details. - Turn history on or off. - Mention everyone in the space with `@all`. - Manage Chat apps and webhooks installed in the space. In direct messages and unnamed group conversations, everyone has this role. |
| `ROLE_MANAGER` | A space owner. In the Chat UI, this role is called Owner. The user has the complete set of space permissions to manage the space, including: - Change the role of other members in the space to member, manager, or owner. - Delete the space. Only supported in `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.SpaceType` (named spaces). To learn more, see [Learn more about your role as a space owner or manager](https://support.google.com/chat/answer/11833441). |
| `ROLE_ASSISTANT_MANAGER` | A space manager. In the Chat UI, this role is called Manager. The user has all basic permissions of `ROLE_MEMBER`, and can be granted a subset of administrative permissions by an owner. By default, managers have all the permissions of an owner except for the ability to: - Delete the space. - Make another space member an owner. - Change an owner's role. By default, managers permissions include but aren't limited to: - Make another member a manager. - Delete messages in the space. - Manage space permissions. - Receive notifications for requests to join the space if the manager has the "manage members" permission in the space settings. - Make a space discoverable. Only supported in `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.SpaceType` (named spaces). To learn more, see [Manage space settings](https://support.google.com/chat/answer/13340792). |

### Group

A Google Group in Google Chat.

| JSON representation |
|---|
| ``` { "name": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Resource name for a Google Group. Represents a [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in Cloud Identity Groups API. Format: groups/{group} |

### Affiliation

Represents the affiliation of a user to the Google Workspace organization that owns the space. This enum may have more values added in the future.

| Enums ||
|---|---|
| `AFFILIATION_UNSPECIFIED` | Default value. This value is unused. |
| `INTERNAL` | An account managed by the same Google Workspace organization that owns the space. |
| `EXTERNAL` | An account external to the Google Workspace organization that owns the space (e.g., a consumer account, or an account managed by a different Workspace organization). |
| `MANAGED_EXTERNAL` | An account managed by the Workspace organization that owns the space, but provisioned for a user who is external to the organization (e.g., a Guest user). To learn more about guests, see <https://support.google.com/chat/answer/16997417>. |

| ## Methods ||
|---|---|
| ### `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members/create` | Creates a membership for the calling Chat app, a user, or a Google Group. |
| ### `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members/delete` | Deletes a membership. |
| ### `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members/get` | Returns details about a membership. |
| ### `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members/list` | Lists memberships in a space. |
| ### `https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members/patch` | Updates a membership. |