Verify Phone Code
curl --request POST \
--url https://api.example.com/v1/auth/register/phone/verify \
--header 'Content-Type: application/json' \
--data '
{
"onboardingId": "<string>",
"phoneCountryCode": "<string>",
"phoneNumber": "<string>",
"contactVerificationId": "<string>",
"verificationCode": "<string>"
}
'import requests
url = "https://api.example.com/v1/auth/register/phone/verify"
payload = {
"onboardingId": "<string>",
"phoneCountryCode": "<string>",
"phoneNumber": "<string>",
"contactVerificationId": "<string>",
"verificationCode": "<string>"
}
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({
onboardingId: '<string>',
phoneCountryCode: '<string>',
phoneNumber: '<string>',
contactVerificationId: '<string>',
verificationCode: '<string>'
})
};
fetch('https://api.example.com/v1/auth/register/phone/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/phone/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([
'onboardingId' => '<string>',
'phoneCountryCode' => '<string>',
'phoneNumber' => '<string>',
'contactVerificationId' => '<string>',
'verificationCode' => '<string>'
]),
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/phone/verify"
payload := strings.NewReader("{\n \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\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/phone/verify")
.header("Content-Type", "application/json")
.body("{\n \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/register/phone/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 \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"onboardingId": "<string>",
"user": {}
}Authentication
Verify Phone Code
Verify SMS code and update user onboarding with phone number
POST
/
v1
/
auth
/
register
/
phone
/
verify
Verify Phone Code
curl --request POST \
--url https://api.example.com/v1/auth/register/phone/verify \
--header 'Content-Type: application/json' \
--data '
{
"onboardingId": "<string>",
"phoneCountryCode": "<string>",
"phoneNumber": "<string>",
"contactVerificationId": "<string>",
"verificationCode": "<string>"
}
'import requests
url = "https://api.example.com/v1/auth/register/phone/verify"
payload = {
"onboardingId": "<string>",
"phoneCountryCode": "<string>",
"phoneNumber": "<string>",
"contactVerificationId": "<string>",
"verificationCode": "<string>"
}
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({
onboardingId: '<string>',
phoneCountryCode: '<string>',
phoneNumber: '<string>',
contactVerificationId: '<string>',
verificationCode: '<string>'
})
};
fetch('https://api.example.com/v1/auth/register/phone/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/phone/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([
'onboardingId' => '<string>',
'phoneCountryCode' => '<string>',
'phoneNumber' => '<string>',
'contactVerificationId' => '<string>',
'verificationCode' => '<string>'
]),
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/phone/verify"
payload := strings.NewReader("{\n \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\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/phone/verify")
.header("Content-Type", "application/json")
.body("{\n \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/auth/register/phone/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 \"onboardingId\": \"<string>\",\n \"phoneCountryCode\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"contactVerificationId\": \"<string>\",\n \"verificationCode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"onboardingId": "<string>",
"user": {}
}Overview
Verify the SMS code received by the user and update their onboarding record with the verified phone number. After verification, the user can proceed to the next onboarding step (personal details).Request
Body
string
required
Onboarding ID from email verificationExample:
US_100a99cf-f4d3-4fa1-c123-2e9833440ebbstring
required
Phone country calling codeExample:
+44string
required
Phone number without country codeExample:
7400846282string
required
Verification ID from email send stepExample:
US_100a99cf-f4d3-4fa1-9be9-2e9828b20ebbstring
required
6-digit code received via SMSExample:
123456Response
string
Updated onboarding IDExample:
US_100a99cf-f4d3-4fa1-c123-2e9833440ebbobject
Updated user object with verified phone number
Code Examples
const response = await fetch('https://dev.api.baanx.com/v1/auth/register/phone/verify', {
method: 'POST',
headers: {
'x-client-key': 'your-client-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
onboardingId: sessionStorage.getItem('onboardingId'),
phoneCountryCode: '+44',
phoneNumber: '7400846282',
contactVerificationId: sessionStorage.getItem('contactVerificationId'),
verificationCode: '123456'
})
});
const { user } = await response.json();
console.log('Phone verified:', user.phoneNumber);
Next Steps
Update Personal Details
Add personal information to complete KYC
Was this page helpful?
⌘I