Developer Docs

Table of contents

Send SMS / 2Way SMS

The method allows sending an SMS.

Creating single SMS (“destination”:”phone”), bulk messaging (“destination”:”phones”) and customized SMS (“destination”:”individual”) are supported.

To send campaign, make a request to this URL:

PUT (POST) https://api.bsg.world/rest/sms/create

Single SMS

Request parameters

ParameterRequiredTypeDescription 
destinationYesstringset to “phone”
originatorYesstringsender. String up to 14 characters
bodyYesstringSMS message text
msisdnYesstringphone number to which the SMS is sent
referenceYesstringSMS external ID. String up to 32 characters containing /a-zA-Z0-9/
validityNointegerSMS validity time. The default is 72 hours. Integer from 1 to 72
tariffNointegertariff number. The default is 0. Integer from 0 to 9
2wayNoboolbelonging to 2WAY

Request sample

{
"destination":"phone", 
"msisdn": "380501234567",
"reference": "reference_id",
"originator": "sender",
"body":"test sms",
"2way": 1
}

Response parameters

ParameterTypeDescription
id integerthe message ID, a unique random identifier that is created on the BSG platform when an object is created
referencestringSMS external ID
pricefloatSMS price
currencystringсurrency in which the SMS price is specified

If the request is successful, you will receive a response:

{
"error":"0",
"id":"22125",
"reference":"12erdgm9",
"price":"0.02",
"currency":"EUR"
}

Bulk SMS campaign

Bulk SMS campaign contains one text for all recipient numbers.

Request parameters

ParameterRequiredTypeDescripton
destinationYesstringset to “phones”
phonesYesarrayvalues array
msisdnYesstringphone number to which the SMS is sent
referenceYesstringSMS external ID. String up to 32 characters containing /a-zA-Z0-9/
originatorYesstringSender name. String up to 14 characters
bodyYesstringSMS message text
validityNointegerSMS validity time. The default is 72 hours. Integer from 1 to 72
tariffNointegertariff number. The default is 0. Integer from 0 to 9
2wayNoboolbelonging to 2WAY

Request sample

{
"destination":"phones", 
"phones":[
{"msisdn": "380972000001","reference":"12erdgm9"},
{"msisdn": "380972000002","reference":"12erdgn0"}
],
"originator":"test",
"body":"test sms", 
"validity": 72,
"tariff":9
}

Response parameters

ParameterTypeDescription
idintegerSMS ID
referencestringSMS external ID
pricefloatSMS price
currencystringсurrency in which the SMS price is specified
task_idintegerCampaign ID, which is generated automatically by the system when creating a campaign.
The task_id parameter is used to request the status of the entire campaign

If the request is successful, you will receive a response:

{
"result":
[
{"reference":"12erdgm9",
"id":"12345",
"error":"0",
"price":"0.02",
"currency":"EUR"},
{"reference":"12erdgn0",
"id":"12346",
"error":"0",
"price":"0.02",
"currency":"EUR"}
],
"error":"0", 
"task_id":"21902"
}

Customized SMS campaign

Request parameters

ParameterRequiredTypeDescription
destinationYesstringset to “individual”
validityNointegerSMS validity time. The default is 72 hours. Integer from 1 to 72
tariffNointegertariff number. The default is 0. Integer from 0 to 9
2wayNoboolbelonging to 2WAY
phonesYesarrayvalues array
msisdnYesstringphone number to which the SMS is sent
referenceYesstringSMS external ID. String up to 32 characters containing /a-zA-Z0-9/
originatorYesstringSender name. String up to 14 characters
bodyYesstringSMS message text

Request sample

{
"validity": 72,
"tariff":9, 
"destination":"individual", 
"phones":
[
{"originator":"test1",
"body":"test sms1", 
"msisdn":"380972000001",
"reference": "12erdgm9"},
{"originator":"test2",
"body":"test sms2",
"msisdn": "380972000002",
"reference": "12erdgn0"}
] 
}

Response parameters

ParameterTypeDescription
idintegerSMS ID
referencestringSMS external ID
pricefloatSMS price
currencystringсurrency in which the SMS price is specified
total pricefloattotal campaign price.
currencystringсurrency in which the camapign price is specified

If the request is successful, you will receive a response:

{
"result":
[
{"reference":"12erdgm9",
"id":"12345",
"error":"0",
"price":"0.02",
"currency":"EUR"},
{"reference":"12erdgn0",
"id":"12346",
"error":"0",
"price":"0.02",
"currency":"EUR"}
],
"error":"0", 
"totalprice":"0.04",
"currency":"EUR"
}