Send OTP

POST/sms-api/otp/send

Generates a code, injects it into your message template at the <%otp_code%> placeholder and sends it. Keep the returned requestId to verify the code later.

Parameters

  • phoneNumberstringrequired

    Recipient number.

  • senderIdstringrequired

    The id (UUID) of an approved sender ID.

  • messagestringrequired

    Template that must contain <%otp_code%> where the code goes.

  • lengthintegeroptional

    Number of digits, minimum 4. Default 4.

  • expiryintegeroptional

    Minutes until the code expires, minimum 2. Default 5.

Errors

  • 402Insufficient balance. Please add funds to your account.
  • 422Invalid Sender ID
  • 422The message must contain the placeholder <%otp_code%>.

Request

curl -X POST "https://api.bulkclix.com/api/v1/sms-api/otp/send" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "phoneNumber": "0241234567",
  "senderId": "9b1c2a3d-4e5f-4a6b-8c7d-1e2f3a4b5c6d",
  "message": "Your MyShop verification code is <%otp_code%>. It expires in 5 minutes.",
  "length": 6,
  "expiry": 5
}'

Response · 200

application/json
{
  "message": "OTP sent",
  "data": {
    "otp": {
      "prefix": "Kx4Q",
      "requestId": "2d7e6f5a-9b8c-4d1e-a2f3-4b5c6d7e8f9a",
      "ussd_code": "*282*1#"
    }
  }
}