> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListCurrentMemberGroups

# Package: members

# Namespace: GroupsService

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/access-groups/list-current-member-groups.md

## Permission Scopes:
Read Access Groups: SCOPE.DC-IDENTITY.READ-ACCESS-GROUPS

## Introduction

Retrieves the groups of a specific type that the logged-in site member belongs to.

For example, after a member buys a pricing plan, specify `"plan"` as `type`
to check whether the member was already added to the plan's group.
For groups of type `"plan"`, the group ID is the pricing plan ID.

The response includes groups of the current site whose membership is currently active, sorted by title.
A membership that expired or hasn't started yet isn't included.
The built-in Admin and Member groups aren't included.

Currently supports a single type: `"plan"`.

Call this method on behalf of a logged-in site member.
A call without a logged-in site member fails with `FAILED_PRECONDITION`.

---

## REST API

### Schema

```
 Method: listCurrentMemberGroups
 Description: Retrieves the groups of a specific type that the logged-in site member belongs to.  For example, after a member buys a pricing plan, specify `"plan"` as `type` to check whether the member was already added to the plan's group. For groups of type `"plan"`, the group GUID is the pricing plan GUID.  The response includes groups of the current site whose membership is currently active, sorted by title. A membership that expired or hasn't started yet isn't included. The built-in Admin and Member groups aren't included.  Currently supports a single type: `"plan"`.  Call this method on behalf of a logged-in site member. A call without a logged-in site member fails with `FAILED_PRECONDITION`.
 URL: https://www.wixapis.com/members-groups/v1/groups/current-member
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  type
 Method parameters: 
   param name: paging | type: CursorPaging    
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
   query param name: type | type: type | description: Type of groups to retrieve. The type is set by the app that created the groups, for example `"plan"` for groups created by Wix Pricing Plans.  The value is case-insensitive. If the member has no active groups of this type, the list is empty. Some type values are reserved and fail with `INVALID_ARGUMENT`.  Currently supports a single value: `"plan"`. Other values fail with `PERMISSION_DENIED`. | required: true | validation: maxLength 50
 Return type: ListCurrentMemberGroupsResponse
  - name: groups | type: array<GroupInfo> | description: Groups of the requested type that the logged-in member currently belongs to, sorted by title.  
     - name: id | type: string | description: Role GUID.  | read-only: true | validation: format GUID
     - name: title | type: string | description: Role name as defined in the site's [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) page or one of `"Admin"` or `"Member"`.  | validation: maxLength 50
     - name: description | type: string | description: Role description, if defined in the site's dashboard.  | validation: maxLength 1500
     - name: color | type: Color | description: Role color, as defined in the site's [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) page.  One of:  - `"DARK_BLUE"` - `"LIGHT_BLUE"` - `"TEAL"` - `"LIGHT_GREEN"` - `"YELLOW"` - `"ORANGE"` - `"RED"` - `"VIOLET"` - `"PURPLE"`  
         - enum: UNDEFINED, DARK_BLUE, LIGHT_BLUE, TEAL, LIGHT_GREEN, YELLOW, ORANGE, RED, VIOLET, PURPLE
     - name: type | type: string | description: Role type, set by the app that created the role, for example `"plan"` for roles created by Wix Pricing Plans. Empty for roles created on the site.  | validation: maxLength 50
     - name: createdDate | type: string | description: Date and time the role was created.  | read-only: true | validation: format date-time
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code:  | Description: The `type` value is reserved, or `paging.cursor` isn't a cursor returned by a previous call.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code:  | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions. Site members can specify `"plan"` as `type` and no other value.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code:  | Description: The method was called without a logged-in site member. Call it on behalf of a logged-in site member.


```

### Examples

### List the logged-in member's pricing plan groups
Retrieves the groups of type `"plan"` that the logged-in site member is currently an active member of. Check whether a returned group ID matches the ID of the plan the member bought.

```curl
curl -X GET \
'https://www.wixapis.com/members-groups/v1/groups/current-member?type=plan&paging.limit=50' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.membersAccess.accessGroups.listCurrentMemberGroups(type, options)
 Description: Retrieves the groups of a specific type that the logged-in site member belongs to.  For example, after a member buys a pricing plan, specify `"plan"` as `type` to check whether the member was already added to the plan's group. For groups of type `"plan"`, the group GUID is the pricing plan GUID.  The response includes groups of the current site whose membership is currently active, sorted by title. A membership that expired or hasn't started yet isn't included. The built-in Admin and Member groups aren't included.  Currently supports a single type: `"plan"`.  Call this method on behalf of a logged-in site member. A call without a logged-in site member fails with `FAILED_PRECONDITION`.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  type
 Method parameters: 
   param name: type | type: string | description: Type of groups to retrieve. The type is set by the app that created the groups, for example `"plan"` for groups created by Wix Pricing Plans.  The value is case-insensitive. If the member has no active groups of this type, the list is empty. Some type values are reserved and fail with `INVALID_ARGUMENT`.  Currently supports a single value: `"plan"`. Other values fail with `PERMISSION_DENIED`. | required: true | validation: maxLength 50
   param name: options | type: ListCurrentMemberGroupsOptions  none  
        - name: paging | type: CursorPaging | description: Cursor paging options.  A `limit` of `0` returns the default page size.  Default: `50` groups per page  
           - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
           - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
 Return type: PROMISE<ListCurrentMemberGroupsResponse>
  - name: groups | type: array<GroupInfo> | description: Groups of the requested type that the logged-in member currently belongs to, sorted by title.  
     - name: _id | type: string | description: Role GUID.  | read-only: true | validation: format GUID
     - name: title | type: string | description: Role name as defined in the site's [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) page or one of `"Admin"` or `"Member"`.  | validation: maxLength 50
     - name: description | type: string | description: Role description, if defined in the site's dashboard.  | validation: maxLength 1500
     - name: color | type: Color | description: Role color, as defined in the site's [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) page.  One of:  - `"DARK_BLUE"` - `"LIGHT_BLUE"` - `"TEAL"` - `"LIGHT_GREEN"` - `"YELLOW"` - `"ORANGE"` - `"RED"` - `"VIOLET"` - `"PURPLE"`  
         - enum: UNDEFINED, DARK_BLUE, LIGHT_BLUE, TEAL, LIGHT_GREEN, YELLOW, ORANGE, RED, VIOLET, PURPLE
     - name: type | type: string | description: Role type, set by the app that created the role, for example `"plan"` for roles created by Wix Pricing Plans. Empty for roles created on the site.  | validation: maxLength 50
     - name: _createdDate | type: Date | description: Date and time the role was created.  | read-only: true 
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code:  | Description: The `type` value is reserved, or `paging.cursor` isn't a cursor returned by a previous call.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code:  | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions. Site members can specify `"plan"` as `type` and no other value.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code:  | Description: The method was called without a logged-in site member. Call it on behalf of a logged-in site member.


```

### Examples

### List the logged-in member's pricing plan groups
Check whether a returned group ID matches the ID of the plan the member bought.

```javascript
import { accessGroups } from "@wix/members-access";

async function listCurrentMemberGroups() {
  const response = await accessGroups.listCurrentMemberGroups("plan", {
    paging: { limit: 50 },
  });
}

/* Promise resolves to:
 * {
 *   "groups": [
 *     {
 *       "_id": "3e1f9a52-7c4d-4b8e-9f20-6a5d1c8b7e43",
 *       "title": "Gold Membership",
 *       "description": "Full access to all premium content.",
 *       "color": "YELLOW",
 *       "type": "plan",
 *       "_createdDate": "2024-03-12T09:15:42.000Z"
 *     }
 *   ],
 *   "pagingMetadata": {
 *     "count": 1,
 *     "hasNext": false
 *   }
 * }
 */

```

### listCurrentMemberGroups (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { accessGroups } from '@wix/members-access';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { accessGroups },
  // Include the auth strategy and host as relevant
});


async function listCurrentMemberGroups(type,options) {
  const response = await myWixClient.accessGroups.listCurrentMemberGroups(type,options);
};
```

---