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:
| Field | Required | Type | Description |
|---|---|---|---|
| type | ✅ | string | Verification type: email, phone |
| mobilePhone | If type = phone | string | Phone number |
| If type = email | string | ||
| entities | ❌ | array | Array of related entities. For example: client: 123, lead: 5. Used for further search |
| entities.*.type | ✅ | string | Entity type: client, lead, loanApp etc |
| entities.*.id | ✅ | string | Entity identifier |
| verificationUrl | ❌ | string | URL 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:
{
"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:
| Field | Required | Type | Description |
|---|---|---|---|
| entities | ✅ | array | Array of related entities. For example: client: 123, lead: 5. Used for further search |
| entities.*.type | ✅ | string | Entity type: client, lead, loanApp etc |
| entities.*.id | ✅ | string | Entity identifier |
Response:
{
"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:
| Field | Required | Type | Description |
|---|---|---|---|
| hash | ✅ | string | Code sent in the email |
Response:
{
"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 = emailphone- Required if type = phone
Response:
{
"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 = emailphone- Required if type = phone
Response:
{
"status": "ok",
"timestamp": 1679562151000,
"data": {
"uuid": "98bfd84d-c3b3-438b-95f8-3199c2730b97",
"verified": true,
"verified_at": "2023-03-23T09:02:31+00:00"
}
}