> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# RetrieveUsersByDomain

# Package: businessEmail

# Namespace: GoogleSubscriptions

# Method link: https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/retrieve-users-by-domain.md

## Permission Scopes:
Read Business Email: SCOPE.ACC-DC-PREMIUM.READ-MAILBOXES

## Introduction

Retrieves the users of the Google Workspace on a domain owned by the caller's account.

Returns all users, including administrators, up to 300 users. Additional users aren't returned, and the method doesn't support paging.

---

## REST API

### Schema

```
 Method: retrieveUsersByDomain
 Description: Retrieves the users of the Google Workspace on a domain owned by the caller's account.  Returns all users, including administrators, up to 300 users. Additional users aren't returned, and the method doesn't support paging.
 URL: https://www.wixapis.com/google-subscriptions/v1/google-subscriptions/retrieve-users/{domainName}
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  domainName
 Method parameters: 
   param name: domainName | type:   none | required: true 
 Return type: RetrieveUsersByDomainResponse
  - name: users | type: array<User> | description: Retrieved users.  Limited to 300 users.  
     - name: id | type: string | description: Google user GUID.  | validation: minLength 1, maxLength 36
     - name: primaryEmail | type: string | description: User's primary email address. For example, `jane@my-domain.com`.  | validation: format EMAIL
     - name: name | type: UserName | description: User's name.  
        - name: givenName | type: string | description: User's given name (first name).  | validation: maxLength 60
        - name: familyName | type: string | description: User's family name (last name).  | validation: maxLength 60
        - name: fullName | type: string | description: User's full name. Calculated from `givenName` and `familyName`.  | read-only: true | validation: maxLength 120
     - name: admin | type: boolean | description: Whether the user is a super administrator of the Google Workspace.  
     - name: delegatedAdmin | type: boolean | description: Whether the user is a delegated administrator of the Google Workspace, with a subset of administrator privileges.  
     - name: customerId | type: string | description: Google customer GUID of the Google Workspace the user belongs to.  | validation: minLength 1, maxLength 36
     - name: googleVoiceNumber | type: string | description: User's Google Voice phone number.  Returned only when the user has a Google Voice number.  | validation: maxLength 20
     - name: licensedProductTypeIds | type: array<string> | description: Product type GUIDs of the products licensed to the user, such as Business Email or the Google Voice add-on.  Not returned by [Retrieve Users by Domain](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/retrieve-users-by-domain.md).  | validation: maxItems 20, format GUID
     - name: recoveryEmail | type: string | description: Recovery email address Google uses to verify the user when they can't sign in.  | validation: maxLength 255
     - name: recoveryPhone | type: string | description: Recovery phone number Google uses to verify the user when they can't sign in, in [E.164](https://en.wikipedia.org/wiki/E.164) format. For example, `+12025550123`.  | validation: maxLength 20


```

### Examples

### Retrieve the users on a domain
Retrieves the users of the Google Workspace on a domain owned by the caller's account.

```curl
curl -X GET \
'https://www.wixapis.com/google-subscriptions/v1/google-subscriptions/retrieve-users/my-domain.com' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.premium.googleSubscriptions.retrieveUsersByDomain(domainName)
 Description: Retrieves the users of the Google Workspace on a domain owned by the caller's account.  Returns all users, including administrators, up to 300 users. Additional users aren't returned, and the method doesn't support paging.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  domainName
 Method parameters: 
   param name: domainName | type: string | description: Domain whose Google Workspace users to retrieve. Must be a domain the caller's account owns. | required: true | validation: format HOSTNAME
 Return type: PROMISE<RetrieveUsersByDomainResponse>
  - name: users | type: array<User> | description: Retrieved users.  Limited to 300 users.  
     - name: _id | type: string | description: Google user GUID.  | validation: minLength 1, maxLength 36
     - name: primaryEmail | type: string | description: User's primary email address. For example, `jane@my-domain.com`.  | validation: format EMAIL
     - name: name | type: UserName | description: User's name.  
        - name: givenName | type: string | description: User's given name (first name).  | validation: maxLength 60
        - name: familyName | type: string | description: User's family name (last name).  | validation: maxLength 60
        - name: fullName | type: string | description: User's full name. Calculated from `givenName` and `familyName`.  | read-only: true | validation: maxLength 120
     - name: admin | type: boolean | description: Whether the user is a super administrator of the Google Workspace.  
     - name: delegatedAdmin | type: boolean | description: Whether the user is a delegated administrator of the Google Workspace, with a subset of administrator privileges.  
     - name: customerId | type: string | description: Google customer GUID of the Google Workspace the user belongs to.  | validation: minLength 1, maxLength 36
     - name: googleVoiceNumber | type: string | description: User's Google Voice phone number.  Returned only when the user has a Google Voice number.  | validation: maxLength 20
     - name: licensedProductTypeIds | type: array<string> | description: Product type GUIDs of the products licensed to the user, such as Business Email or the Google Voice add-on.  Not returned by [Retrieve Users by Domain](https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-subscription-v1/retrieve-users-by-domain.md).  | validation: maxItems 20, format GUID
     - name: recoveryEmail | type: string | description: Recovery email address Google uses to verify the user when they can't sign in.  | validation: maxLength 255
     - name: recoveryPhone | type: string | description: Recovery phone number Google uses to verify the user when they can't sign in, in [E.164](https://en.wikipedia.org/wiki/E.164) format. For example, `+12025550123`.  | validation: maxLength 20


```

### Examples

### Retrieve the users on a domain
Retrieves the users of the Google Workspace on a domain owned by the caller's account.

```javascript
import { googleSubscriptions } from "@wix/premium";

async function retrieveUsersByDomain() {
  const response = await googleSubscriptions.retrieveUsersByDomain("my-domain.com");
}

/* Promise resolves to:
 * {
 *   "users": [
 *     {
 *       "_id": "104827364519283746501",
 *       "primaryEmail": "jane@my-domain.com",
 *       "name": {
 *         "givenName": "Jane",
 *         "familyName": "Doe",
 *         "fullName": "Jane Doe"
 *       },
 *       "admin": true,
 *       "delegatedAdmin": false,
 *       "customerId": "C03k9f2xa",
 *       "recoveryEmail": "jane.doe@example.com",
 *       "recoveryPhone": "+12025550123"
 *     },
 *     {
 *       "_id": "117364829104736251984",
 *       "primaryEmail": "sales@my-domain.com",
 *       "name": {
 *         "givenName": "Sam",
 *         "familyName": "Lee",
 *         "fullName": "Sam Lee"
 *       },
 *       "admin": false,
 *       "delegatedAdmin": false,
 *       "customerId": "C03k9f2xa"
 *     }
 *   ]
 * }
 */

```

### retrieveUsersByDomain (self-hosted)
Self-hosted 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 { googleSubscriptions } from '@wix/premium';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function retrieveUsersByDomain(domainName) {
  const response = await myWixClient.googleSubscriptions.retrieveUsersByDomain(domainName);
};
```

---