Skip to content

Send OTP

POST {api-url}/sendOTP?ns={community}

Generates a secure One-Time PIN (OTP) and dispatches it to the user. This OTP can then be used to validate actions such as /resetPassword or /changeMSISDN.

If ResendIfActive is false, the API will simply return the existing OTP without firing a new SMS, provided the current OTP hasn’t expired.

FieldTypeRequirementDescription
UsernameStringRequiredThe username of the user.
IDNumberStringOptionalThe ID number of the user.
ExpiryStringOptionalTime in seconds until the OTP expires (defaults to 300 seconds).
ReferenceStringOptionalA unique state reference bound to this OTP request.
ResendIfActiveStringOptionalForce dispatch a new SMS even if the current OTP is active (true or false).
MetadataStringOptionalAny other detail to store with this transaction.
{
"Username": "27820000000",
"IDNumber": "",
"Expiry": "300",
"Reference": "REF123",
"ResendIfActive": "true",
"Metadata": ""
}
Terminal window
curl -X POST '{api-url}/sendOTP?ns={community}' \
-H 'Authorization: bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"Username":"27820000000","IDNumber":"","Expiry":"300","Reference":"REF123","ResendIfActive":"true","Metadata":""}'