> 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

# SetupAdministrator

# Package: businessEmail

# Namespace: GoogleUsers

# Method link: https://dev.wix.com/docs/api-reference/account-level/premium/business-email/google-user-v1/setup-administrator.md

## Permission Scopes:
Manage Business Email: SCOPE.ACC-DC-PREMIUM.MANAGE-MAILBOXES

## Introduction

Sets up the first administrator of a Google Workspace after it's purchased.

Creates the administrator's user account and saves the customer's contact details with Google.

---

## REST API

### Schema

```
 Method: setupAdministrator
 Description: Sets up the first administrator of a Google Workspace after it's purchased.  Creates the administrator's user account and saves the customer's contact details with Google.
 URL: https://www.wixapis.com/google-subscriptions/v1/google-users/setup-administrator
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  googleWorkspacePremiumId, googleWorkspaceUserInfo, googleWorkspaceUserInfo.userName, googleWorkspaceUserInfo.firstName, googleWorkspaceUserInfo.lastName, googleWorkspaceUserInfo.password, googleWorkspaceAdminContactInfo, googleWorkspaceAdminContactInfo.alternateEmail, googleWorkspaceAdminContactInfo.contactName, googleWorkspaceAdminContactInfo.organizationName, googleWorkspaceAdminContactInfo.countryCode
 Method parameters: 
   param name: googleWorkspaceAdminContactInfo | type: GoogleWorkspaceAdminContactInfo   | required: true 
        - name: alternateEmail | type: string | description: Customer's secondary contact email address. | required: true | validation: format EMAIL
        - name: contactName | type: string | description: Name of the customer's contact person. | required: true | validation: minLength 1, maxLength 255
        - name: organizationName | type: string | description: Name of the customer's organization or division. | required: true | validation: minLength 1, maxLength 255
        - name: countryCode | type: string | description: Country of the customer's address, as a 2-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. | required: true | validation: format COUNTRY
        - name: postalCode | type: string | description: Postal code of the customer's address.  Can be empty, because some countries, such as Ireland and the United Arab Emirates, don't use postal codes.  | validation: maxLength 16
        - name: phoneNumber | type: string | description: Customer's contact phone number.  | validation: format PHONE
        - name: state | type: string | description: State or province of the customer's address.  | validation: maxLength 255
        - name: city | type: string | description: City of the customer's address.  | validation: maxLength 255
        - name: addressLine | type: string | description: Street address of the customer's address.  | validation: maxLength 255
   param name: googleWorkspacePremiumId | type: googleWorkspacePremiumId | description: Premium subscription GUID of the Google Workspace to set up. | required: true | validation: format GUID
   param name: googleWorkspaceUserInfo | type: GoogleWorkspaceUserInfo   | required: true 
        - name: userName | type: string | description: Part of the user's primary email address before the `@`. Combined with the Google Workspace's domain to form the email address. For example, `jane` for `jane@my-domain.com`. | required: true | validation: minLength 1, maxLength 255
        - name: firstName | type: string | description: User's given name (first name). | required: true | validation: minLength 1, maxLength 60
        - name: lastName | type: string | description: User's family name (last name). | required: true | validation: minLength 1, maxLength 60
        - name: password | type: string | description: User's account password. Google may reject passwords it considers weak. | required: true | validation: minLength 8, maxLength 100
   param name: workspaceLanguage | type: workspaceLanguage | description: Default language of the Google Workspace. 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.  Default: `en`  | validation: format LANGUAGE
 Return type: SetupAdministratorResponse
  - name: userName | type: UserName | description: Administrator'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: primaryEmail | type: string | description: Administrator's primary email address. For example, `admin@my-domain.com`.  | validation: format EMAIL

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UPDATE_CUSTOMER_FAIL_INVALID_ORGANIZATION_ADDRESS | Description: Google rejected the organization address.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UPDATE_CUSTOMER_FAIL_INVALID_POSTAL_CODE | Description: `postalCode` isn't valid for the specified country.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_FAMILY_NAME | Description: `lastName` isn't valid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_GIVEN_NAME | Description: `firstName` isn't valid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_PRIMARY_USER_EMAIL | Description: `userName` doesn't form a valid email address.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_PASSWORD | Description: Google rejected the password. Specify a stronger password.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GWS_NOT_FOUND_FOR_SETUP_ADMINISTRATOR | Description: Couldn't find the Google Workspace.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: CREATE_USER_FAIL_USER_ALREADY_EXISTS | Description: There is already a user with this email address.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATE_CUSTOMER_FAIL_UNSUPPORTED_REGION | Description: Google Workspace isn't available in the specified country or region.


```

### Examples

### Set up a Google Workspace's first administrator
Creates the administrator account for a newly purchased Business Email and saves the customer's contact details.

```curl
curl -X POST \
'https://www.wixapis.com/google-subscriptions/v1/google-users/setup-administrator' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "googleWorkspacePremiumId": "3f8c1d2e-7a4b-4c9e-b1d5-6e2f0a9c8b74",
  "googleWorkspaceUserInfo": {
    "userName": "jane",
    "firstName": "Jane",
    "lastName": "Doe",
    "password": "Lk9#vT2q!mR8"
  },
  "googleWorkspaceAdminContactInfo": {
    "alternateEmail": "jane.doe@example.com",
    "contactName": "Jane Doe",
    "organizationName": "Doe Design Studio",
    "countryCode": "US",
    "postalCode": "10001",
    "phoneNumber": "+12025550123",
    "state": "NY",
    "city": "New York",
    "addressLine": "350 5th Avenue"
  },
  "workspaceLanguage": "en"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.premium.googleUsers.setupAdministrator(googleWorkspacePremiumId, options)
 Description: Sets up the first administrator of a Google Workspace after it's purchased.  Creates the administrator's user account and saves the customer's contact details with Google.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  googleWorkspacePremiumId, options.googleWorkspaceUserInfo, options.googleWorkspaceUserInfo.userName, options.googleWorkspaceUserInfo.firstName, options.googleWorkspaceUserInfo.lastName, options.googleWorkspaceUserInfo.password, options.googleWorkspaceAdminContactInfo, options.googleWorkspaceAdminContactInfo.alternateEmail, options.googleWorkspaceAdminContactInfo.contactName, options.googleWorkspaceAdminContactInfo.organizationName, options.googleWorkspaceAdminContactInfo.countryCode, options
 Method parameters: 
   param name: googleWorkspacePremiumId | type: string | description: Premium subscription GUID of the Google Workspace to set up. | required: true | validation: format GUID
   param name: options | type: SetupAdministratorOptions  none | required: true 
        - name: googleWorkspaceUserInfo | type: GoogleWorkspaceUserInfo | description: Administrator's user account details. | required: true 
           - name: userName | type: string | description: Part of the user's primary email address before the `@`. Combined with the Google Workspace's domain to form the email address. For example, `jane` for `jane@my-domain.com`. | required: true | validation: minLength 1, maxLength 255
           - name: firstName | type: string | description: User's given name (first name). | required: true | validation: minLength 1, maxLength 60
           - name: lastName | type: string | description: User's family name (last name). | required: true | validation: minLength 1, maxLength 60
           - name: password | type: string | description: User's account password. Google may reject passwords it considers weak. | required: true | validation: minLength 8, maxLength 100
        - name: googleWorkspaceAdminContactInfo | type: GoogleWorkspaceAdminContactInfo | description: Customer's contact details, saved with Google for the Google Workspace. | required: true 
           - name: alternateEmail | type: string | description: Customer's secondary contact email address. | required: true | validation: format EMAIL
           - name: contactName | type: string | description: Name of the customer's contact person. | required: true | validation: minLength 1, maxLength 255
           - name: organizationName | type: string | description: Name of the customer's organization or division. | required: true | validation: minLength 1, maxLength 255
           - name: countryCode | type: string | description: Country of the customer's address, as a 2-letter country code in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. | required: true | validation: format COUNTRY
           - name: postalCode | type: string | description: Postal code of the customer's address.  Can be empty, because some countries, such as Ireland and the United Arab Emirates, don't use postal codes.  | validation: maxLength 16
           - name: phoneNumber | type: string | description: Customer's contact phone number.  | validation: format PHONE
           - name: state | type: string | description: State or province of the customer's address.  | validation: maxLength 255
           - name: city | type: string | description: City of the customer's address.  | validation: maxLength 255
           - name: addressLine | type: string | description: Street address of the customer's address.  | validation: maxLength 255
        - name: workspaceLanguage | type: string | description: Default language of the Google Workspace. 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.  Default: `en`  | validation: format LANGUAGE
 Return type: PROMISE<SetupAdministratorResponse>
  - name: userName | type: UserName | description: Administrator'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: primaryEmail | type: string | description: Administrator's primary email address. For example, `admin@my-domain.com`.  | validation: format EMAIL

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UPDATE_CUSTOMER_FAIL_INVALID_ORGANIZATION_ADDRESS | Description: Google rejected the organization address.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UPDATE_CUSTOMER_FAIL_INVALID_POSTAL_CODE | Description: `postalCode` isn't valid for the specified country.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_FAMILY_NAME | Description: `lastName` isn't valid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_GIVEN_NAME | Description: `firstName` isn't valid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_PRIMARY_USER_EMAIL | Description: `userName` doesn't form a valid email address.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CREATE_USER_FAIL_INVALID_PASSWORD | Description: Google rejected the password. Specify a stronger password.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GWS_NOT_FOUND_FOR_SETUP_ADMINISTRATOR | Description: Couldn't find the Google Workspace.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: CREATE_USER_FAIL_USER_ALREADY_EXISTS | Description: There is already a user with this email address.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATE_CUSTOMER_FAIL_UNSUPPORTED_REGION | Description: Google Workspace isn't available in the specified country or region.


```

### Examples

### Set up a Google Workspace's first administrator
Creates the administrator account for a newly purchased Business Email and saves the customer's contact details.

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

async function setupAdministrator() {
  const response = await googleUsers.setupAdministrator(
    "3f8c1d2e-7a4b-4c9e-b1d5-6e2f0a9c8b74",
    {
      googleWorkspaceUserInfo: {
        userName: "jane",
        firstName: "Jane",
        lastName: "Doe",
        password: "Lk9#vT2q!mR8",
      },
      googleWorkspaceAdminContactInfo: {
        alternateEmail: "jane.doe@example.com",
        contactName: "Jane Doe",
        organizationName: "Doe Design Studio",
        countryCode: "US",
        postalCode: "10001",
        phoneNumber: "+12025550123",
        state: "NY",
        city: "New York",
        addressLine: "350 5th Avenue",
      },
      workspaceLanguage: "en",
    },
  );
}

/* Promise resolves to:
 * {
 *   "userName": {
 *     "givenName": "Jane",
 *     "familyName": "Doe",
 *     "fullName": "Jane Doe"
 *   },
 *   "primaryEmail": "jane@my-domain.com"
 * }
 */

```

### setupAdministrator (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 { googleUsers } from '@wix/premium';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function setupAdministrator(googleWorkspacePremiumId,options) {
  const response = await myWixClient.googleUsers.setupAdministrator(googleWorkspacePremiumId,options);
};
```

---