> 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

# CreateAppInviteProxy

# Package: appInvites

# Namespace: AppInvitesProxyService

# Method link: https://dev.wix.com/docs/api-reference/app-management/app-invites/create-app-invite-proxy.md

## Introduction

Creates a pending invitation and emails it to the recipient.


Provide the app ID, recipient email, and Identity role IDs in `invite.policyIds`.
As with site invitations, policy IDs are role IDs, not assignment IDs.
See [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md)
for role discovery. Select roles applicable to app access, not unrelated site roles.
Requires a signed-in user with account context.
Returns the invitation and its acceptance link. Accepting the invitation assigns the selected roles.
Fails if an active invitation already exists for this app and email, or a policy ID is invalid.

---

## REST API

### Schema

```
 Method: createAppInviteProxy
 Description: Creates a pending invitation and emails it to the recipient.   Provide the app GUID, recipient email, and Identity role GUIDs in `invite.policyIds`. As with site invitations, policy GUIDs are role GUIDs, not assignment GUIDs. See [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md) for role discovery. Select roles applicable to app access, not unrelated site roles. Requires a signed-in user with account context. Returns the invitation and its acceptance link. Accepting the invitation assigns the selected roles. Fails if an active invitation already exists for this app and email, or a policy GUID is invalid.
 URL: https://www.wixapis.com/apps/v1/apps/invites
 Method: POST
 Method parameters:
   param name: invite | type: AppInvite    
        - name: appId | type: string | description:   | validation: format GUID
        - name: policyIds | type: array<string> | description:   | validation: minItems 1, maxItems 10, minLength 1, maxLength 25
        - name: destEmail | type: string | description:   | validation: format EMAIL
        - name: brandDomain | type: string | description:   | validation: maxLength 50
        - name: invitePurpose | type: string | description:   | validation: maxLength 50
 Return type: CreateAppInviteProxyResponse
  - name: invite | type: AppWebInvite | description: Created invitation, including its details and acceptance link.  
     - name: id | type: string | description:   | read-only: true | validation: format GUID
     - name: inviteData | type: AppInvite | description:   | read-only: true 
        - name: id | type: string | description:   | read-only: true | validation: format GUID
        - name: appId | type: string | description:   | validation: format GUID
        - name: appName | type: string | description:   | read-only: true | validation: maxLength 100
        - name: policyIds | type: array<string> | description:   | validation: minItems 1, maxItems 10, minLength 1, maxLength 25
        - name: givenByUserId | type: string | description:   | read-only: true | validation: format GUID
        - name: givenByAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: invitedToAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: acceptedBy | type: string | description:   | read-only: true | validation: format GUID
        - name: acceptedByAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: destEmail | type: string | description:   | validation: format EMAIL
        - name: status | type: string | description:   | read-only: true | validation: maxLength 20
        - name: brandDomain | type: string | description:   | validation: maxLength 50
        - name: invitePurpose | type: string | description:   | validation: maxLength 50
        - name: expirationDate | type: string | description:   | read-only: true | validation: format date-time
        - name: dateCreated | type: string | description:   | read-only: true | validation: format date-time
        - name: dateUpdated | type: string | description:   | read-only: true | validation: format date-time
     - name: acceptLink | type: string | description:   | read-only: true | validation: format WEB_URL


```

### Examples

### Invite an app collaborator
Use signed-in user authentication with account context. Replace the fictional policy ID with an Identity role ID applicable to app access. Creating an invitation sends email; this example was not executed and its response is representative.

```curl
curl -X POST \
'https://www.wixapis.com/apps/v1/apps/invites' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "invite": {
    "appId": "da630f88-1b48-473e-a6a1-d71960c413fb",
    "destEmail": "jane.doe@example.com",
    "policyIds": ["app-collaborator-role"]
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.appManagement.appInvitesProxy.createAppInviteProxy(options)
 Description: Creates a pending invitation and emails it to the recipient.   Provide the app GUID, recipient email, and Identity role GUIDs in `invite.policyIds`. As with site invitations, policy GUIDs are role GUIDs, not assignment GUIDs. See [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md) for role discovery. Select roles applicable to app access, not unrelated site roles. Requires a signed-in user with account context. Returns the invitation and its acceptance link. Accepting the invitation assigns the selected roles. Fails if an active invitation already exists for this app and email, or a policy GUID is invalid.
 Method parameters:
   param name: options | type: CreateAppInviteProxyOptions  none  
        - name: invite | type: AppInvite | description: Invitation details. Set `appId`, `destEmail`, and `policyIds` (Identity role GUIDs); omit read-only fields.  
           - name: appId | type: string | description:   | validation: format GUID
           - name: policyIds | type: array<string> | description:   | validation: minItems 1, maxItems 10, minLength 1, maxLength 25
           - name: destEmail | type: string | description:   | validation: format EMAIL
           - name: brandDomain | type: string | description:   | validation: maxLength 50
           - name: invitePurpose | type: string | description:   | validation: maxLength 50
 Return type: PROMISE<CreateAppInviteProxyResponse>
  - name: invite | type: AppWebInvite | description: Created invitation, including its details and acceptance link.  
     - name: _id | type: string | description:   | read-only: true | validation: format GUID
     - name: inviteData | type: AppInvite | description:   | read-only: true 
        - name: _id | type: string | description:   | read-only: true | validation: format GUID
        - name: appId | type: string | description:   | validation: format GUID
        - name: appName | type: string | description:   | read-only: true | validation: maxLength 100
        - name: policyIds | type: array<string> | description:   | validation: minItems 1, maxItems 10, minLength 1, maxLength 25
        - name: givenByUserId | type: string | description:   | read-only: true | validation: format GUID
        - name: givenByAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: invitedToAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: acceptedBy | type: string | description:   | read-only: true | validation: format GUID
        - name: acceptedByAccountId | type: string | description:   | read-only: true | validation: format GUID
        - name: destEmail | type: string | description:   | validation: format EMAIL
        - name: status | type: string | description:   | read-only: true | validation: maxLength 20
        - name: brandDomain | type: string | description:   | validation: maxLength 50
        - name: invitePurpose | type: string | description:   | validation: maxLength 50
        - name: expirationDate | type: Date | description:   | read-only: true 
        - name: dateCreated | type: Date | description:   | read-only: true 
        - name: dateUpdated | type: Date | description:   | read-only: true 
     - name: acceptLink | type: string | description:   | read-only: true | validation: format WEB_URL


```

### Examples

### createAppInviteProxy
```javascript
import { appInvitesProxy } from '@wix/app-management';

async function createAppInviteProxy(options) {
  const response = await appInvitesProxy.createAppInviteProxy(options);
};
```

### createAppInviteProxy (with elevated permissions)
```javascript
import { appInvitesProxy } from '@wix/app-management';
import { auth } from '@wix/essentials';

async function myCreateAppInviteProxyMethod(options) {
  const elevatedCreateAppInviteProxy = auth.elevate(appInvitesProxy.createAppInviteProxy);
  const response = await elevatedCreateAppInviteProxy(options);
}
```

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

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


async function createAppInviteProxy(options) {
  const response = await myWixClient.appInvitesProxy.createAppInviteProxy(options);
};
```

---