# Send SMS / 2Way SMS

> Send SMS with the BSG REST API: single, bulk and personalized messages, request and response parameters, 2Way SMS and code samples.

Canonical page: https://bsg.world/developers/rest-api/sending-sms

### BSG migrated to the new DevPortal to ship the latest One API versions faster

Use it for up-to-date endpoints, guides, and changelogs

[Go to the new DevPortal](https://docs.bsg.dev/)

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

| **Parameter** | **Required** | **Type** | **Description** |
| --- | --- | --- | --- |
| destination | Yes | string | set to “phone” |
| originator | Yes | string | sender. String up to 14 characters |
| body | Yes | string | SMS message text |
| msisdn | Yes | string | phone number to which the SMS is sent |
| reference | No | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
| validity | No | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
| tariff | No | integer | tariff number. The default is 0. Integer from 0 to 9 |
| 2way | No | bool | belonging to 2WAY |

#### Request sample

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

#### Response parameters

| **Parameter** | **Type** | **Description** |
| --- | --- | --- |
| id | integer | the message ID, a unique random identifier that is created on the BSG platform when an object is created |
| reference | string | SMS external ID |
| price | float | SMS price |
| currency | string | currency 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

| **Parameter** | **Type** | **Description** |
| --- | --- | --- |
| destination | string | set to “phones” |
| phones | array | values array |
| msisdn | string | phone number to which the SMS is sent |
| reference | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
| originator | string | Sender name. String up to 14 characters |
| body | string | SMS message text |
| validity | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
| tariff | integer | tariff number. The default is 0. Integer from 0 to 9 |
| 2way | bool | belonging to 2WAY |

#### Response parameters

| **Parameter** | **Type** | **Description** |
| --- | --- | --- |
| id | integer | SMS ID |
| reference | string | SMS external ID |
| price | float | SMS price |
| currency | string | currency in which the SMS price is specified |
| task_id | integer | Campaign 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:

### Customized SMS campaign

#### Request parameters

| **Parameter** | **Required** | **Type** | **Description** |
| --- | --- | --- | --- |
| destination | Yes | string | set to “individual” |
| validity | No | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
| tariff | No | integer | tariff number. The default is 0. Integer from 0 to 9 |
| 2way | No | bool | belonging to 2WAY |
| phones | Yes | array | values array |
| msisdn | Yes | string | phone number to which the SMS is sent |
| reference | No | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
| originator | Yes | string | Sender name. String up to 14 characters |
| body | Yes | string | SMS message text |

#### Request sample

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

#### Response parameters

| **Parameter** | **Type** | **Description** |
| --- | --- | --- |
| id | integer | SMS ID |
| reference | string | SMS external ID |
| price | float | SMS price |
| currency | string | currency in which the SMS price is specified |
| total price | float | total campaign price. |
| currency | string | currency 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",
"task_id":"21902"
}
```

## Useful Materials
