> 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 # createAccount # Package: accounts # Namespace: AccountService # Method link: https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/accounts/create-account.md ## Introduction Creates a new Wix account, and creates a new Wix user as the account owner. The newly created account is a child account of the account used to create it, making that account its parent. > **Important**: This call requires an account level API key. --- ## REST API ### Schema ``` Method: createAccount Description: Creates a new Wix account, and creates a new Wix user as the account owner. The newly created account is a child account of the account used to create it, making that account its parent. > **Important**: This call requires an account level API key. URL: https://www.wixapis.com/accounts/v1/accounts/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: user Method parameters: param name: roles | type: array | description: Roles to be assigned to the user in the new account. To retrieve all available roles, call Get Roles Info in the Users API. Default: OWNER. param name: user | type: User | description: A User to be created under an implicitly provided accountId: must have a unique email. | required: true - name: email | type: Email | description: User's unique email address details. Required. - name: emailAddress | type: string | description: User's email address. - name: isVerified | type: boolean | description: Whether the caller has verified the user's email address. - name: ssoIdentities | type: array | description: User's single sign on identity, when the user is identified via SSO authentication response token params, as specified by [OpenGUID Connect](https://openid.net/developers/how-connect-works/) (aka. OIDC) protocol. - name: ssoId | type: string | description: An SSO setting (URLs, clientId, secret, etc. as required by OIDC protocol) for a specific Identity-Provider (aka. IdP) for a specific Wix account. - name: userId | type: string | description: User GUID as stored in IdP. For example a "sub" claim of OIDC protocol, or any other alternative, specified by IdP (Identity Provider). - name: userDetails | type: UserDetails | description: Additional user details. - name: firstName | type: string | description: User's first name. - name: lastName | type: string | description: User's last name. - name: profilePictureUrl | type: string | description: URL to location of user's profile picture. - name: language | type: string | description: User's preferred language in [ISO 639-1:2002](https://en.wikipedia.org/wiki/ISO_639-1) format. For example, "en", "es". - name: clientIp | type: string | description: Original Client IP from which a request was made. This is useful in case where a createUser API is called by some server call, which, in turn, has been called by some client from another IP. Wix checks this IP against the [OFAC sanctioned countries](https://ofac.treasury.gov/sanctions-programs-and-country-information). - name: contactEmail | type: string | description: if defined then emails to the user will be sent to this email instead of the user's primary email Return type: CreateAccountResponse - name: account | type: AccountV2 | description: The created account. - name: accountId | type: string | description: Account GUID. - name: user | type: UserV2 | description: The created user - name: userId | type: string | description: User GUID ``` ### Examples ### Create an account ```curl curl -X POST \ 'https://www.wixapis.com/accounts/v1/accounts/create' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "roles": [ "6600344420111308827" ], "user": { "sso_identities": [ { "sso_id": "", "user_id": "" } ], "email": { "is_verified": true, "email_address": "some@email.com" }, "userDetails": { "first_name": "First", "last_name": "Name", "profile_picture_url": "http://picture.com/pic.jpg", "client_ip": "127.0.0.1", "language": "en" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.accounts.AccountService.createAccount(user, options) Description: Creates a new Wix account, and creates a new Wix user as the account owner. The newly created account is a child account of the account used to create it, making that account its parent. > **Important**: This call requires an account level API key. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: user Method parameters: param name: options | type: createAccountOptions none - name: roles | type: array | description: Roles to be assigned to the user in the new account. To retrieve all available roles, call Get Roles Info in the Users API. Default: OWNER. param name: user | type: User | description: A User to be created under an implicitly provided accountId: must have a unique email. | required: true - name: email | type: Email | description: User's unique email address details. Required. - name: emailAddress | type: string | description: User's email address. - name: isVerified | type: boolean | description: Whether the caller has verified the user's email address. - name: ssoIdentities | type: array | description: User's single sign on identity, when the user is identified via SSO authentication response token params, as specified by [OpenGUID Connect](https://openid.net/developers/how-connect-works/) (aka. OIDC) protocol. - name: ssoId | type: string | description: An SSO setting (URLs, clientId, secret, etc. as required by OIDC protocol) for a specific Identity-Provider (aka. IdP) for a specific Wix account. - name: userId | type: string | description: User GUID as stored in IdP. For example a "sub" claim of OIDC protocol, or any other alternative, specified by IdP (Identity Provider). - name: userDetails | type: UserDetails | description: Additional user details. - name: firstName | type: string | description: User's first name. - name: lastName | type: string | description: User's last name. - name: profilePictureUrl | type: string | description: URL to location of user's profile picture. - name: language | type: string | description: User's preferred language in [ISO 639-1:2002](https://en.wikipedia.org/wiki/ISO_639-1) format. For example, "en", "es". - name: clientIp | type: string | description: Original Client IP from which a request was made. This is useful in case where a createUser API is called by some server call, which, in turn, has been called by some client from another IP. Wix checks this IP against the [OFAC sanctioned countries](https://ofac.treasury.gov/sanctions-programs-and-country-information). - name: contactEmail | type: string | description: if defined then emails to the user will be sent to this email instead of the user's primary email Return type: PROMISE - name: account | type: AccountV2 | description: The created account. - name: accountId | type: string | description: Account GUID. - name: user | type: UserV2 | description: The created user - name: userId | type: string | description: User GUID ``` ### Examples ### createAccount ```javascript import { accounts } from '@wix/user-management'; async function createAccount(user,options) { const response = await accounts.createAccount(user,options); }; ``` ### createAccount (with elevated permissions) ```javascript import { accounts } from '@wix/user-management'; import { auth } from '@wix/essentials'; async function myCreateAccountMethod(user,options) { const elevatedCreateAccount = auth.elevate(accounts.createAccount); const response = await elevatedCreateAccount(user,options); } ``` ### createAccount (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 { accounts } from '@wix/user-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { accounts }, // Include the auth strategy and host as relevant }); async function createAccount(user,options) { const response = await myWixClient.accounts.createAccount(user,options); }; ``` ---