> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baanx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Email Code

> Verify email code and create user account with initial details

## Overview

Verify the code received by email and create a user account. This endpoint:

1. Validates the verification code sent to the user's email
2. Creates a new user account with email and password
3. Generates an onboarding ID for completing registration
4. Returns user details and onboarding status

After successful verification, the user enters the onboarding flow to complete their profile.

## Request

### Body

<ParamField body="email" type="string" required>
  User's email address

  **Example**: `hello@example.com`
</ParamField>

<ParamField body="password" type="string" required>
  User's chosen password

  **Security**: Should meet minimum strength requirements

  **Example**: `x1x2x3x4y1y2y3y4!!`
</ParamField>

<ParamField body="verificationCode" type="string" required>
  6-digit code received by email

  **Example**: `123456`
</ParamField>

<ParamField body="contactVerificationId" type="string" required>
  Verification ID from email send step

  **Example**: `US_100a99cf-f4d3-4fa1-9be9-2e9828b20ebb`
</ParamField>

<ParamField body="countryOfResidence" type="string" required>
  User's country of residence

  **Format**: ISO 3166-1 alpha-2 code

  **Example**: `GB`
</ParamField>

<ParamField body="allowMarketing" type="boolean" required>
  User consent for marketing communications

  **Example**: `true`
</ParamField>

<ParamField body="allowSms" type="boolean" required>
  User consent for SMS communications

  **Example**: `true`
</ParamField>

## Response

<ResponseField name="hasAccount" type="boolean">
  Whether email already has an account

  **Example**: `false`
</ResponseField>

<ResponseField name="onboardingId" type="string">
  Onboarding ID for completing registration

  Store this for subsequent onboarding steps

  **Example**: `US_100a99cf-f4d3-4fa1-c123-2e9833440ebb`
</ResponseField>

<ResponseField name="user" type="object">
  Initial user object with minimal details

  Additional details added in subsequent onboarding steps
</ResponseField>

## Code Examples

<CodeGroup>
  ```javascript JavaScript theme={null}
  const response = await fetch('https://dev.api.baanx.com/v1/auth/register/email/verify', {
    method: 'POST',
    headers: {
      'x-client-key': 'your-client-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'hello@example.com',
      password: 'SecurePassword123!',
      verificationCode: '123456',
      contactVerificationId: sessionStorage.getItem('contactVerificationId'),
      countryOfResidence: 'GB',
      allowMarketing: true,
      allowSms: true
    })
  });

  const { onboardingId, user } = await response.json();
  sessionStorage.setItem('onboardingId', onboardingId);
  console.log('Account created, continue onboarding');
  ```
</CodeGroup>

## Next Steps

<Card title="Send Phone Verification" href="/api-reference/auth/register-phone-send">
  Continue onboarding by verifying phone number
</Card>
