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"
Placeholders
Two tokens are replaced in your message before sending:
%otp_code%
The generated code
%expiry%
Your expiry value
Sample Requests
Sample Response
Failures
HTTP
message
Cause
422
Validation message
A parameter is missing or out of range.
400
Sender ID is not registered or not approved...
Sender unknown or unapproved.
200
Insufficient SMS balance, Please top up your account!
Not enough credits.
500
Failed to send OTP. Please try again.
Delivery failed. Safe to retry.
Credits are counted with the same formula as /send, based on the final message after placeholder substitution.
Last updated