Developer Docs
This method allows to generate and send a one-time authentication password for your service via SMS.
To send OTP, make a request to this URL:
POST https://api.bsg.world/rest/sms/create |
Parameter | Required | Type | Description |
destination | Yes | string | Set to “otp”. |
originator | Yes | string | The name of the SMS sender. A string of up to 14 characters. |
body | Yes | string | SMS message text. The text must contain a variable in the form {gen_otp_09,4}, where: {gen_otp_09,9} – generation of a numeric code using values from 0 to 9, 9 characters long {gen_otp_az,9} – generation of an alphabetic code using values from a to z, using only lower case, 9 characters long {gen_otp_aZ,9} – generation of letter code using values from a to z using upper and lower case, 9 characters long {gen_otp_AZ,9} – generation of an alphabetic code using values from a to z using only upper case, 9 characters long {gen_otp_a9,9} – generation of an alphanumeric code using values from a to 9 using upper and lower case, 9 characters long {gen_otp_**,9} – generation of an alphanumeric code using special characters, including, in addition to numbers, the letters of different cases, 9 characters long. The number after the comma specifies the exact number of characters in the verification code. For example, “Your authorization code: {gen_otp_09,4}” is a 4-digit digital code. |
msisdn | Yes | string | The phone number to which the SMS is sent. |
reference | No | string | SMS external ID. A string of up to 32 characters containing /a-zA-Z0-9/ |
{
"originator": "testsms",
"destination": "otp",
"body": "Your code to log into the app: {gen_otp_09,4}",
"msisdn": "85267202829",
"reference": "SendSMS11062021_20"
}
Parameter | Type | Description |
id | integer | SMS ID |
reference | string | external ID |
price | float | SMS price |
currency | string | The currency of the account, in which the cost of the message is specified. |
otp_code | string | OTP code generated by the BSG system. |
If request is successful, you will receive a response:
{
"result": {
"error": 0,
"errorDescription": "No errors",
"reference": "SendSMS11062021_21",
"id": "1979094456",
"price": 0,
"currency": "EUR",
"otp_code": "4718"
}
}