Send transactional SMS

Transactional SMS is a solution for non-promotional SMS using the recipient’s phone number instead of an email address. Use it to send notifications and confirmations, such as for online orders.

Requirements

Get your API key from your settings (SMTP & API).

If you are new to the API, read more about how the API works.


Send SMS message to a mobile number

Additional info for type and content params

type param: to ensure the [STOP CODE] is correctly substituted, specify the type as “marketing” when using the transactional SMS API endpoint. If your SMS content includes [STOP CODE], select the type as “marketing.”

content param when type is marketing: on some routes, the short code automatically replaces the alphanumeric SenderID if you do not add an opt-out [STOP CODE].

This endpoint is https://api.brevo.com/v3/transactionalSMS/send with the POST method. A sample cURL request:

1curl --request POST \
2 --url https://api.brevo.com/v3/transactionalSMS/send \
3 --header 'accept: application/json' \
4 --header 'api-key: YOUR-API-KEY' \
5 --header 'content-type: application/json' \
6 --data '
7{
8 "sender": "MyShop",
9 "recipient": "33680065433",
10 "content": "Enter this code:CAAA08 to validate your account",
11 "type": "marketing",
12 "tag": "\"tag1\" OR [\"tag1\", \"tag2\"]",
13 "webUrl": "https://webhook.site/100lyyx1",
14 "unicodeEnabled": true,
15 "organisationPrefix": "MyCompany"
16}
17'

The params are listed below:

Attribute nameDatatypeDescriptionValue
senderStringName of the sender. The number of characters is limited to 11 for alphanumeric characters and 15 for numeric charactersMyShop
recipientStringMobile number to send SMS with the country code33680005003
contentStringContent of the message. If more than 160 characters long, will be sent as multiple text messagesEnter this code:CCJJG8 to validate your account
typeStringType of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc.Choice of Transactional and Marketing
tagStringTag of the messageaccountValidation
webUrlUrlWebhook to call for each event triggered by the message (delivered etc.)https://webhook.site/173lyyx1
unicodeEnabledBooleanFormat of the message. It indicates whether the content should be treated as unicode or not.Boolean true or false
organisationPrefixStringA recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.Brand name like My Company

A successful 201 response:

1{
2 "messageId": 1511882900100020,
3}

A 400 error code indicates a bad request.

Get your SMS activity aggregated over a period of time

This request uses the endpoint https://api.brevo.com/v3/transactionalSMS/statistics/aggregatedReport with the GET method. Sample cURL request:

1curl --request GET \
2 --url 'https://api.brevo.com/v3/transactionalSMS/statistics/aggregatedReport?startDate=&endDate=&days=23&tag=' \
3 --header 'accept: application/json' \
4 --header 'api-key: '

Query params:

AttributeDatatypeDescriptionValue
startDateStringMandatory if endDate is used. Starting date (YYYY-MM-DD) of the report2024-01-25
endDateStringMandatory if startDate is used. Ending date (YYYY-MM-DD) of the report2024-02-25
daysint64Number of days in the past including today (positive integer). Not compatible with startDate and endDate10
tagStringFilter on a tagtagged

A successful response:

1{
2 "range": "2015-05-22|2017-11-29",
3 "requests": 54,
4 "delivered": 16,
5 "hardBounces": 5,
6 "softBounces": 26,
7 "blocked": 4,
8 "unsubscribed": 10,
9 "replied": 8,
10 "accepted": 6,
11 "rejected": 14
12}

Get your SMS activity aggregated per day

This request uses the endpoint https://api.brevo.com/v3/transactionalSMS/statistics/reports with the GET method. Sample cURL request:

1curl --request GET \
2 --url 'https://api.brevo.com/v3/transactionalSMS/statistics/reports?sort=desc' \
3 --header 'accept: application/json'

Add more query params to the --url value. The params are listed below.

AttributeDatatypeDescriptionValue
startDateStringMandatory if endDate is used. Starting date (YYYY-MM-DD) of the report2024-01-25
endDateStringMandatory if startDate is used. Ending date (YYYY-MM-DD) of the report2024-02-25
daysint64Number of days in the past including today (positive integer). Not compatible with startDate and endDate10
tagStringFilter on a tagtagged
sortStringSort the results in the ascending/descending order of record creation. Default order is descending if sort is not passeddesc

A successful response:

1{
2 "reports": [
3 {
4 "date": "2017-04-30",
5 "requests": 10756,
6 "delivered": 10103,
7 "hardBounces": 21,
8 "softBounces": 137,
9 "blocked": 1026,
10 "unsubscribed": 720,
11 "replied": 5091,
12 "accepted": 2318,
13 "rejected": 0,
14 "skipped": 0
15 },
16 {
17 "date": "2017-05-01",
18 "requests": 18812,
19 "delivered": 17499,
20 "hardBounces": 34,
21 "softBounces": 254,
22 "blocked": 1514,
23 "unsubscribed": 1090,
24 "replied": 10089,
25 "accepted": 4393,
26 "rejected": 0,
27 "skipped": 0
28 },
29 {
30 "date": "2017-05-02",
31 "requests": 14321,
32 "delivered": 13427,
33 "hardBounces": 16,
34 "softBounces": 176,
35 "blocked": 1646,
36 "unsubscribed": 1170,
37 "replied": 11563,
38 "accepted": 4689,
39 "rejected": 0,
40 "skipped": 1
41 }
42 ]
43}

Get all your SMS activity (unaggregated events)

This request uses the endpoint https://api.brevo.com/v3/transactionalSMS/statistics/events with the GET method. Sample cURL request:

1curl --request GET \
2 --url 'https://api.brevo.com/v3/transactionalSMS/statistics/events?limit=50&offset=0&sort=desc' \
3 --header 'accept: application/json'

The query params for this endpoint are listed below.

AttributeDatatypeDescriptionValue
startDateStringMandatory if endDate is used. Starting date (YYYY-MM-DD) of the report2024-01-25
endDateStringMandatory if startDate is used. Ending date (YYYY-MM-DD) of the report2024-02-25
daysint64Number of days in the past including today (positive integer). Not compatible with startDate and endDate10
tagStringFilter on a tagtagged
sortStringSort the results in the ascending/descending order of record creation. Default order is descending if sort is not passeddesc
limitint64Number of documents per page50
offsetStringIndex of the first document of the page2
phoneNumberStringFilter the report for a specific phone numbertag1
eventStringFilter the report for specific eventsIncludes events like bounces, delivered, accepted etc.

A successful response:

1{
2 "events": [
3 {
4 "phoneNumber": "00911059469013",
5 "date": "2015-05-20T12:30:00Z",
6 "messageId": "1473139351170140",
7 "event": "sent",
8 "reason": "Recipient is currently unreachable",
9 "tag": "cabWaiting"
10 },
11 {
12 "phoneNumber": "00911059469013",
13 "date": "2015-05-20T16:30:00Z",
14 "messageId": "1473139351170140",
15 "event": "delivered",
16 "reason": "Recipient is currently unreachable",
17 "tag": "cabRequest"
18 }
19 ]
20}