# Group Members

API endpoints for managing group membership. Provides functionality to add, update, and remove members from groups, as well as retrieve membership information. Supports both local and federated groups through ActivityPub protocol. Access control is enforced based on group privacy settings and user permissions.

## Get current user's group memberships

 - [GET /api/v1/groups](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups/get.md): Retrieves all groups that the currently authenticated user is a member of. Returns both public and private groups since the user is requesting their own memberships. Returns full Group objects with complete group details. Results are paginated. This is a convenience endpoint equivalent to calling /groups/member/{userId}/groups with your own user ID.

## Get group memberships for a specific user

 - [GET /api/v1/groups/member/{userId}](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1member~1%7Buserid%7D/get.md): Retrieves all group memberships for the specified user. Privacy rules apply: requesting your own memberships returns all groups (public and private), while requesting another user's memberships returns only their public group memberships. Results are paginated.

## Get groups that a user is a member of

 - [GET /api/v1/groups/member/{userId}/groups](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1member~1%7Buserid%7D~1groups/get.md): Retrieves all groups where the specified user is a member. Privacy rules apply: requesting your own groups returns all groups (public and private), while requesting another user's groups returns public groups and private groups where the viewer is also a member. Returns full Group objects rather than membership records. Results are paginated.

## Get groups owned by current user

 - [GET /api/v1/groups/owned](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1owned/get.md): Retrieves all groups that were created by the currently authenticated user account. This returns groups where the user is the owner, not just a member. A single user account can own and manage multiple groups. Returns full Group objects with complete group details including private groups owned by the user. Results are paginated.

## Get all members of a group

 - [GET /api/v1/groups/{groupId}/members](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1members/get.md): Retrieves the list of all members in the specified group as GroupMember objects.
            Public groups are accessible to all authenticated users, Private groups accessible to members only.
            Supports sorting by join time, posts, relationship to current user, domain, displayName, username, createdAfter, or entityType.
            Supports filtering by role, domain, displayName, username, createdAfter, and entityType.
            Supports pagination. If no filter parameters are provided, returns all members.

## Admin-level search for group members

 - [GET /api/v1/groups/{groupId}/members/search](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1members~1search/get.md): Performs an administrative search for group members with multiple filter criteria.
            Requires GroupMembers.Moderate permission. Can search by roles, actor type, status, country,
            domain, display name, username, IP address, or join date. Supports sorting by join time,
            display name, username, number of posts, or country. Results include detailed member
            information including statistics, last activity, and location data.

RBAC: requires GroupMembers.Moderate

## Update an existing group member

 - [PUT /api/v1/groups/{groupId}/members/{memberId}](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1members~1%7Bmemberid%7D/put.md): Updates the role, status, or metadata of an existing group member. For local groups, the update is applied immediately. For federated groups, an ActivityPub message is sent to the remote server to request the update. Requires GroupMembers.Manage permission for the target group.

RBAC: requires GroupMembers.Manage

## Remove a member from a group

 - [DELETE /api/v1/groups/{groupId}/members/{memberId}](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1members~1%7Bmemberid%7D/delete.md): Removes the specified user from the group. For local groups, the membership is deleted immediately. For federated groups, an ActivityPub message is sent to request removal. Requires GroupMembers.Manage permission. An optional reason can be provided for audit logging.

RBAC: requires GroupMembers.Manage

## Transfer group ownership

 - [POST /api/v1/groups/{groupId}/members/{newOwnerId}/transfer-ownership](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1members~1%7Bnewownerid%7D~1transfer-ownership/post.md): Transfers the ownership of the group to another existing member. The current owner is demoted to admin and the target member becomes the new owner. Can be called by the current owner, or by a system admin if the current owner is suspended.

## Leave a group

 - [DELETE /api/v1/groups/{groupId}/membership](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1membership/delete.md): Removes the authenticated user from the group. The user's posts and comments remain but permissions are revoked. The user can rejoin later with fresh membership. Cannot leave if the user is the last admin of the group. Authentication is required.

## Get current user's membership in a group

 - [GET /api/v1/groups/{groupId}/membership](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1membership/get.md): Returns the membership information for the authenticated user in the specified group. Returns a MembershipInfo object with state indicating: MEMBER (active member), PENDING_JOIN (has pending join request), PENDING_INVITE (has pending invite), or NONE (no relationship). Authentication is required.

## Get group members as User objects

 - [GET /api/v1/groups/{groupId}/users](https://docs.wellesley.social/openapi/group-members/paths/~1api~1v1~1groups~1%7Bgroupid%7D~1users/get.md): Retrieves the list of all members in the specified group.
            Public groups are accessible to all authenticated users, Private groups accessible to members only.
            Supports sorting by join time, posts, or relationship to current user.
            Supports role filtering and pagination.

