Validate Phone Validation

Endpoint

POST /v2/phone-validations/validate

Description

This endpoint validates a one-time password (OTP) sent to a user’s phone number as part of the phone verification process. It ensures that the user-provided OTP is correct and updates the verification status accordingly.

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

validationMethod

String

Yes

The validation method, set to verificationCode.

type

String

Yes

Type of validation, e.g., login.

otp

String

Yes

The one-time password provided by the user.

Request

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

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://app.verifik.co/v2/phone-validations/validate',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJhbGciOiJIUzNj...0w1splt4Cw'
  },
  data : data
};

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

Response

{
  "data": {
    "_id": "674deff248fb1a857d68341d",
    "status": "validated",
    "countryCode": "+507",
    "phone": "62617737",
    "type": "login",
    "showFaceLivenessRecommendation": true,
    "appLogin": {
      "_id": "674deff248fb1a857d68341e",
      "client": "613375a1eab2fe08527f81e2",
      "name": "",
      "status": "validated",
      "project": "6266193db77ccc8111730c90",
      "projectFlow": "658ed28b0990f300134d7b78",
      "type": "phone",
      "phoneValidation": "674deff248fb1a857d68341d",
      "updatedAt": "2024-12-02T17:43:19.147Z",
      "createdAt": "2024-12-02T17:35:46.689Z",
      "__v": 0
    },
    "token": "eyJhbGciOiJIUzI1NiIsIn..."
  }
}

Response Body

Parameter
Type
Description

_id

String

Unique ID for the phone validation session.

status

String

Status of the validation, e.g., validated.

countryCode

String

Country code of the phone number.

phone

String

The phone number that was validated.

type

String

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

showFaceLivenessRecommendation

Boolean

Indicates if face liveness check is recommended.

appLogin._id

String

Unique ID of the login session.

appLogin.client

String

Client identifier.

appLogin.name

String

Name of the user associated with the validation.

appLogin.status

String

Status of the login session, e.g., validated.

token

String

JWT token generated after successful validation.

Notes

  • Ensure the Authorization header contains a valid token to authenticate API requests.

  • If showFaceLivenessRecommendation is true, guide users to complete a face liveness check.

  • Handle JWT tokens securely and use them only for the intended session.

Last updated