Verify Email Code
curl --request POST \
--url https://api.example.com/v1/auth/register/email/verify \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>",
"verificationCode": "<string>",
"contactVerificationId": "<string>",
"countryOfResidence": "<string>",
"allowMarketing": true,
"allowSms": true
}
'import requests
url = "https://api.example.com/v1/auth/register/email/verify"
payload = {
"email": "<string>",
"password": "<string>",
"verificationCode": "<string>",
"contactVerificationId": "<string>",
"countryOfResidence": "<string>",
"allowMarketing": True,
"allowSms": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
password: '<string>',
verificationCode: '<string>',
contactVerificationId: '<string>',
countryOfResidence: '<string>',
allowMarketing: true,
allowSms: true
})
};
fetch('https://api.example.com/v1/auth/register/email/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/auth/register/email/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'password' => '<string>',
'verificationCode' => '<string>',
'contactVerificationId' => '<string>',
'countryOfResidence' => '<string>',
'allowMarketing' => true,
'allowSms' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/auth/register/email/verify"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/auth/register/email/verify")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/register/email/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}"
response = http.request(request)
puts response.read_body{
"hasAccount": true,
"onboardingId": "<string>",
"user": {}
}Authentication
Verify Email Code
Verify email code and create user account with initial details
POST
/
v1
/
auth
/
register
/
email
/
verify
Verify Email Code
curl --request POST \
--url https://api.example.com/v1/auth/register/email/verify \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>",
"verificationCode": "<string>",
"contactVerificationId": "<string>",
"countryOfResidence": "<string>",
"allowMarketing": true,
"allowSms": true
}
'import requests
url = "https://api.example.com/v1/auth/register/email/verify"
payload = {
"email": "<string>",
"password": "<string>",
"verificationCode": "<string>",
"contactVerificationId": "<string>",
"countryOfResidence": "<string>",
"allowMarketing": True,
"allowSms": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
password: '<string>',
verificationCode: '<string>',
contactVerificationId: '<string>',
countryOfResidence: '<string>',
allowMarketing: true,
allowSms: true
})
};
fetch('https://api.example.com/v1/auth/register/email/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/auth/register/email/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'password' => '<string>',
'verificationCode' => '<string>',
'contactVerificationId' => '<string>',
'countryOfResidence' => '<string>',
'allowMarketing' => true,
'allowSms' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/auth/register/email/verify"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/auth/register/email/verify")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/register/email/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"password\": \"<string>\",\n \"verificationCode\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"countryOfResidence\": \"<string>\",\n \"allowMarketing\": true,\n \"allowSms\": true\n}"
response = http.request(request)
puts response.read_body{
"hasAccount": true,
"onboardingId": "<string>",
"user": {}
}Overview
Verify the code received by email and create a user account. This endpoint:- Validates the verification code sent to the user’s email
- Creates a new user account with email and password
- Generates an onboarding ID for completing registration
- Returns user details and onboarding status
Request
Body
string
required
User’s email addressExample:
hello@example.comstring
required
User’s chosen passwordSecurity: Should meet minimum strength requirementsExample:
x1x2x3x4y1y2y3y4!!string
required
6-digit code received by emailExample:
123456string
required
Verification ID from email send stepExample:
US_100a99cf-f4d3-4fa1-9be9-2e9828b20ebbstring
required
User’s country of residenceFormat: ISO 3166-1 alpha-2 codeExample:
GBboolean
required
User consent for marketing communicationsExample:
trueboolean
required
User consent for SMS communicationsExample:
trueResponse
boolean
Whether email already has an accountExample:
falsestring
Onboarding ID for completing registrationStore this for subsequent onboarding stepsExample:
US_100a99cf-f4d3-4fa1-c123-2e9833440ebbobject
Initial user object with minimal detailsAdditional details added in subsequent onboarding steps
Code Examples
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');
Next Steps
Send Phone Verification
Continue onboarding by verifying phone number
Was this page helpful?