> 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 # CreateInvite # Package: accounts # Namespace: AccountInvitesApi # Method link: https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/account-invites/create-invite.md ## Permission Scopes: Manage Team Members: SCOPE.IDENTITY.MANAGE-TEAM-MEMBERS ## Introduction Creates and sends invite emails to a list of potential team members, inviting them to become team members of the requesting account. The invites may be limited to a specific resource (site or other asset). Maximum 50 invitees can be specified per call. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. --- ## REST API ### Schema ``` Method: createInvite Description: Creates and sends invite emails to a list of potential team members, inviting them to become team members of the requesting account. The invites may be limited to a specific resource (site or other asset). Maximum 50 invitees can be specified per call. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. URL: https://www.wixapis.com/invites/account-invite/create Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: subjectsAssignments Method parameters: param name: defaultEmailLanguage | type: defaultEmailLanguage | description: Language of emails to send. Relevant only for recipients that don't currently have a Wix user GUID. Default: Site owner's language. param name: subjectsAssignments | type: array | description: Array of potential team members' email addresses and their corresponding assignments (how they will be assigned when they accept the invite). | required: true - name: subjectEmail | type: string | description: Invitee's email address. - name: assignments | type: array | description: Mapping of roles (referred to here as policies) and assets (referred to here as resources) that will be assigned to the invitee when they accept the invite. When no resources are specified, the invitee will be given access to everything within the account. - name: policyId | type: string | description: Role GUID. - name: assignments | type: array | description: Resources the user will be able to access. - name: fullNameResource | type: FullNameResource | description: Full name of resource to be assigned. - ONE-OF: - name: siteContext | type: SiteResourceContext | description: Specific site details. - name: metasiteId | type: string | description: Site GUID. - name: accountContext | type: AccountResourceContext | description: Specific account details. - name: accountId | type: string | description: Account GUID. Return type: CreateInviteResponse - name: successfulInvites | type: array | description: Invites that were sent successfully. - name: id | type: string | description: Invite GUID. - name: accountId | type: string | description: Account GUID. - name: email | type: string | description: Email address where the invite was sent. - name: status | type: InviteStatus | description: Invite status. Supported values: - **Pending:** The invite has been sent and is valid, waiting for the user's response. - **Used:** The invite has been accepted. - **Deleted:** The invite has been deleted or revoked. - **Declined:** The user has declined the invite. - **Expired:** The invite has expired without being accepted. - enum: Pending, Used, Deleted, Declined, Expired - name: acceptLink | type: string | description: Link to accept the invite. - name: inviterAccountId | type: string | description: Inviting account GUID. - name: acceptedByAccountId | type: string | description: Account GUID that accepted the invite. Populated only once the invite is accepted. - name: dateCreated | type: string | description: Date the invite was created. - name: policyIds | type: array | description: Role GUIDs included in the invite. - name: dateUpdated | type: string | description: Date the invite was last updated. - name: assignments | type: array | description: Assets the users are invited to join. - name: policyId | type: string | description: Role GUID. - name: assignments | type: array | description: Resources the user will be able to access. - name: fullNameResource | type: FullNameResource | description: Full name of resource to be assigned. - ONE-OF: - name: siteContext | type: SiteResourceContext | description: Specific site details. - name: metasiteId | type: string | description: Site GUID. - name: accountContext | type: AccountResourceContext | description: Specific account details. - name: accountId | type: string | description: Account GUID. - name: expirationDate | type: string | description: Invite expiration date. - name: failedInvites | type: array | description: Invites that failed. - name: subjectEmail | type: string | description: Email address of the failed invite. - name: errorMessage | type: string | description: Error description. ``` ### Examples ### Invite team member to account ```curl curl -X POST \ 'https://www.wixapis.com/invites/account-invite/create' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "subjectsAssignments": [ { "assignments": [ { "policyId": "6600344420111308827", "assignments": [] } ], "subjectEmail": "some@email.com" } ], }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.accounts.AccountInvitesApi.createInvite(subjectsAssignments, options) Description: Creates and sends invite emails to a list of potential team members, inviting them to become team members of the requesting account. The invites may be limited to a specific resource (site or other asset). Maximum 50 invitees can be specified per call. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: subjectsAssignments Method parameters: param name: options | type: CreateInviteOptions none - name: defaultEmailLanguage | type: string | description: Language of emails to send. Relevant only for recipients that don't currently have a Wix user GUID. Default: Site owner's language. param name: subjectsAssignments | type: array | description: Array of potential team members' email addresses and their corresponding assignments (how they will be assigned when they accept the invite). | required: true - name: subjectEmail | type: string | description: Invitee's email address. - name: assignments | type: array | description: Mapping of roles (referred to here as policies) and assets (referred to here as resources) that will be assigned to the invitee when they accept the invite. When no resources are specified, the invitee will be given access to everything within the account. - name: policyId | type: string | description: Role GUID. - name: assignments | type: array | description: Resources the user will be able to access. - name: fullNameResource | type: FullNameResource | description: Full name of resource to be assigned. - ONE-OF: - name: siteContext | type: SiteResourceContext | description: Specific site details. - name: metasiteId | type: string | description: Site GUID. - name: accountContext | type: AccountResourceContext | description: Specific account details. - name: accountId | type: string | description: Account GUID. Return type: PROMISE - name: successfulInvites | type: array | description: Invites that were sent successfully. - name: _id | type: string | description: Invite GUID. - name: accountId | type: string | description: Account GUID. - name: email | type: string | description: Email address where the invite was sent. - name: status | type: InviteStatus | description: Invite status. Supported values: - **Pending:** The invite has been sent and is valid, waiting for the user's response. - **Used:** The invite has been accepted. - **Deleted:** The invite has been deleted or revoked. - **Declined:** The user has declined the invite. - **Expired:** The invite has expired without being accepted. - enum: Pending, Used, Deleted, Declined, Expired - name: acceptLink | type: string | description: Link to accept the invite. - name: inviterAccountId | type: string | description: Inviting account GUID. - name: acceptedByAccountId | type: string | description: Account GUID that accepted the invite. Populated only once the invite is accepted. - name: dateCreated | type: Date | description: Date the invite was created. - name: policyIds | type: array | description: Role GUIDs included in the invite. - name: dateUpdated | type: Date | description: Date the invite was last updated. - name: assignments | type: array | description: Assets the users are invited to join. - name: policyId | type: string | description: Role GUID. - name: assignments | type: array | description: Resources the user will be able to access. - name: fullNameResource | type: FullNameResource | description: Full name of resource to be assigned. - ONE-OF: - name: siteContext | type: SiteResourceContext | description: Specific site details. - name: metasiteId | type: string | description: Site GUID. - name: accountContext | type: AccountResourceContext | description: Specific account details. - name: accountId | type: string | description: Account GUID. - name: expirationDate | type: Date | description: Invite expiration date. - name: failedInvites | type: array | description: Invites that failed. - name: subjectEmail | type: string | description: Email address of the failed invite. - name: errorMessage | type: string | description: Error description. ``` ### Examples ### Create and send account invites in bulk with an API key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { accountInvites } from "@wix/user-management"; const wixClient = createClient({ modules: { accountInvites }, auth: ApiKeyStrategy({ apiKey: "MY-API-KEY", }), }); async function createInvite(subjectsAssignments, options) { const response = await accountInvites.createInvite( subjectsAssignments, options, ); } ``` ### createInvite (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 { accountInvites } from '@wix/user-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { accountInvites }, // Include the auth strategy and host as relevant }); async function createInvite(subjectsAssignments,options) { const response = await myWixClient.accountInvites.createInvite(subjectsAssignments,options); }; ``` ---