One Time Password (OTP)
This endpoint is used for verification process when authenticating a user on your platform.
Endpoint
GET https://api.textcus.com/api/v2/otp
Headers
Authorization: Bearer API_KEY
Request Parameters
Below is a list of parameters when issuing an HTTP Request.
expiry
Required
This is your OTP from TextCus: %otp_code%. The code will expire in %expiry% minutes.
length
Required
This parameter specifies the number of characters or digits in the generated code.
message
Required
Enter your message content here. One message page equals 160 characters — for example, a 200-character message will count as 2 pages. Be sure to include the %otp_code% placeholder where the generated code should appear in the message.
medium
Required
Enum: "sms" or "email"
phone_number
Required
The phone number of the contact.
sender_id
Required
A Sender ID is the name or number that appears as the sender of an SMS message. This field must not exceed 11 characters, including spaces — exceeding this limit may cause your messages to fail.
type
Required
Enum: "numeric" or "alphanumeric"
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