SMS API | Textbelt

A simple API for outgoing text messages

TextBelt is an SMS gateway API. There are two versions:

Since its creation, Textbelt has sent over 3 million texts from the command line and other software clients!

Send a text message with an HTTP request

Try it now. No client libraries, recurring billing, or account logins:

$ curl -X POST https://textbelt.com/text \
       --data-urlencode number='5557727420' \
       --data-urlencode message='Hello world' \
       -d key=textbelt
Using the popular requests library:
import requests
requests.post('https://textbelt.com/text', {
  'number': '5557727420',
  'message': 'Hello world',
  'key': 'textbelt',
})
require 'net/http'
require 'uri'

uri = URI.parse("https://textbelt.com/text")
Net::HTTP.post_form(uri, {
  :number => '5557727420',
  :message => 'Hello world',
  :key => 'textbelt',
})
Using the popular request library:
var request = require('request');
request('https://textbelt.com/text', {
  body: {
    number: '5557727420',
    message: 'Hello world',
    key: 'textbelt',
  },
})
var response = Http.Post("https://textbelt.com/text", new NameValueCollection() {
  { "number", "5557727420" },
  { "message", "Hello world" },
  { "key", "textbelt" },
});
$ch = curl_init('https://textbelt.com/text');
$data = array(
  'number': '5557727420',
  'message': 'Hello world',
  'key': 'textbelt',
);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
Using the popular Apache HttpComponents library (Fluent API):
Request.Post("https://textbelt.com/text").bodyForm(Form.form()
  .add("number", "5557727420")
  .add("message", "Hello world")
  .add("key", "Textbelt")
  .build())
 .execute().returnContent();

Use the textbelt key to send an example text. You'll need your own key to send custom messages.

To text internationally, use the E.164 format (+ country code with numbers, no spaces). For example, a Brazilian phone number is +5511912345678 and a UK phone number is +447712345678.

Success and Failure

Example success response:
{sending: true, quotaRemaining: 40, textId: 12345}
Example out-of-quota or invalid key response:
{sending: false, quotaRemaining: 0, error: 'Out of quota'}
Example response to request with number, message, or key missing:
{sending: false, error: 'Incomplete request'}

Look up text delivery status

Use the textId given by a successful POST to the /text endpoint. For example, if your textId is 12345:
$ curl https://textbelt.com/status/12345
This will give a response like:
{status: 'DELIVERED'}

Possible return values include DELIVERED (received by target number), SENDING (sent to provider but receipt not confirmed), FAILED (not received), and UNKNOWN (could not determine status).

Testing your key

If you want to validate your key without actually using your text quota, append "_test" to your key and you will receive a response that confirms a text would have been sent:
{sending: true, quotaRemaining: 40, textId: -1, inTestMode: true}

Get started

Now you're ready to go. Fill out the form below to generate a key.

Generate a key to send texts

If you already have one, add funds to an existing key.

Get Key

Get in touch

Any questions? Email [email protected], text +1 (650) 332-4607, or read the FAQ.