Language
Verify
Confirm identity to secure accounts, authenticate transactions, and prevent fraud with two-factor authentication (2FA) and one-time passwords (OTP).
Create a new Verify object through the API to start the verification process of a recipient. Releans will take care of creating a token and making sure that the message gets delivered to the provided number.
Your code is XXXX
Send OTP
Request a verify. Creates a new Verify object and sends a verification token to a recipient.
Good to know the parameters before
Parameter | Type | Description |
---|---|---|
sender Required |
string | Sender (from) to send the message Ex. Releans Sender ID must be registered in your account. You can register your company name as Sender ID from New Sender form in the dashboard |
mobile Required |
mobile number | The telephone number that you want to verify. Format mobile number with a + and a country code, (E.164 format). |
channel Optional |
string | The type of message. Values can be: sms, voice Default: sms |
POST Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/otp/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "sender=SenderName&mobile=+14155550101&channel=sms",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example Response
{
"message": "Your message sent.",
"code": 77,
"status": 201
}
Verify OTP
Verifies a sent verification token. Can only be done once for each token.
Good to know the parameters before
Parameter | Type | Description |
---|---|---|
mobile Required |
mobile number | The mobile number that you requested to verify. |
code Required |
string | An unique code which was sent to the recipient upon sent OTP. |
POST Request
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.releans.com/v2/otp/check",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "mobile=+14155550101&code=0000",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer Your_API_Key"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
201 Example Response
{
"message": "Verified",
"mobile": "+14155550101",
"code": 63,
"status": 200
}
403 Example Response
{
"message": "Invalid code",
"code": 21,
"status": 422,
"accepted_format": "",
"format_description": ""
}