Send OTP
POST
/sms-api/otp/sendGenerates 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
phoneNumberstringrequiredRecipient number.
senderIdstringrequiredThe id (UUID) of an approved sender ID.
messagestringrequiredTemplate that must contain <%otp_code%> where the code goes.
lengthintegeroptionalNumber of digits, minimum 4. Default 4.
expiryintegeroptionalMinutes until the code expires, minimum 2. Default 5.
| Field | Type | Required | Description |
|---|---|---|---|
phoneNumber | string | required | Recipient number. |
senderId | string | required | The id (UUID) of an approved sender ID. |
message | string | required | Template that must contain <%otp_code%> where the code goes. |
length | integer | optional | Number of digits, minimum 4. Default 4. |
expiry | integer | optional | 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#" } } }