Skip to main content

Create an App Registration Phone Validation

Endpoint​

POST https://api.verifik.co/v2/phone-validations/app-registration

A Phone Validation is an instance within Verifik's system that allows you to process and validate phone numbers during the app registration process. This process ensures the authenticity of user phone numbers and provides secure verification through SMS or WhatsApp delivery methods.

warning

The JWT Token you should use when creating App Registration Phone Validations is provided from the App Registration in creation. You must use the token returned when creating an App Registration to authenticate this request.

Headers​

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params​

NameTypeRequiredDescription
projectstringYesThe unique identifier for the project where this phone validation will be used
validationMethodstringYesThe validation method. Must be verificationCode
phonestringYesThe phone number that will be validated. Spaces will be automatically removed during processing
countryCodestringYesThe country code of the phone number in format +XXX (e.g., +507 for Panama, +1 for United States). Must match the format + followed by 1 to 3 digits
typestringYesType of validation. Must be one of: validation, login, onboarding, or oneTimeLink
expiresAtstringNoOptional expiration date for the validation code. If not provided, a default expiration time will be set. Format: ISO 8601 (e.g., 2024-12-31T23:59:59.000Z)
redirectUrlstringNoOptional URL for redirect after validation
webhookUrlstringNoOptional webhook URL for validation notifications
identityUrlstringNoOptional identity verification URL
requires2FAbooleanNoOptional flag indicating if two-factor authentication is required. Defaults to false
ipAddressstringNoOptional IP address of the user

Validation Method Values​

ValueDescription
verificationCodeSends a one-time password (OTP) to the phone number for verification

Type Values​

ValueDescription
onboardingPhone verification during user registration (recommended for app registrations)
validationGeneral phone number validation
loginPhone verification during user login
oneTimeLinkOne-time link validation

Request​

const fetch = require("node-fetch");

async function run() {
const res = await fetch("https://api.verifik.co/v2/phone-validations/app-registration", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_TOKEN}`,
},
body: JSON.stringify({
project: "507f1f77bcf86cd799439011",
validationMethod: "verificationCode",
phone: "62647737",
countryCode: "+507",
type: "onboarding"
}),
});
console.log(await res.json());
}

run();

Response​

{
"data": {
"client": "507f1f77bcf86cd799439013",
"project": "507f1f77bcf86cd799439011",
"projectFlow": "507f1f77bcf86cd799439015",
"status": "sent",
"countryCode": "+507",
"phone": "62647737",
"phoneGateway": "whatsapp",
"otp": "$2a$10$/v55.1QmwlCdX6zD1jy51OF87POIDZzj30.UmTtp13pZv6uKm.a.m",
"expiresAt": "2024-12-02T17:15:35.000Z",
"phoneData": {},
"type": "validation",
"redirectUrl": "https://api.verifik.co",
"requires2FA": false,
"ipAddress": "172.17.0.1",
"language": "en",
"_id": "674de8df21c72be3cc42b8a7",
"updatedAt": "2024-12-02T17:05:36.788Z",
"createdAt": "2024-12-02T17:05:36.788Z",
"__v": 0,
"new": true
}
}

Notes​

  • Country Code Format: The countryCode must be in the format +XXX where X are digits (1-3 digits maximum). For example: +1, +507, +52.
  • Phone Number: Spaces in phone numbers are automatically removed during processing.
  • OTP Security: The OTP is encrypted using bcrypt before storage for security.
  • Default Gateway: Phone validations default to WhatsApp delivery method based on your project flow configuration.
  • Automatic Linking: When created through the app-registration endpoint, the phone validation is automatically linked to the user's app registration record.
  • Credit Charging: This endpoint automatically charges credits from your SmartEnroll plan.
  • App Registration Required: This endpoint requires an active app registration session. You must use the token returned from creating an App Registration.