Send OTP

Send OTP

POST https://api.oneroute.io/api/oneotp/send

Send OTPs to customers with this endpoint. Provide the template, channels, recipient and indicate whether you'd like to generate your OTP or use the generated OTP.

Headers

NameTypeDescription

apikey

string

API Key for Authentication.

Request Body

NameTypeDescription

channels

array

A list of channels to send the OTP to. Allowed values are "WHATSAPP", "EMAILS", "SMS" and "USSD"

templateId

string

OTP Template to send to customer.

email

string

Email to send OTP to, if EMAIL channel is selected.

options.otp

string

OTP to use, overwrites the generated OTP.

options.length

number

Length of generated OTP. Defaults to 4

options.digits

boolean

If generated OTP should contain digits. Defaults to true.

options.alphabets

boolean

If generated OTP should contain alphabets. Defaults to false

options.upperCase

boolean

If generated OTP should contain upperCase letters. Defaults to false.

options.specialChars

boolean

If generated OTP should contain special characters. Defaults to false

options.minutes

number

Number of minutes the OTP should last. Defaults to 5 minutes.

phoneNumber

string

The phone number to send WHATSAPP, SMS or USSD to. Required if any of those channels are selected.

{
    "body": {
        "key": "B2LN36qdsQ3x1PK6mpcbOjz8IBpskZtWbxPJqmKULX4tRDy4dZsBr9pXX2tEjyk5+dDGtKJvzYFS0C9BaUbXGGJ5SknlDLNa+S5AerAcXeCgdDqC37IoRJ6xzDrJhAfuySqJkYrNDC2rz+bTztC2hJFjN7YxikLt2XOv14qQMgeGCBG8sTqtJqaAz9eAFCKKks6u3bbLbWGO68JKF/SInMEuMDvAhyD/EE8k86xJCCkzp0LnILlXUi9d6XzieuBKk8xIVv5+aHQ3VRhnmahkxA==",
        "data": [
            {
                "medium": "WHATSAPP",
                "data": "gBGHI0kFNWAgTwIJqUIvBBh1yT38"
            },
            {
                "medium": "SMS",
                "data": "33333530654203571912"
            },
            {
                "medium": "EMAIL",
                "data": "Sent successfully"
            }
        ],
        "errors": []
    },
    "message": "Otp sent successfully",
    "success": true
}

Example Request Payload

{
    "channels": ["WHATSAPP", "SMS", "EMAIL"],
    "phoneNumber": "+2349XXXXXXXX",
    "templateId": "63d45b42-0898-43b3-b81d-1fb2d45bc78f",
    "options": {
        "length": 6,
        "digits": true,
        "alphabets": false,
        "minutes": 10
    },
    "email": "email@example.com"
}

Last updated