Create a Phone Validation

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

Name
Value

Content-Type

application/json

Body

Name
Type
Description

project

string

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

validationMethod

string

The validation method, set to verificationCode.

phone

string

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

countryCode

string

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

type

string

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

expiresAt

string

Optional expiration date for the validation code.

redirectUrl

string

Optional URL for redirect after validation.

webhookUrl

string

Optional webhook URL for validation notifications.

identityUrl

string

Optional identity verification URL.

requires2FA

boolean

Optional flag indicating if two-factor authentication is required.

ipAddress

string

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

Body Examples

Basic Phone Validation

{
  "project": "507f1f77bcf86cd799439011",
  "validationMethod": "verificationCode",
  "phone": "62647737",
  "countryCode": "+507",
  "type": "validation"
}

Advanced Phone Validation

{
  "project": "507f1f77bcf86cd799439011",
  "validationMethod": "verificationCode",
  "phone": "62647737",
  "countryCode": "+507",
  "type": "login",
  "expiresAt": "2024-12-31T23:59:59.000Z",
  "redirectUrl": "https://yourapp.com/success",
  "webhookUrl": "https://yourapp.com/webhook",
  "identityUrl": "https://yourapp.com/identity",
  "requires2FA": false,
  "ipAddress": "192.168.1.1"
}

Response

The response will contain information about the new Phone Validation instance. Important fields include the unique identifier _id, the status of the validation process, and the encrypted OTP that was sent to the user.

{
  "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).

  • 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.

  • Credit System: This endpoint automatically reduces credits from your account for each phone validation created.

Once your Phone Validation is created, you can use the _id field to validate the OTP sent to the user's phone number using the Validate Phone Validation endpoint.

Last updated

Was this helpful?