Skip to content

Phone or Email Verification

This functionality allows sending a verification code and saving the fact of phone and/or email verification.

Initializing Verification

POST api/verification/init

Request:

FieldRequiredTypeDescription
typestringVerification type: email, phone
mobilePhoneIf type = phonestringPhone number
emailIf type = emailstringEmail
entitiesarrayArray of related entities. For example: client: 123, lead: 5. Used for further search
entities.*.typestringEntity type: client, lead, loanApp etc
entities.*.idstringEntity identifier
verificationUrlstringURL to send in the email body. If not specified, a link to the microservice will be sent

INFO

If you need to send a link to your website to the client, you need to specify the {uuid} and {hash} fields in verificationUrl. These fields will be replaced with actual values when forming the email.

Example: https://google.com/verify/{uuid}?hash={hash}

Response:

json
{
  "status": "ok",
  "timestamp": 1679497353000,
  "data": {
    "uuid": "98bfd84d-c3b3-438b-95f8-3199c2730b97"
    // This uuid is used to send the code for verification
  }
}

:::caution Verification is performed based on the OTP module.

To use this functionality, you need to create a challenge with the names email-verification and phone-verification :::

Attaching to an Entity

INFO

Sometimes there is a need to verify an email before creating a client. For such scenarios, you can first verify the contact, then, after creating the entity, attach it to the verification via uuid.

PUT api/verification/{uuid}/attach

Request:

FieldRequiredTypeDescription
entitiesarrayArray of related entities. For example: client: 123, lead: 5. Used for further search
entities.*.typestringEntity type: client, lead, loanApp etc
entities.*.idstringEntity identifier

Response:

json
{
  "status": "ok",
  "timestamp": 1679562151000,
  "data": {
    "uuid": "98bfd84d-c3b3-438b-95f8-3199c2730b97",
    "verified": true,
    "verified_at": "2023-03-23T09:02:31+00:00"
  }
}

Code Verification

Verification on the Microservice Side

If the verificationUrl parameter was not sent when initializing the confirmation request, the system will automatically generate a temporary link for email confirmation on the microservice side.

Verification via API Request

POST /api/verification/{uuid}/verify

Request:

FieldRequiredTypeDescription
hashstringCode sent in the email

Response:

json
{
  "status": "ok",
  "timestamp": 1679562151000,
  "data": {
    "uuid": "98bfd84d-c3b3-438b-95f8-3199c2730b97",
    "verified": true,
    "verified_at": "2023-03-23T09:02:31+00:00"
  }
}

Verification Existence Check

GET {type}/{entityType}/{entityId}/exists

where,

  • type - email, phone
  • entityType - Entity type. Example (client)
  • entityId - Entity ID

Parameters:

  • email - Required if type = email
  • phone - Required if type = phone

Response:

json
{
  "status": "ok",
  "timestamp": 1679562151000,
  "data": {
    "found": true
  }
}

Searching for Verifications

GET {type}/{entityType}/{entityId}

where,

  • type - email, phone
  • entityType - Entity type. Example (client)
  • entityId - Entity ID

Parameters:

  • email - Required if type = email
  • phone - Required if type = phone

Response:

json
{
  "status": "ok",
  "timestamp": 1679562151000,
  "data": {
    "uuid": "98bfd84d-c3b3-438b-95f8-3199c2730b97",
    "verified": true,
    "verified_at": "2023-03-23T09:02:31+00:00"
  }
}