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β
| Value | Description |
|---|---|
verificationCode | Sends a one-time password (OTP) to the phone number for verification. |
manual | Manual verification process without OTP. |
type Valuesβ
| Value | Description |
|---|---|
validation | General phone number validation. |
login | Phone verification during user login. |
onboarding | Phone verification during user registration. For onboarding - you must use create-an-app-registration-phone-validation |
Request Exampleβ
- Node.js
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β
- 200 OK
- Error
{
"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"
}
}
{
"success": false,
"error": "Invalid phone number",
"code": "INVALID_PHONE"
}
- Multiple Languages: Support for JavaScript, Python, PHP and Swift
- Error Handling: Detailed error responses for different scenarios