One Time Password (OTP)
This endpoint is used for verification process when authenticating a user on your platform.
Endpoint
Headers
Request Parameters
Parameters
Type
Description
Sample Requests
<?php
$data = [
'expiry' => 10, // Otp expiry in minutes e.g, 10
'length' => 6, // Length of otp code
'medium' => "sms", //sms or email
'phone_number' => "23324xxxxxxx", // In international format
'sender_id' => "TextCus", // Maximum 11 Characters
'message' => "Your TextCus Otp: %otp_code%",
'type' => "numeric" // numeric or alphanumeric
];
$url = 'https://api.textcus.com/api/v2/otp';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Sample Response
Last updated