Create Phone Validation (Crear Validación de Teléfono)

Endpoint

POST /v2/phone-validations

Descripción

Este endpoint envía una contraseña de un solo uso (OTP) a un número de teléfono especificado con fines de validación. El OTP puede entregarse a través de SMS o WhatsApp, dependiendo del gateway seleccionado.

Headers

Header
Type
Required
Description

Content-Type

String

Yes

Set to application/json.

Authorization

String

Yes

Bearer token for API authorization.

Body Parameters

Parameter
Type
Required
Description

project

String

Yes

Unique identifier for the project.

projectFlow

String

Yes

Identifier for the specific project flow.

countryCode

String

Yes

The country code of the phone number (e.g., +507).

phone

String

Yes

The phone number to which the OTP will be sent.

validationMethod

String

Yes

The validation method, set to verificationCode.

type

String

Yes

Type of validation, e.g., login.

phoneGateway

String

No

Specifies the delivery method: sms (default) or whatsapp.

Request

const axios = require('axios');
let data = JSON.stringify({
  "project": "6266193db77ccc8111730c90",
  "projectFlow": "658ed28b0990f300134d7b71",
  "countryCode": "+507",
  "phone": "62617737",
  "validationMethod": "verificationCode",
  "type": "login"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.verifik.co/v2/phone-validations',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR...XMBMLt87V0w1splt4Cw'
  },
  data : data
};

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

Response

{
  "data": {
    "client": "613375a1eab2fe08527f81e2",
    "project": "6266193db77ccc8111730c90",
    "projectFlow": "658ed28b0990f300134d7b78",
    "status": "sent",
    "countryCode": "+507",
    "phone": "62617737",
    "phoneGateway": "sms",
    "otp": "$2a$10$/v55.1QmwlCdX6zD1jy51OF87POIDZzj30.UmTtp13pZv6uKm.a.m",
    "expiresAt": "2024-12-02T17:15:35.000Z",
    "phoneData": {
      "title": "Verifik Client "
    },
    "type": "login",
    "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,
    "providerConfirmation": {
      "sent": true,
      "status": "ok"
    }
  },
  "signature": {
    "dateTime": "December 2, 2024 5:05 PM",
    "message": "Certified by Verifik.co"
  },
  "id": "E6JPP"
}

Response Body

Parameter
Type
Description

client

String

Unique identifier of the client.

project

String

Identifier of the associated project.

projectFlow

String

Identifier of the specific project flow.

status

String

Status of the OTP delivery (e.g., sent).

countryCode

String

Country code of the phone number.

phone

String

The phone number where the OTP was sent.

phoneGateway

String

Delivery method used (sms or whatsapp).

otp

String

OTP sent to the user (hashed for security).

expiresAt

String

Expiration date and time of the OTP.

phoneData.title

String

Custom title provided during phone validation.

type

String

Type of validation (e.g., login).

redirectUrl

String

URL for redirect after validation.

requires2FA

Boolean

Indicates whether two-factor authentication is required.

ipAddress

String

IP address from which the request was initiated.

language

String

Language for validation communication (e.g., en).

providerConfirmation

Object

Confirmation details from the provider.

dateTime

String

Date and time of signature validation.

message

String

Certification message.

id

String

Unique ID for the phone validation session.


Notas

  • Parámetro opcional: phoneGateway puede configurarse como "sms" (predeterminado) o "whatsapp" para la entrega del OTP.

  • El OTP expira después de un tiempo predefinido (expiresAt).

  • Asegura un manejo seguro de los tokens de autorización y OTPs en tu aplicación.

  • Se pueden requerir pasos de validación adicionales según requires2FA.

Last updated