Developer Docs

Table of contents

OTP API

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
Request parameters:
ParameterRequiredTypeDescription
destination YesstringSet to “otp”.
originatorYesstringThe name of the SMS sender. A string of up to 14 characters.
bodyYesstringSMS 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.
msisdnYesstringThe phone number to which the SMS is sent.
referenceNostringSMS external ID. A string of up to 32 characters containing /a-zA-Z0-9/

Request example:

{
    "originator": "testsms",
    "destination": "otp",
    "body": "Your code to log into the app: {gen_otp_09,4}",
    "msisdn": "85267202829",
    "reference": "SendSMS11062021_20"
}
Response parameters:
ParameterTypeDescription 
id integerSMS ID
referencestringexternal ID
pricefloatSMS price
currencystringThe currency of the account, in which the cost of the message is specified.
otp_codestringOTP 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"
    }
}

We use cookies (and other similar technologies) to collect data to improve your experience on our site. By using our website, you’re agreeing to the collection of data as described in our Website Data Collection Policy.