Send SMS api

Send SMS api

SMS

Deliver at scale with proven APIs for SMS

Send and receive text messages with just a few lines of code on MessagingX, the trusted platform for cross-channel messaging.

Start for free
Twilio's SMS API helps you deliver messages securely at-scale

Engage customers globally with reliable SMS messaging

Launching a trusted SMS solution is easy with MessagingX. Twilio gives you developer-friendly APIs, scalability, and built-in software for compliance, routing, and advanced use cases. All to help you get to market faster, and with unmatched deliverability.

APIs


Scale from concept to global solution with flexible SMS APIs

Twilio Programmable Messaging API

Programmable Messaging API

Send transactional MMS, SMS, and WhatsApp messages with a single API.

  • Reach 180+ countries reliably with localized senders, compliance tools, and global guidelines.

  • Manage compliance, deliverability, replies, and more with Twilio’s programmable software.

  • Monitor and troubleshoot message delivery and engagement with real-time analytics.

Explore the Programmable Messaging API
Twilio Conversations API

Conversations API

Drive two-way engagement with cross-channel messaging for MMS and more using a single API.

  • Power commerce and support on SMS, MMS, chat, Facebook Messenger, Google’s Business Messages, and WhatsApp.

  • Manage participants, archive messages, and orchestrate workflows without additional code.

  • Get to market faster with quick-starts, sample apps, and SDKs.

Explore the Conversations API

Use cases


Start and scale customer relationships

Notifications

Send personalized alerts, reminders, and notifications for appointments, deliveries, and more with the Programmable Messaging API.

Verifications

Deliver one-time passwords for fast onboarding that reduces support costs and fraud at once.

Promotions

Distribute marketing messages and offers with the Programmable Messaging API to drive leads, sales, and loyalty.

Conversational care and commerce

Support the full customer journey with two-way, SMS for support, sales, and lead generation with the Conversations API.

A Forrester Consulting study about the ROI of Twilio Messaging.

Resources

The Total Economic Impact™ of Twilio Messaging

A commissioned study conducted by Forrester Consulting found Twilio Messaging provided a 3% increase in messages delivered, a 15% improvement among development teams, and a 30 to 40% opt-in rate for SMS marketing.

View the 2023 study

Developer resources


Read the Docs

Explore quick-start guides, code snippets, SDKs, and more in our comprehensive resource library to kickstart your build for Facebook Messenger with MessagingX.

Read SMS DocsGet started with MessagingX

Create a message

// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);

client.messages
      .create({from: '+15017122661', body: 'Hi there', to: '+15558675310'})
      .then(message => console.log(message.sid));
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client


# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

message = client.messages.create(
                              from_='+15017122661',
                              body='Hi there',
                              to='+15558675310'
                          )

print(message.sid)
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;


class Program
{
    static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var message = MessageResource.Create(
            from: new Twilio.Types.PhoneNumber("+15017122661"),
            body: "Hi there",
            to: new Twilio.Types.PhoneNumber("+15558675310")
        );

        Console.WriteLine(message.Sid);
    }
}
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Message message = Message.creator(
                new com.twilio.type.PhoneNumber("+15558675310"),
                new com.twilio.type.PhoneNumber("+15017122661"),
                "Hi there")
            .create();

        System.out.println(message.getSid());
    }
}
require_once '/path/to/vendor/autoload.php';

use Twilio\\Rest\\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
\$sid = getenv("TWILIO_ACCOUNT_SID");
\$token = getenv("TWILIO_AUTH_TOKEN");
\$twilio = new Client(\$sid, \$token);

\$message = \$twilio->messages
                  ->create("+15558675310", // to
                           ["from" => "+15017122661", "body" => "Hi there"]
                  );

print(\$message->sid);
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

message = @client.messages.create(
                             from: '+15017122661',
                             body: 'Hi there',
                             to: '+15558675310'
                           )

puts message.sid
# Install the twilio-cli from https://twil.io/cli

twilio api:core:messages:create \\
    --from +15017122661 \\
    --body "Hi there" \\
    --to +15558675310
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/\$TWILIO_ACCOUNT_SID/Messages.json" \\
--data-urlencode "From=+15017122661" \\
--data-urlencode "Body=Hi there" \\
--data-urlencode "To=+15558675310" \\
-u \$TWILIO_ACCOUNT_SID:\$TWILIO_AUTH_TOKEN

Pricing


SMS made easy with MessagingX

Send and receive text messages at scale with two developer-friendly APIs in one trusted platform, MessagingX. Pay as you go and enjoy scaling discounts for high-volume and long-term use.

See pricingExplore MessagingX