Skip to main content
Programmable Messaging API

One API for global, trusted messaging

Integrate a multichannel API to send and receive transactional SMS, MMS, and WhatsApp messages.

Illustration of person using programmable api to connect through preferred channels

Build scalable messaging into your applications
with just a few lines of code

Diagram of programmable messaging api

Software for transactional messaging at any scale

Send alerts and notifications, promotions, and marketing messages on your customers’ favorite channels with one API. The Programmable Messaging API includes software for managing phone numbers, deliverability, compliance, replies, and more.

Use cases

Reliable, global business
messaging for any use case

Appointment reminders

Reduce no-shows by reminding customers of upcoming appointments to either confirm or reschedule over their preferred channels.

Lifecycle marketing

Increase customer conversion and retention with marketing messages sent over their preferred channels.

Account notifications

Keep customers updated on time-sensitive information with relevant, personalized account notifications.

Delivery notifications

Update customers on their delivery progress and offer two-way, self-service notifications.

Emergency alerts

Quickly send warning alerts, public safety advisories, event cancellations, and more to message recipients’ preferred channels.

Verifications and one-time passcodes

Verify users’ phone number at sign up or login to prevent bots, ensure customer trust, and guarantee accurate deliverability.


“Implementing Twilio was an easy lift from our perspective. We were able to realize our vision for improved customer experience very quickly.”

Raj Anbalagan, SVP of Digital Technology and Innovation

“With Twilio and [Twilio] SendGrid, we’ve been able to provide a very high caliber, high quality product that our customers are rating very well on a regular basis through NPS and CSAT.”

Andrea Wan, Head of SMS


Send and receive transactional messages
on the most popular channels

  • SMS

    Reach a global audience for one-way notifications, alerts, and promotions with SMS.

  • MMS

    Deliver rich marketing messages with multimedia capabilities using MMS.

  • WhatsApp

    Provide customer care and deliver notifications on the world’s most popular messaging app.

Developer resources

Send an SMS message
  • Node.js
  • Python
  • C#
  • Java
  • Go
  • PHP
  • Ruby
  • twilio-cli
  • curl
//Downloadthehelperlibraryfrom;constauthToken=process.env.TWILIO_AUTH_TOKEN;constclient=require('twilio')(accountSid,authToken);client.messages.create({body:'Hi there',from:'+15017122661',to:'+15558675310'}).then(message=>console.log(message.sid));
# Download the helper library from Find your Account SID and Auth Token at and set the environment variables. See['TWILIO_ACCOUNT_SID']auth_token=os.environ['TWILIO_AUTH_TOKEN']client=Client(account_sid,auth_token)message=client.messages.create(body='Hi there',from_='+15017122661',to='+15558675310')print(message.sid)
// Install the C# / .NET helper library from;usingTwilio;usingTwilio.Rest.Api.V2010.Account;classProgram{staticvoidMain(string[]args){// Find your Account SID and Auth Token at and set the environment variables. See"TWILIO_ACCOUNT_SID");stringauthToken=Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");TwilioClient.Init(accountSid,authToken);varmessage=MessageResource.Create(body:"Hi there",from:newTwilio.Types.PhoneNumber("+15017122661"),to:newTwilio.Types.PhoneNumber("+15558675310"));Console.WriteLine(message.Sid);}}
// Install the Java helper library from;;importcom.twilio.type.PhoneNumber;publicclassExample{// Find your Account SID and Auth Token at and set the environment variables. See"TWILIO_ACCOUNT_SID");publicstaticfinalStringAUTH_TOKEN=System.getenv("TWILIO_AUTH_TOKEN");publicstaticvoidmain(String[]args){Twilio.init(ACCOUNT_SID,AUTH_TOKEN);Messagemessage=Message.creator(newcom.twilio.type.PhoneNumber("+15558675310"),newcom.twilio.type.PhoneNumber("+15017122661"),"Hi there").create();System.out.println(message.getSid());}}
// Download the helper library from"fmt"""api"")funcmain(){// Find your Account SID and Auth Token at and set the environment variables. See{}params.SetBody("Hi there")params.SetFrom("+15017122661")params.SetTo("+15558675310")resp,err:=client.Api.CreateMessage(params)iferr!=nil{fmt.Println(err.Error())}else{ifresp.Sid!=nil{fmt.Println(*resp.Sid)}else{fmt.Println(resp.Sid)}}}
<?php// Update the path below to your autoload.php,// see'/path/to/vendor/autoload.php';useTwilio\Rest\Client;// Find your Account SID and Auth Token at and set the environment variables. See$sid=getenv("TWILIO_ACCOUNT_SID");$token=getenv("TWILIO_AUTH_TOKEN");$twilio=newClient($sid,$token);$message=$twilio->messages->create("+15558675310",// to["body"=>"Hi there","from"=>"+15017122661"]);print($message->sid);
# Download the helper library from'rubygems'require'twilio-ruby'# Find your Account SID and Auth Token at and set the environment variables. See['TWILIO_ACCOUNT_SID']auth_token=ENV['TWILIO_AUTH_TOKEN'],auth_token)message=@client.messages.create(body:'Hi there',from:'+15017122661',to:'+15558675310')putsmessage.sid
# Install the twilio-cli from twilio api:core:messages:create \ --body "Hi there" \ --from +15017122661 \ --to +15558675310
curl -X POST "$TWILIO_ACCOUNT_SID/Messages.json"\--data-urlencode "Body=Hi there"\--data-urlencode "From=+15017122661"\--data-urlencode "To=+15558675310"\-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

Read the Docs

Explore quick-start guides, code snippets, and a comprehensive resource library to kickstart your build with the Programmable Messaging API.


Powering next-generation
transactional messaging

Illustration real-time analytics for monitoring message delivery and engagement

Optimized message deliverability at scale

  • Global senders: Reach consumers in 180+ countries with localized senders, global guidelines, and regulatory compliance tools.
  • Real-time route optimization: Automatic rerouting of global traffic every 75s to avoid outages and latency.
  • Messaging Insights: Real-time analytics for monitoring and troubleshooting message delivery and engagement.
  • Message fallback: Automatic fallback to SMS when a message is not deliverable via WhatsApp or short code.
Illustration of verified trust hub experience reaching customer through vetted catalog of apis

Global business messaging at any scale

  • Super Network: 1,500+ tier-1 carrier connections, the widest footprint of data signals, and telco and ML experts provide unrivaled reliability.
  • High-volume global senders: A global, vetted catalog of high-throughput toll-free numbers, short codes, alphanumeric sender IDs, and 10-digit long codes.
  • Trust Hub and APIs: Onboard to verified communications from a centralized Console experience or integrate our APIs into third-party products.
  • SMS validity period: Dictate the length of time to attempt queued message delivery before failing to ensure urgent messages are delivered when relevant.
Illustration of scheduled message redaction to protect customer data

Take control of your business messaging

  • Advanced opt-out: Customize opt-ins and opt-outs for local regulations and languages in the Console.
  • Message redaction: Redact the last 4 digits of phone numbers and message bodies to protect sensitive data.
  • Message scheduling: Schedule SMS, MMS, or WhatsApp messages to be sent at a future date and time with a single API call. Included for free with Messaging Services.
  • Inbound message routing: Handle replies using inbound message webhooks, Twilio Studio, or Twilio Conversations for channel and participant flexibility.
Illustration of twilio segment integration to deliver a personalized customer experience

Create an engaging, omnichannel experience

  • Twilio Segment integration: Deliver personalized messages at scale using real-time, first-party data by integrating messaging into Twilio Segment.
  • Content API: Translate rich message content across multiple channels with a single framework.
  • MMS for long text messages: Send long text messages as MMS to reduce costs, maximize throughput, and ensure an appealing visual experience.


Scalable messaging solutions
with flexible pricing

Get started with the Programmable Messaging API for free. Only pay for the messages you send and receive, per phone number, and channel-specific fees. No commitments. Enjoy discounts for high-volume messaging.