Skip to main content

Create a Phone Validation

Endpoint​

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

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

Headers​

Content-Type​

Type: String
Required: Required
Value: application/json

Authorization​

Type: String
Required: Required
Value: Bearer {YOUR_ACCESS_TOKEN}

Body Parameters​

project​

Type: String
Required: Yes

The unique identifier for the project where this phone validation will be used.

validationMethod​

Type: String
Required: Yes

The validation method, set to verificationCode or manual.

phone​

Type: String
Required: Yes

The phone number that will be validated (spaces will be automatically removed).

countryCode​

Type: String
Required: Yes

The country code of the phone number in format +XXX (e.g., +507 for Panama).

type​

Type: String
Required: Yes

Type of validation: validation, login, onboarding, or oneTimeLink.

expiresAt​

Type: String
Required: No

Optional expiration date for the validation code.

redirectUrl​

Type: String
Required: No

Optional URL for redirect after validation.

webhookUrl​

Type: String
Required: No

Optional webhook URL for validation notifications.

identityUrl​

Type: String
Required: No

Optional identity verification URL.

requires2FA​

Type: Boolean
Required: No

Optional flag indicating if two-factor authentication is required.

ipAddress​

Type: String
Required: No

Optional IP address of the user.

validationMethod Values​

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

type Values​

ValueDescription
validationGeneral phone number validation.
loginPhone verification during user login.
onboardingPhone verification during user registration. For onboarding - you must use create-an-app-registration-phone-validation

Request Example​

const axios = require("axios");

const config = {
method: "post",
url: "https://api.verifik.co/v2/phone-validations",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
data: {
project: "project_123456789",
validationMethod: "verificationCode",
phone: "1234567890",
countryCode: "+1",
type: "validation",
expiresAt: "2024-01-15T11:30:00Z",
redirectUrl: "https://example.com/success",
webhookUrl: "https://example.com/webhook",
requires2FA: false,
ipAddress: "192.168.1.1"
}
};

axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Response Example​

{
"success": true,
"data": {
"_id": "phone_validation_123456789",
"client": "client_123456789",
"project": "project_123456789",
"projectFlow": "flow_123456789",
"status": "sent",
"countryCode": "+1",
"phone": "1234567890",
"type": "validation",
"validationMethod": "verificationCode",
"verificationCode": "123456",
"expiresAt": "2024-01-15T11:30:00Z",
"redirectUrl": "https://example.com/success",
"webhookUrl": "https://example.com/webhook",
"requires2FA": false,
"ipAddress": "192.168.1.1",
"attempts": 0,
"maxAttempts": 3,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
"signature": {
"dateTime": "April 11, 2023 12:25 PM",
"message": "Certified by Verifik.co"
}
}
  • Multiple Languages: Support for JavaScript, Python, PHP and Swift
  • Error Handling: Detailed error responses for different scenarios