# Transactional SMS API

Enjoy the over 98% open rate of transactional SMS with MailerSend's SMS API\*. Enhance the customer experience by sending high-volume, toll-free text messages using a unique and recognizable phone number.

[Try for free](/content/signup/index.html)

## Deliver all types of transactional SMS messages

###### Appointment reminders

Remind clients and patients about upcoming appointments and improve late and no-show rates.

###### Order confirmations

Reassure customers that their order has been received with an order confirmation SMS.

\\
\\
**OTPs and 2FA** \\
\\
Make your app more secure with one-time password and 2-factor authentication text messages.\\
\\
Learn more](/content/blog/one-time-passwords-otps/index.html)

###### Payment and billing notifications

Keep customers in the know about payment and billing activity with a quick, convenient SMS.

###### Security alerts

Let customers know immediately about potential security breaches or unauthorized use of their accounts.

###### Shipping & delivery notifications

Keep customers updated about the status of their order by telling them when its shipped, out for delivery and delivered.

## Reach more customers with transactional messaging

Improve the customer journey with an additional communication channel and send timely SMS messages directly to recipients' phone numbers.

**Built for scalability**

**You write, we encode**

**Smart delivery**

## Multiple sending configurations

Send qualified SMS text messages to opt-in recipients, triggered by their actions or your email flow. Automatically stop sending when they opt out.

**Webhooks**

**Suppression management**

**Bulk SMS**

**Interoperability with email**

## Customize messages to fit your brand

Your brand is your most valuable asset—make it shine while increasing customer engagement with pre-made templates, GIFs and images.

**Personalization**

**SMS Templates**

**Media attachments**

**Sender locality**

## Developer-friendly resources

Start to send and receive SMS in minutes with our regularly updated SDK libraries, low-code/no-code integrations and comprehensive SMS API documentation.

[Read our API docs](https://developers.mailersend.com/)

[cURL](/content/features/sms-api/index.html) [Node.js](/content/features/sms-api/index.html) [PHP](/content/features/sms-api/index.html) [Python](/content/features/sms-api/index.html) [Ruby](/content/features/sms-api/index.html) [Go](/content/features/sms-api/index.html) [Java](/content/features/sms-api/index.html)

```bash
curl -X POST \
https://api.mailersend.com/v1/sms \
-H 'Content-Type: application/json' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'Authorization: Bearer {place your token here without brackets}' \
-d '{
    "from": "+18332552485",
    "to": [\
        "+12345678900",\
    ],
    "text": "This is just a friendly hello"
}'
```

```javascript
"use strict";
require('dotenv').config()

const { MailerSend, SMSParams } = require("mailersend");

const mailersend = new MailerSend({
    apiKey: process.env.API_KEY,
});

const recipients = [\
    "+18332647501"\
];

const smsParams = new SMSParams()
    .setFrom("+18332647501")
    .setRecipients(recipients)
    .setText("This is the text content");

mailersend.sendSms(smsParams);
```

```php
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\SmsParams;

$mailersend = new MailerSend(['api_key' => 'key']);

$smsParams = (new SmsParams())
    ->setFrom('+12065550101')
    ->setTo(['+12065550102'])
    ->addRecipient('+12065550103')
    ->setText('Text');

$sms = $mailersend->sms->send($smsParams);
```

```python
from mailersend import MailerSendClient, SmsSendingBuilder

ms = MailerSendClient()

# Simple SMS
request = (SmsSendingBuilder()
          .from_number("sms-number")
          .to(["+1234567890", "+1234567891"])
          .text("Hello from MailerSend SMS!")
          .build())

response = ms.sms_sending.send(request)

# SMS with personalization
request = (SmsSendingBuilder()
          .from_number("sms-number")
          .to(["+1234567890", "+1234567891"])
          .text("Hello {{name}}, your order {{order_id}} is ready!")
          .personalization([\
              {\
                  "phone_number": "+1234567890",\
                  "data": {"name": "John", "order_id": "12345"}\
              },\
              {\
                  "phone_number": "+1234567891",\
                  "data": {"name": "Jane", "order_id": "12346"}\
              }\
          ])
          .build())

response = ms.sms_sending.send(request)
```

```ruby
require "mailersend-ruby"

# Intialize the SMS class
ms_sms = Mailersend::SMS.new

# Add parameters
ms_sms.add_from('your-number')
ms_sms.add_to('client-number')
ms_sms.add_text('This is the message content')
personalization = {
  phone_number: 'client-number',
  data: {
    test: 'Test Value'
  }
}
ms_sms.add_personalization(personalization)

# Send the SMS
ms_sms.send
```

```go
package main

import (
	"context"
	"os"
	"fmt"
	"time"

"github.com/mailersend/mailersend-go"
)

func main() {
	// Create an instance of the mailersend client
	ms := mailersend.NewMailersend(os.Getenv("MAILERSEND_API_KEY"))

ctx := context.Background()
	ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
	defer cancel()

message := ms.Sms.NewMessage()
	message.SetFrom("your-number")
	message.SetTo([]string{"client-number"})
	message.SetText("This is the message content {{ var }}")

personalization := []mailersend.SmsPersonalization{
		{
			PhoneNumber: "client-number",
			Data: map[string]interface{}{
				"var": "foo",
			},
		},
	}

message.SetPersonalization(personalization)

res, _ := ms.Sms.Send(context.TODO(), message)
	fmt.Printf(res.Header.Get("X-SMS-Message-Id"))
}
```

```javascript
import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;

public void sendSms() {

MailerSend ms = new MailerSend();
    ms.setToken("mailersend token");

try {

String messageId = ms.sms().builder().from("from phone number")
        .addRecipient("to phone number")
        .text("test sms {{name}}")
        .addPersonalization("to phone number", "name", "name personalization")
        .send();

System.out.println(messageId);

} catch (MailerSendException e) {

e.printStackTrace();
    }
}
```

## Spark conversations

Take customer support to the next level by allowing recipients to reply and engage in conversations via SMS.

**Inbound SMS routing**

## Easily scale sendings with bulk transactional SMS

Optimize your sendings and preserve your API quota by scheduling transactional text messages with the bulk SMS endpoint.

## Go multi-channel with WhatsApp

Build multi-channel message flows and fallback logic with the [WhatsApp API](/content/features/whatsapp/index.html). Skip the lengthy, complex direct integration with Meta and start sending to customers in 180+ countries.

## Transactional SMS integrations

Easily connect other web apps with MailerSend so they seamlessly work together to share information, automate workflows and enhance your customer experience.

Zapier](/content/integrations/mailersend-zapier-integration/index.html) Make](/content/integrations/mailersend-make-integration/index.html) [All integrations](/content/integrations/index.html)

## Plus, the same great MailerSend features:

###### Easy management

Manage multiple phone numbers from your API, keeping suppressions and templates separate.

###### Activity & Analytics

View your activity in real-time to gain insights about SMS delivery and recipient activity and make adjustments when needed.

###### Account management

Effortlessly manage each user and their level of access to your emails, SMS activity or individual phone numbers.

## Frequently Asked Questions

[**\*Where is SMS coverage available?**](/content/features/sms-api/index.html)

MailerSend's transactional SMS service is currently available in the US and Canada. We are working on bringing coverage to additional regions—keep an eye on our [roadmap](/content/roadmap/index.html) for updates.

[**What types of SMS can I send?**](/content/features/sms-api/index.html)

You can send any [type of message in relation to your business](/content/blog/transactional-sms-for-businesses/index.html) as long as you have received opt-in consent to send messages to the recipient's mobile device and follow the Telephone Consumer Protection Act guidelines.

This includes, but is not limited to, shipping notifications, delivery updates, 2-factor authentication, appointment and event reminders, emergency alerts, one-time passwords, order status updates, booking/reservation confirmation and cancellation, payment and billing alerts, and general alerts, notices and updates. You cannot use the transactional SMS service to send promotional SMS messages.

[**How do I receive SMS replies?**](/content/features/sms-api/index.html)

With MailerSend's inbound routing feature, you can create inbound routes to have MailerSend receive incoming messages on your behalf and integrate them into your app.

[**Does this work for OTP's and 2FA texts?**](/content/features/sms-api/index.html)

Yes, you can use MailerSend's SMS API to send [one-time passwords](/content/blog/one-time-passwords-otps/index.html) (OTPs) and 2-factor authentication (2FA) texts.

[**How can I purchase a phone number?**](/content/features/sms-api/index.html)

All Starter, Professional, and Enterprise accounts come with a complimentary trial phone number for testing purposes. Once you're ready to begin sending SMS messages to your customers, you can purchase a dedicated phone number as an add-on via the **Plan and Billing** page in your MailerSend account. For detailed guidance, refer to our help articles on [how to purchase an SMS phone number](/content/help/how-to-purchase-an-sms-phone-number/index.html) and [how to start sending SMS](/content/help/how-to-start-sending-sms/index.html).

MailerSend's SMS pricing is seamlessly integrated into our paid plans. Depending on your chosen plan, you'll receive a certain number of SMS messages included.

For example:

• Our base plan includes 100 SMS messages.

• Additional SMS usage on this plan level would be billed as $1.40 per 100 SMS messages.

For a comprehensive breakdown of SMS pricing and to determine which plan best suits your needs, please visit our [pricing page](/content/pricing/index.html). Here, you'll find detailed information on plan features, including email volumes, SMS allowances, and pricing for additional usage.

[**Do I need consent for transactional SMS?**](/content/features/sms-api/index.html)

Although opt-in consent isn't needed for transactional email, to send messages to a recipient's phone number, **you must have first received consent to do so**.

As well as complying with the Telephone Consumer Protection Act (TCPA), receiving clear, informed opt-in consent from recipients will also ensure higher levels of engagement and lower opt-out rates.

[**What phone number can I use?**](/content/features/sms-api/index.html)

Toll free numbers will be available for purchase through the app.

## Enrich your customer communication with SMS notifications

Get started with real-time SMS service for appointment reminders, two-factor authentication, time-sensitive notifications, service alerts, booking/order confirmation, and more using our REST API.

[Try for free](/content/signup/index.html)
