Sending an SMS

This endpoint allows you to start sending SMSs through MailerSend SMS API.

Send an SMS

This endpoint allows you to send an asynchronous SMS. It returns the status of the SMS sent with a X-SMS-Message-Id that can be used to continuously query for the status using the SMS API.

Send an SMS using this POST request:

POST https://api.mailersend.com/v1/sms
1

Request Body

{
  "from": "+19191234567",
  "to": [
    "+19191234567",
    "+19199876543"
  ],
  "text": "Hey {{name}}! This is just a friendly hello :D",
  "personalization": [
    {
      "phone_number": "+19191234567",
      "data": {
        "name": "Dummy"
      }
    },
    {
      "phone_number": "+19199876543",
      "data": {
        "name": "Not Dummy"
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Request parameters

JSON parameters are provided in dot notation

JSON parameterTypeRequiredLimitationsDetails
fromstringyesNumber belonging to your account in E164 format
tostring[]yesmin:1,max:50
to.*stringyesUS, CAThe phone number(s) the message should be sent to in E164 format
textstringyesMax lenght:2048The contents of the text message. Must be 2048 characters or less.
If the body of your message is more than 160 GSM-7 characters or 70 UCS-2 characters, MailerSend will split the message into a segmented SMS and add a special header (User Data Headeropen in new window). Please note you are billed by segment.
The User Data Header (UDH) takes up 6 bytes and instructs the receiving device how to reassemble the segments so that your whole message will be shown as one SMS on the receiving handset. The maximum number of characters per concatenated (long) message is slightly reduced due to the inclusion of concatenation headers (UDH).
You can see the difference between GSM-7 and UCS-2 and how they're segmented hereopen in new window.
personalizationobject[]noAllows using personalization in {{ var }} syntax. Can be used in the text fields. Read more about advanced personalization.
personalization.*.phone_numberstringyesPhone number that personalization will be applied to.
personalization.*.dataobject[]yesObject with key: value pairs. Values will be added to your template using {{ key }} syntax.

Responses

Sending queued

Response Code: 202 Accepted
Response Headers:
	Content-Type: text/plain; charset=utf-8
	X-SMS-Message-Id: 5e42957d51f1d94a1070a733
Response Body: [EMPTY]
1
2
3
4
5

Sending paused

Response Code: 202 Accepted
Response Headers:
	Content-Type: text/plain; charset=utf-8
	X-SMS-Message-Id: 5e42957d51f1d94a1070a733
  X-SMS-Send-Paused: true
Response Body: [EMPTY]
1
2
3
4
5
6

Validation error

Response Code: 422 Unprocessable Entity
Response Headers:
	Content-Type: application/json
1
2
3
{
  "message": "The given data was invalid.",
  "errors": {
    "from": [
      "The from field contains an invalid number."
    ]
  }
}
1
2
3
4
5
6
7
8

See - Validations errors

Last Updated: