> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# RegisterV2

# Package: headless

# Namespace: AuthenticationService

# Method link: https://dev.wix.com/docs/api-reference/business-management/headless/authentication/register-v-2?apiView=SDK.md

## Permission Scopes:
## Method Code Examples

--- Code Example: registerV2 ---

## Introduction

Registers a new member.

Typically, after a successful registration, you generate and use member tokens for the
registered member so that subsequent API calls are called as part of a member session.
Use the `sessionToken` in the response to [get the site member's access and refresh tokens](https://dev.wix.com/docs/go-headless/coding/rest-api/visitors-and-members/handle-members-with-custom-login.md#get-the-site-members-access-and-refresh-tokens).

If the email used to register the member already exists as a contact email, the registering
member need to verify the email address using a code that is sent to the address.

---

## REST API

### Schema

```
 Method: registerV2
 Description: Registers a new member.  Typically, after a successful registration, you generate and use member tokens for the registered member so that subsequent API calls are called as part of a member session. Use the `sessionToken` in the response to [get the site member's access and refresh tokens](https://dev.wix.com/docs/go-headless/coding/rest-api/visitors-and-members/handle-members-with-custom-login.md#get-the-site-members-access-and-refresh-tokens).  If the email used to register the member already exists as a contact email, the registering member need to verify the email address using a code that is sent to the address.
 URL: https://www.wixapis.com/_api/iam/authentication/v2/register
 Method: POST
 Method parameters:
   param name: captchaTokens | type: array<captchaTokens> | description: CAPTCHA tokens, when CAPTCHA setting is on.  
              - ONE-OF: 
                 - name: Recaptcha | type: string | description:   | validation: maxLength 5000
                 - name: InvisibleRecaptcha | type: string | description:   | validation: maxLength 5000
                 - name: NoCaptcha | type: string | description:   | validation: maxLength 5000
                 - name: recaptchaForClientSiteKey | type: RecaptchaForClientSiteKey | description: Use this when the client has registered their own reCAPTCHA site key (e.g., branded apps, headless apps).  
                    - name: token | type: string | description: The reCAPTCHA token obtained from the client-side reCAPTCHA widget. Local safety limit; Google does not define a maximum token size. Mobile SDK tokens can exceed 5000 characters and must be forwarded unchanged.  | validation: maxLength 65536
                    - name: siteKeyId | type: string | description: The site key GUID registered in ReCAPTCHA service SDL for this client's reCAPTCHA configuration.  | validation: format GUID
                 - name: hcaptcha | type: string | description: Passive hCaptcha token minted by the client's invisible hCaptcha widget, sent in addition to a reCAPTCHA token. Only observed, never decides the request: a request carrying only this token still fails as missing a CAPTCHA token. Single use, expires 120 seconds after minting. Local safety limit; hCaptcha does not define a maximum token size.  | validation: maxLength 65536
   param name: clientMetaData | type: clientMetaData | description: Additional data that's relevant for the flow.  
   param name: factorType | type: FactorType    
      - enum:
           PASSWORD - Requires a password.
           SMS - Requires a code sent via SMS.
           CALL - Requires a code sent by phone call.
           EMAIL - Requires a code sent by email.
           TOTP - Requires authentication via an authenticator app.
           PUSH - Requires authentication via a push notification.
           WEBAUTHN - Requires authentication via WebAuthn/passkey.
           RECOVERY_CODE - Requires a recovery code.
   param name: loginId | type: LoginId   | required: true 
     - name: email | type: string | description: Login email address.  | validation: format EMAIL
   param name: organization | type: Organization    
        - name: id | type: string | description: GUID of the organization. Required whenever `organization` is set.  | validation: format GUID
        - name: inviteCode | type: string | description: One-time registration invite code for this organization. Optional.  | validation: maxLength 500
   param name: password | type: password | description: Password of the registering member.  
   param name: profile | type: IdentityProfile    
        - name: firstName | type: string | description: Member's first name.  
        - name: lastName | type: string | description: Member's last name.  
        - name: nickname | type: string | description: Member's display nickname.  
        - name: picture | type: string | description: URL to member's profile picture.  
        - name: labels | type: array<string> | description: Labels associated with the member.  | validation: maxItems 2000
        - name: language | type: string | description: Member's preferred language code.  | validation: format LANGUAGE
        - name: privacyStatus | type: PrivacyStatus | description: Member's profile visibility setting.  
             - enum:
             -     UNDEFINED: No privacy status defined.
             -     PUBLIC: Profile details are visible to other members.
             -     PRIVATE: Profile details are hidden from other members.
        - name: customFields | type: array<CustomField> | description: Any number of custom fields. [Custom fields](https://support.wix.com/en/article/adding-custom-fields-to-contacts) are used to store additional information about your site or app's contacts.  
           - name: name | type: string | description: Custom field name matching an extended field key (without `custom.` prefix).  Must match a key from [`List Extended Fields`](https://dev.wix.com/docs/rest/api-reference/contacts/extended-fields/list-extended-fields.md).  
           - name: value | type: CustomValue | description: Value for the custom field.  
              - ONE-OF: 
                 - name: strValue | type: string | description: Text value.  
                 - name: numValue | type: number | description: Numeric value.  
                 - name: dateValue | type: string | description: Date/time value.  | validation: format date-time
                 - name: listValue | type: ListValue | description: List of values.  
                    - name: value | type: array<CustomValue> | description: List of custom values.  
                 - name: mapValue | type: MapValue | description: Key-value pairs.  
                    - name: value | type: Map<string,CustomValue> | description: Map of custom field values.  | validation: format map
                 - name: boolValue | type: boolean | description: Bool value  
        - name: secondaryEmails | type: array<SecondaryEmail> | description: Additional email addresses for the member.  
           - name: email | type: string | description: Secondary email address.  | validation: format EMAIL
           - name: tag | type: EmailTag | description: Email tag.  
                 - enum: UNTAGGED, MAIN, HOME, WORK
        - name: phonesV2 | type: array<Phone> | description: Phone numbers associated with the member.  
           - name: countryCode | type: string | description: Country code for the phone number.  | validation: format COUNTRY
           - name: phone | type: string | description: Phone number without country code.  | validation: format PHONE
           - name: tag | type: PhoneTag | description: Phone tag.  
                 - enum: UNTAGGED, MAIN, HOME, MOBILE, WORK, FAX
        - name: addresses | type: array<AddressWrapper> | description: Physical addresses for the member.  
           - name: address | type: Address | description: Physical address details.  
              - name: country | type: string | description: Country code.  | validation: format COUNTRY
              - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).  
              - name: city | type: string | description: City name.  
              - name: postalCode | type: string | description: Zip/postal code.  
              - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
              - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apartment, suite, and floor.  
              - name: streetName | type: string | description: Street name.  | validation: maxLength 1000
              - name: streetNumber | type: string | description: Street number.  | validation: maxLength 1000
           - name: tag | type: AddressTag | description: Address tag.  
                 - enum: UNTAGGED, HOME, WORK, BILLING, SHIPPING
        - name: company | type: string | description: Company name.  | validation: maxLength 1000
        - name: position | type: string | description: Position within company.  | validation: maxLength 1000
        - name: birthdate | type: string | description: Member's birth date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
        - name: slug | type: string | description: URL-friendly slug for the member's profile.  | validation: maxLength 255
        - name: subscription | type: boolean | description: Whether the member consents to receive marketing communications.  
        - name: vatId | type: string | description: Tax GUID or VAT number for personal or corporate use.  | validation: maxLength 1000
 Return type: StateMachineResponse
  - name: state | type: StateType | description: Current state of the login or registration process.  
     - enum:
     -     UNKNOWN_STATE: Initial unknown state.
     -     SUCCESS: Login completed successfully.
     -     REQUIRE_OWNER_APPROVAL: Member needs the owner to approve their registration.
     -     REQUIRE_EMAIL_VERIFICATION: Member needs to verify their email.
     -     STATUS_CHECK: The `status` is not one that prevents the member logging in, meaning it's not `OFFLINE`, `BLOCKED`, or `DELETED`.
     -     REQUIRE_PROFILE_COMPLETION: Member must submit the profile-completion form to continue registration.
  - name: sessionToken | type: string | description: Session token. If `state` is not `SUCCESS`, this field is undefined.  
  - name: stateToken | type: string | description: Token that represents the current state of the login or registration process.  
  - name: identity | type: Identity | description: Identity of the current member.  
     - name: id | type: string | description: Identity GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the identity is updated. To prevent conflicting changes, the current revision must be passed when updating the identity.  Ignored when creating an identity.  | validation: format uint64
     - name: createdDate | type: string | description: Date and time the identity was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the identity was updated.  | read-only: true | validation: format date-time
     - name: connections | type: array<Connection> | description: The identity configured connections to authenticate with.  
        - ONE-OF: 
           - name: idpConnection | type: IdpConnection | description: IDP connection.  
              - name: idpConnectionId | type: string | description: IDP connection GUID.  | validation: format GUID
              - name: idpUserId | type: string | description: IDP user GUID.  
           - name: authenticatorConnection | type: AuthenticatorConnection | description: Authenticator connection.  
              - name: authenticatorConnectionId | type: string | description: Authenticator connection GUID.  | validation: format GUID
              - name: reEnrollmentRequired | type: boolean | description: Whether re-enrollment is required.  
     - name: identityProfile | type: IdentityProfile | description: Identity profile.  
        - name: firstName | type: string | description: Member's first name.  
        - name: lastName | type: string | description: Member's last name.  
        - name: nickname | type: string | description: Member's display nickname.  
        - name: picture | type: string | description: URL to member's profile picture.  
        - name: labels | type: array<string> | description: Labels associated with the member.  | validation: maxItems 2000
        - name: language | type: string | description: Member's preferred language code.  | validation: format LANGUAGE
        - name: privacyStatus | type: PrivacyStatus | description: Member's profile visibility setting.  
             - enum:
             -     UNDEFINED: No privacy status defined.
             -     PUBLIC: Profile details are visible to other members.
             -     PRIVATE: Profile details are hidden from other members.
        - name: customFields | type: array<CustomField> | description: Any number of custom fields. [Custom fields](https://support.wix.com/en/article/adding-custom-fields-to-contacts) are used to store additional information about your site or app's contacts.  
           - name: name | type: string | description: Custom field name matching an extended field key (without `custom.` prefix).  Must match a key from [`List Extended Fields`](https://dev.wix.com/docs/rest/api-reference/contacts/extended-fields/list-extended-fields.md).  
           - name: value | type: CustomValue | description: Value for the custom field.  
              - ONE-OF: 
                 - name: strValue | type: string | description: Text value.  
                 - name: numValue | type: number | description: Numeric value.  
                 - name: dateValue | type: string | description: Date/time value.  | validation: format date-time
                 - name: listValue | type: ListValue | description: List of values.  
                    - name: value | type: array<CustomValue> | description: List of custom values.  
                 - name: mapValue | type: MapValue | description: Key-value pairs.  
                    - name: value | type: Map<string,CustomValue> | description: Map of custom field values.  | validation: format map
                 - name: boolValue | type: boolean | description: Bool value  
        - name: secondaryEmails | type: array<SecondaryEmail> | description: Additional email addresses for the member.  
           - name: email | type: string | description: Secondary email address.  | validation: format EMAIL
           - name: tag | type: EmailTag | description: Email tag.  
                 - enum: UNTAGGED, MAIN, HOME, WORK
        - name: phonesV2 | type: array<Phone> | description: Phone numbers associated with the member.  
           - name: countryCode | type: string | description: Country code for the phone number.  | validation: format COUNTRY
           - name: phone | type: string | description: Phone number without country code.  | validation: format PHONE
           - name: tag | type: PhoneTag | description: Phone tag.  
                 - enum: UNTAGGED, MAIN, HOME, MOBILE, WORK, FAX
        - name: addresses | type: array<AddressWrapper> | description: Physical addresses for the member.  
           - name: address | type: Address | description: Physical address details.  
              - name: country | type: string | description: Country code.  | validation: format COUNTRY
              - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).  
              - name: city | type: string | description: City name.  
              - name: postalCode | type: string | description: Zip/postal code.  
              - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
              - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apartment, suite, and floor.  
              - name: streetName | type: string | description: Street name.  | validation: maxLength 1000
              - name: streetNumber | type: string | description: Street number.  | validation: maxLength 1000
           - name: tag | type: AddressTag | description: Address tag.  
                 - enum: UNTAGGED, HOME, WORK, BILLING, SHIPPING
        - name: company | type: string | description: Company name.  | validation: maxLength 1000
        - name: position | type: string | description: Position within company.  | validation: maxLength 1000
        - name: birthdate | type: string | description: Member's birth date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
        - name: slug | type: string | description: URL-friendly slug for the member's profile.  | validation: maxLength 255
        - name: subscription | type: boolean | description: Whether the member consents to receive marketing communications.  
        - name: vatId | type: string | description: Tax GUID or VAT number for personal or corporate use.  | validation: maxLength 1000
     - name: metadata | type: Metadata | description: Additional information about the identity that can impact user access. This data cannot be set.  
    EMPTY-OBJECT {}
     - name: email | type: Email | description: Identity email address.  
        - name: address | type: string | description: Email address.  | validation: format EMAIL
        - name: isVerified | type: boolean | description: Whether the email address is verified.  
     - name: status | type: StatusV2 | description: Identity's current status.  
        - name: name | type: StatusName | description: Descriptive name of the identity status.  
             - enum:
             -     UNKNOWN_STATUS: Unknown status. This value isn't used.
             -     PENDING: Identity is pending verification, owner approval, or both.
             -     ACTIVE: Identity is active and can log in.
             -     DELETED: Identity is deleted. This identity can't log in.
             -     BLOCKED: Identity is blocked. This identity can't log in.
             -     OFFLINE: Identity is offline. This identity can't log in.
        - name: reasons | type: array<Reason> | description: Reasons for the current identity status.  
             - enum:
             -     UNKNOWN_REASON: Unknown reason. This value isn't used.
             -     PENDING_ADMIN_APPROVAL_REQUIRED: The identity is waiting for admin approval. After the approval, the identity has an `ACTIVE` status.
             -     PENDING_EMAIL_VERIFICATION_REQUIRED: The identity has to verify the email. After the verification, the identity has an `ACTIVE` status.
             -     PENDING_PROFILE_COMPLETION_REQUIRED: The identity must complete the site's profile-completion form. Other pending requirements may remain after completion.
     - name: factors | type: array<Factor> | description: Identity verification factors.  | read-only: true | validation: maxItems 10
        - name: factorId | type: string | description: Factor GUID.  | validation: format GUID
        - name: type | type: FactorType | description: Factor type.  
             - enum:
             -     PASSWORD: Requires a password.
             -     SMS: Requires a code sent via SMS.
             -     CALL: Requires a code sent by phone call.
             -     EMAIL: Requires a code sent by email.
             -     TOTP: Requires authentication via an authenticator app.
             -     PUSH: Requires authentication via a push notification.
             -     WEBAUTHN: Requires authentication via WebAuthn/passkey.
             -     RECOVERY_CODE: Requires a recovery code.
        - name: status | type: Status | description: Factor status.  
             - enum:
             -     INACTIVE: Factor requires activation.
             -     ACTIVE: Factor is active and can be used for authentication.
             -     REQUIRE_REENROLL: Factor is blocked and cannot be used for authentication. The user should reenroll the factor.
  - name: additionalData | type: Map<string,CustomValue> | description: Additional data relevant to the login or registration process.  | validation: format map
     - ONE-OF: 
        - name: strValue | type: string | description: String value.  
        - name: numValue | type: number | description: Number value.  
        - name: dateValue | type: string | description: Date value.  | validation: format date-time
        - name: listValue | type: ListValue | description: List value.  
           - name: value | type: array<CustomValue> | description: Custom value.  
        - name: mapValue | type: MapValue | description: Map value.  
           - name: value | type: Map<string,CustomValue> | description: Mapped custom value.  | validation: format map

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUE_DID_NOT_MATCH | Description: Field value doesn't match the required format.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUEֹֹ_TOO_LONG | Description: Field value is too long.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUEֹֹ_TOO_SHORT | Description: Field value is too short.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_AUTHENTICATOR_ID | Description: Authenticator GUID is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PROVIDE_TENANT_ID | Description: Can't resolve tenant. For users, provide a valid Wix domain in the request. For members, provide a MSGUID in the request.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REGISTRATION_TO_EDITORX_NOT_ALLOWED | Description: Registration to EditorX is no longer supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_USER_TYPE | Description: User type is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_LD_SESSION | Description: `ldSession` is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CLIENT_METADATA_NOT_FOUND | Description: Couldn't find client metadata in the request.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ATTRIBUTE_NOT_FOUND | Description: Couldn't find the attribute.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_FIELD | Description: Unsupported field in `client_meta_data`. Use only supported fields: `clientUrl`, `ldSessionId`, `originView`, `referralInfo`, `urlThatUserRedirectedFrom`, `userType`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: USER_EMAIL_OFAC_ADDRESS | Description: Email address ends with an OFAC-sanctioned country code.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_CAPTCHA_TOKEN | Description: The reCAPTCHA token is missing.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: RECAPTCHA_REQUIRED | Description: A visible reCAPTCHA token is required.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: RECAPTCHA_FAILED | Description: The provided reCAPTCHA token failed verification.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: IP_ADDRESS_FILTERED | Description: Request was made from an invalid IP address.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: CAPTCHA_TOKEN_REQUIRED | Description: CAPTCHA token is required, or the email address is invalid.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: INVALID_CAPTCHA_TOKEN | Description: The reCAPTCHA token is invalid or expired, or the site isn't set up to use reCaptcha for registration.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: DUPLICATE_EMAIL | Description: There is already an identity with this email address.
   HTTP Code: 429 | Status Code: RESOURCE_EXHAUSTED | Application Code: THROTTLED_FEATURE | Description: Too many requests. Try again later.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: COULD_NOT_CREATE_SET_ACCOUNT_USER | Description: Failed to create user and assign it to account.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: UNIMPLEMENTED_FEATURE | Description: This feature isn't implemented.


```

### Examples

### Register with email and password, without using reCAPTCHA.
```curl
curl -X POST \
'https://www.wixapis.com/_api/iam/authentication/v2/register' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
    "login_id": {
        "email": "test@test.com"
    },
    "password": "my-weak-password",
    "profile": {
        "nickname": "test",
        "emails": ["test@test.com"],
        "phones": ["+1-72149124712"],
        "customFields": []
    }
}'
```

### Register with email and password, using invisible reCAPTCHA.
```curl
curl -X POST \
'https://www.wixapis.com/_api/iam/authentication/v2/register' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
    "login_id": {
        "email": "test@test.com"
    },
    "password": "my-weak-password",
    "profile": {
        "nickname": "test",
        "emails": ["test@test.com"],
        "phones": ["+1-72149124712"],
        "customFields": []
    },
    "captcha_tokens": [{
        "InvisibleRecaptcha": "03AAYGu2Q5KvtfjhU8XQBO6P0HI..."
    }]
}'
```

### Register with email and password, using visible reCAPTCHA.
```curl
curl -X POST \
'https://www.wixapis.com/_api/iam/authentication/v2/register' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
    "login_id": {
        "email": "test@test.com"
    },
    "password": "my-weak-password",
    "profile": {
        "nickname": "test",
        "emails": ["test@test.com"],
        "phones": ["+1-72149124712"],
        "customFields": []
    },
    "captcha_tokens": [{
        "Recaptcha": "03AAYGu2Q0STS4gydphoHzHuDW7EFHDzohvovlwgE-bpDbB1..."
    }]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.identity.authentication.registerV2(loginId, options)
 Description: Registers a new member.  Typically, after a successful registration, you generate and use member tokens for the registered member so that subsequent API calls are called as part of a member session. Use the `sessionToken` in the response to [get the site member's access and refresh tokens](https://dev.wix.com/docs/go-headless/coding/rest-api/visitors-and-members/handle-members-with-custom-login.md#get-the-site-members-access-and-refresh-tokens).  If the email used to register the member already exists as a contact email, the registering member need to verify the email address using a code that is sent to the address.
 Method parameters:
   param name: loginId | type: LoginId   | required: true 
     - name: email | type: string | description: Login email address.  | validation: format EMAIL
   param name: options | type: RegisterV2Options  none  
        - name: password | type: string | description: Password of the registering member.  
        - name: profile | type: IdentityProfile | description: Profile information of registering member.  
           - name: firstName | type: string | description: Member's first name.  
           - name: lastName | type: string | description: Member's last name.  
           - name: nickname | type: string | description: Member's display nickname.  
           - name: picture | type: string | description: URL to member's profile picture.  
           - name: labels | type: array<string> | description: Labels associated with the member.  | validation: maxItems 2000
           - name: language | type: string | description: Member's preferred language code.  | validation: format LANGUAGE
           - name: privacyStatus | type: PrivacyStatus | description: Member's profile visibility setting.  
                 - enum:
                 -     UNDEFINED: No privacy status defined.
                 -     PUBLIC: Profile details are visible to other members.
                 -     PRIVATE: Profile details are hidden from other members.
           - name: customFields | type: array<CustomField> | description: Any number of custom fields. [Custom fields](https://support.wix.com/en/article/adding-custom-fields-to-contacts) are used to store additional information about your site or app's contacts.  
              - name: name | type: string | description: Custom field name matching an extended field key (without `custom.` prefix).  Must match a key from [`List Extended Fields`](https://dev.wix.com/docs/rest/api-reference/contacts/extended-fields/list-extended-fields.md).  
              - name: value | type: CustomValue | description: Value for the custom field.  
                 - ONE-OF: 
                    - name: strValue | type: string | description: Text value.  
                    - name: numValue | type: number | description: Numeric value.  
                    - name: dateValue | type: Date | description: Date/time value.  
                    - name: listValue | type: ListValue | description: List of values.  
                       - name: value | type: array<CustomValue> | description: List of custom values.  
                    - name: mapValue | type: MapValue | description: Key-value pairs.  
                       - name: value | type: Map<string,CustomValue> | description: Map of custom field values.  | validation: format map
                    - name: boolValue | type: boolean | description: Bool value  
           - name: secondaryEmails | type: array<SecondaryEmail> | description: Additional email addresses for the member.  
              - name: email | type: string | description: Secondary email address.  | validation: format EMAIL
              - name: tag | type: EmailTag | description: Email tag.  
                     - enum: UNTAGGED, MAIN, HOME, WORK
           - name: phonesV2 | type: array<Phone> | description: Phone numbers associated with the member.  
              - name: countryCode | type: string | description: Country code for the phone number.  | validation: format COUNTRY
              - name: phone | type: string | description: Phone number without country code.  | validation: format PHONE
              - name: tag | type: PhoneTag | description: Phone tag.  
                     - enum: UNTAGGED, MAIN, HOME, MOBILE, WORK, FAX
           - name: addresses | type: array<AddressWrapper> | description: Physical addresses for the member.  
              - name: address | type: Address | description: Physical address details.  
                 - name: city | type: string | description: none  
                 - name: subdivision | type: string | description: none  
                 - name: country | type: string | description: none  
                 - name: postalCode | type: string | description: none  
                 - name: addressLine2 | type: string | description: none  
              - name: tag | type: AddressTag | description: Address tag.  
                     - enum: UNTAGGED, HOME, WORK, BILLING, SHIPPING
           - name: company | type: string | description: Company name.  | validation: maxLength 1000
           - name: position | type: string | description: Position within company.  | validation: maxLength 1000
           - name: birthdate | type: string | description: Member's birth date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
           - name: slug | type: string | description: URL-friendly slug for the member's profile.  | validation: maxLength 255
           - name: subscription | type: boolean | description: Whether the member consents to receive marketing communications.  
           - name: vatId | type: string | description: Tax GUID or VAT number for personal or corporate use.  | validation: maxLength 1000
        - name: captchaTokens | type: array<CaptchaToken> | description: CAPTCHA tokens, when CAPTCHA setting is on.  
           - ONE-OF: 
              - name: Recaptcha | type: string | description:   | validation: maxLength 5000
              - name: InvisibleRecaptcha | type: string | description:   | validation: maxLength 5000
              - name: NoCaptcha | type: string | description:   | validation: maxLength 5000
              - name: recaptchaForClientSiteKey | type: RecaptchaForClientSiteKey | description: Use this when the client has registered their own reCAPTCHA site key (e.g., branded apps, headless apps).  
                 - name: token | type: string | description: The reCAPTCHA token obtained from the client-side reCAPTCHA widget. Local safety limit; Google does not define a maximum token size. Mobile SDK tokens can exceed 5000 characters and must be forwarded unchanged.  | validation: maxLength 65536
                 - name: siteKeyId | type: string | description: The site key GUID registered in ReCAPTCHA service SDL for this client's reCAPTCHA configuration.  | validation: format GUID
              - name: hcaptcha | type: string | description: Passive hCaptcha token minted by the client's invisible hCaptcha widget, sent in addition to a reCAPTCHA token. Only observed, never decides the request: a request carrying only this token still fails as missing a CAPTCHA token. Single use, expires 120 seconds after minting. Local safety limit; hCaptcha does not define a maximum token size.  | validation: maxLength 65536
        - name: clientMetaData | type: object | description: Additional data that's relevant for the flow.  
        - name: factorType | type: FactorType | description: The factor to register with: `PASSWORD`, the default, or `EMAIL`, which sends a code and returns `REQUIRE_REGISTER_CHALLENGE` until the code is submitted to `Verify`.  
             - enum:
             -     PASSWORD: Requires a password.
             -     SMS: Requires a code sent via SMS.
             -     CALL: Requires a code sent by phone call.
             -     EMAIL: Requires a code sent by email.
             -     TOTP: Requires authentication via an authenticator app.
             -     PUSH: Requires authentication via a push notification.
             -     WEBAUTHN: Requires authentication via WebAuthn/passkey.
             -     RECOVERY_CODE: Requires a recovery code.
        - name: organization | type: Organization | description: The organization the user registers into. The new user's account is created as a sub-account of this organization.  
           - name: _id | type: string | description: GUID of the organization. Required whenever `organization` is set.  | validation: format GUID
           - name: inviteCode | type: string | description: One-time registration invite code for this organization. Optional.  | validation: maxLength 500
 Return type: PROMISE<StateMachineResponse>
  - name: state | type: StateType | description: Current state of the login or registration process.  
     - enum:
     -     UNKNOWN_STATE: Initial unknown state.
     -     SUCCESS: Login completed successfully.
     -     REQUIRE_OWNER_APPROVAL: Member needs the owner to approve their registration.
     -     REQUIRE_EMAIL_VERIFICATION: Member needs to verify their email.
     -     STATUS_CHECK: The `status` is not one that prevents the member logging in, meaning it's not `OFFLINE`, `BLOCKED`, or `DELETED`.
     -     REQUIRE_PROFILE_COMPLETION: Member must submit the profile-completion form to continue registration.
  - name: sessionToken | type: string | description: Session token. If `state` is not `SUCCESS`, this field is undefined.  
  - name: stateToken | type: string | description: Token that represents the current state of the login or registration process.  
  - name: identity | type: Identity | description: Identity of the current member.  
     - name: _id | type: string | description: Identity GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the identity is updated. To prevent conflicting changes, the current revision must be passed when updating the identity.  Ignored when creating an identity.  | validation: format uint64
     - name: _createdDate | type: Date | description: Date and time the identity was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the identity was updated.  | read-only: true 
     - name: connections | type: array<Connection> | description: The identity configured connections to authenticate with.  
        - ONE-OF: 
           - name: idpConnection | type: IdpConnection | description: IDP connection.  
              - name: idpConnectionId | type: string | description: IDP connection GUID.  | validation: format GUID
              - name: idpUserId | type: string | description: IDP user GUID.  
           - name: authenticatorConnection | type: AuthenticatorConnection | description: Authenticator connection.  
              - name: authenticatorConnectionId | type: string | description: Authenticator connection GUID.  | validation: format GUID
              - name: reEnrollmentRequired | type: boolean | description: Whether re-enrollment is required.  
     - name: identityProfile | type: IdentityProfile | description: Identity profile.  
        - name: firstName | type: string | description: Member's first name.  
        - name: lastName | type: string | description: Member's last name.  
        - name: nickname | type: string | description: Member's display nickname.  
        - name: picture | type: string | description: URL to member's profile picture.  
        - name: labels | type: array<string> | description: Labels associated with the member.  | validation: maxItems 2000
        - name: language | type: string | description: Member's preferred language code.  | validation: format LANGUAGE
        - name: privacyStatus | type: PrivacyStatus | description: Member's profile visibility setting.  
             - enum:
             -     UNDEFINED: No privacy status defined.
             -     PUBLIC: Profile details are visible to other members.
             -     PRIVATE: Profile details are hidden from other members.
        - name: customFields | type: array<CustomField> | description: Any number of custom fields. [Custom fields](https://support.wix.com/en/article/adding-custom-fields-to-contacts) are used to store additional information about your site or app's contacts.  
           - name: name | type: string | description: Custom field name matching an extended field key (without `custom.` prefix).  Must match a key from [`List Extended Fields`](https://dev.wix.com/docs/rest/api-reference/contacts/extended-fields/list-extended-fields.md).  
           - name: value | type: CustomValue | description: Value for the custom field.  
              - ONE-OF: 
                 - name: strValue | type: string | description: Text value.  
                 - name: numValue | type: number | description: Numeric value.  
                 - name: dateValue | type: Date | description: Date/time value.  
                 - name: listValue | type: ListValue | description: List of values.  
                    - name: value | type: array<CustomValue> | description: List of custom values.  
                 - name: mapValue | type: MapValue | description: Key-value pairs.  
                    - name: value | type: Map<string,CustomValue> | description: Map of custom field values.  | validation: format map
                 - name: boolValue | type: boolean | description: Bool value  
        - name: secondaryEmails | type: array<SecondaryEmail> | description: Additional email addresses for the member.  
           - name: email | type: string | description: Secondary email address.  | validation: format EMAIL
           - name: tag | type: EmailTag | description: Email tag.  
                 - enum: UNTAGGED, MAIN, HOME, WORK
        - name: phonesV2 | type: array<Phone> | description: Phone numbers associated with the member.  
           - name: countryCode | type: string | description: Country code for the phone number.  | validation: format COUNTRY
           - name: phone | type: string | description: Phone number without country code.  | validation: format PHONE
           - name: tag | type: PhoneTag | description: Phone tag.  
                 - enum: UNTAGGED, MAIN, HOME, MOBILE, WORK, FAX
        - name: addresses | type: array<AddressWrapper> | description: Physical addresses for the member.  
           - name: address | type: Address | description: Physical address details.  
              - name: city | type: string | description: none  
              - name: subdivision | type: string | description: none  
              - name: country | type: string | description: none  
              - name: postalCode | type: string | description: none  
              - name: addressLine2 | type: string | description: none  
           - name: tag | type: AddressTag | description: Address tag.  
                 - enum: UNTAGGED, HOME, WORK, BILLING, SHIPPING
        - name: company | type: string | description: Company name.  | validation: maxLength 1000
        - name: position | type: string | description: Position within company.  | validation: maxLength 1000
        - name: birthdate | type: string | description: Member's birth date in `YYYY-MM-DD` format.  | validation: format LOCAL_DATE
        - name: slug | type: string | description: URL-friendly slug for the member's profile.  | validation: maxLength 255
        - name: subscription | type: boolean | description: Whether the member consents to receive marketing communications.  
        - name: vatId | type: string | description: Tax GUID or VAT number for personal or corporate use.  | validation: maxLength 1000
     - name: email | type: Email | description: Identity email address.  
        - name: address | type: string | description: Email address.  | validation: format EMAIL
        - name: isVerified | type: boolean | description: Whether the email address is verified.  
     - name: status | type: StatusV2 | description: Identity's current status.  
        - name: name | type: StatusName | description: Descriptive name of the identity status.  
             - enum:
             -     UNKNOWN_STATUS: Unknown status. This value isn't used.
             -     PENDING: Identity is pending verification, owner approval, or both.
             -     ACTIVE: Identity is active and can log in.
             -     DELETED: Identity is deleted. This identity can't log in.
             -     BLOCKED: Identity is blocked. This identity can't log in.
             -     OFFLINE: Identity is offline. This identity can't log in.
        - name: reasons | type: array<Reason> | description: Reasons for the current identity status.  
             - enum:
             -     UNKNOWN_REASON: Unknown reason. This value isn't used.
             -     PENDING_ADMIN_APPROVAL_REQUIRED: The identity is waiting for admin approval. After the approval, the identity has an `ACTIVE` status.
             -     PENDING_EMAIL_VERIFICATION_REQUIRED: The identity has to verify the email. After the verification, the identity has an `ACTIVE` status.
             -     PENDING_PROFILE_COMPLETION_REQUIRED: The identity must complete the site's profile-completion form. Other pending requirements may remain after completion.
     - name: factors | type: array<Factor> | description: Identity verification factors.  | read-only: true | validation: maxItems 10
        - name: factorId | type: string | description: Factor GUID.  | validation: format GUID
        - name: type | type: FactorType | description: Factor type.  
             - enum:
             -     PASSWORD: Requires a password.
             -     SMS: Requires a code sent via SMS.
             -     CALL: Requires a code sent by phone call.
             -     EMAIL: Requires a code sent by email.
             -     TOTP: Requires authentication via an authenticator app.
             -     PUSH: Requires authentication via a push notification.
             -     WEBAUTHN: Requires authentication via WebAuthn/passkey.
             -     RECOVERY_CODE: Requires a recovery code.
        - name: status | type: Status | description: Factor status.  
             - enum:
             -     INACTIVE: Factor requires activation.
             -     ACTIVE: Factor is active and can be used for authentication.
             -     REQUIRE_REENROLL: Factor is blocked and cannot be used for authentication. The user should reenroll the factor.
  - name: additionalData | type: Map<string,CustomValue> | description: Additional data relevant to the login or registration process.  | validation: format map
     - ONE-OF: 
        - name: strValue | type: string | description: String value.  
        - name: numValue | type: number | description: Number value.  
        - name: dateValue | type: Date | description: Date value.  
        - name: listValue | type: ListValue | description: List value.  
           - name: value | type: array<CustomValue> | description: Custom value.  
        - name: mapValue | type: MapValue | description: Map value.  
           - name: value | type: Map<string,CustomValue> | description: Mapped custom value.  | validation: format map

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUE_DID_NOT_MATCH | Description: Field value doesn't match the required format.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUEֹֹ_TOO_LONG | Description: Field value is too long.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: VALUEֹֹ_TOO_SHORT | Description: Field value is too short.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_AUTHENTICATOR_ID | Description: Authenticator GUID is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PROVIDE_TENANT_ID | Description: Can't resolve tenant. For users, provide a valid Wix domain in the request. For members, provide a MSGUID in the request.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REGISTRATION_TO_EDITORX_NOT_ALLOWED | Description: Registration to EditorX is no longer supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_USER_TYPE | Description: User type is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_LD_SESSION | Description: `ldSession` is missing or invalid.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CLIENT_METADATA_NOT_FOUND | Description: Couldn't find client metadata in the request.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ATTRIBUTE_NOT_FOUND | Description: Couldn't find the attribute.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_FIELD | Description: Unsupported field in `client_meta_data`. Use only supported fields: `clientUrl`, `ldSessionId`, `originView`, `referralInfo`, `urlThatUserRedirectedFrom`, `userType`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: USER_EMAIL_OFAC_ADDRESS | Description: Email address ends with an OFAC-sanctioned country code.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_CAPTCHA_TOKEN | Description: The reCAPTCHA token is missing.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: RECAPTCHA_REQUIRED | Description: A visible reCAPTCHA token is required.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: RECAPTCHA_FAILED | Description: The provided reCAPTCHA token failed verification.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: IP_ADDRESS_FILTERED | Description: Request was made from an invalid IP address.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: CAPTCHA_TOKEN_REQUIRED | Description: CAPTCHA token is required, or the email address is invalid.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: INVALID_CAPTCHA_TOKEN | Description: The reCAPTCHA token is invalid or expired, or the site isn't set up to use reCaptcha for registration.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: DUPLICATE_EMAIL | Description: There is already an identity with this email address.
   HTTP Code: 429 | Status Code: RESOURCE_EXHAUSTED | Application Code: THROTTLED_FEATURE | Description: Too many requests. Try again later.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: COULD_NOT_CREATE_SET_ACCOUNT_USER | Description: Failed to create user and assign it to account.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: UNIMPLEMENTED_FEATURE | Description: This feature isn't implemented.


```

### Examples

### registerV2
```javascript
import { authentication } from '@wix/identity';

async function registerV2(loginId,options) {
  const response = await authentication.registerV2(loginId,options);
};
```

### registerV2 (with elevated permissions)
```javascript
import { authentication } from '@wix/identity';
import { auth } from '@wix/essentials';

async function myRegisterV2Method(loginId,options) {
  const elevatedRegisterV2 = auth.elevate(authentication.registerV2);
  const response = await elevatedRegisterV2(loginId,options);
}
```

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

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


async function registerV2(loginId,options) {
  const response = await myWixClient.authentication.registerV2(loginId,options);
};
```

---