Textbelt is a no-nonsense SMS API built for developers who just want to send SMS. Thousands of customers prefer Textbelt over other SMS providers for our ease of setup, simple, predictable pricing packages, and personal support.
Create an API key Start developing
$ curl -X POST https://textbelt.com/text \
--data-urlencode phone='5555555555' \
--data-urlencode message='Hello world' \
-d key=textbelt
import requests
resp = requests.post('https://textbelt.com/text', {
'phone': '5555555555',
'message': 'Hello world',
'key': 'textbelt',
})
print(resp.json())
require 'net/http'
require 'uri'
uri = URI.parse("https://textbelt.com/text")
Net::HTTP.post_form(uri, {
:phone => '5555555555',
:message => 'Hello world',
:key => 'textbelt',
})
// Using request
const request = require('request');
request.post('https://textbelt.com/text', {
form: {
phone: '5555555555',
message: 'Hello world',
key: 'textbelt',
},
}, (err, httpResponse, body) => {
console.log(JSON.parse(body));
});
// Using axios
const axios = require('axios');
axios.post('https://textbelt.com/text', {
phone: '5555555555',
message: 'Hello world',
key: 'textbelt',
}).then(response => {
console.log(response.data);
})
fetch('https://textbelt.com/text', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
phone: '5555555555',
message: 'Hello world',
key: 'textbelt',
}),
}).then(response => {
return response.json();
}).then(data => {
console.log(data);
});
using System;
using System.Collections.Specialized;
using System.Net;
using (WebClient client = new WebClient())
{
byte[] response = client.UploadValues("http://textbelt.com/text", new NameValueCollection() {
{ "phone", "5555555555" },
{ "message", "Hello world" },
{ "key", "textbelt" },
});
string result = System.Text.Encoding.UTF8.GetString(response);
}
$ch = curl_init('https://textbelt.com/text');
$data = array(
'phone' => '5555555555',
'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);
final NameValuePair[] data = {
new BasicNameValuePair("phone", "5555555555"),
new BasicNameValuePair("message", "Hello world"),
new BasicNameValuePair("key", "textbelt")
};
HttpClient httpClient = HttpClients.createMinimal();
HttpPost httpPost = new HttpPost("https://textbelt.com/text");
httpPost.setEntity(new UrlEncodedFormEntity(Arrays.asList(data)));
HttpResponse httpResponse = httpClient.execute(httpPost);
String responseString = EntityUtils.toString(httpResponse.getEntity());
JSONObject response = new JSONObject(responseString);
$body = @{
"phone"="5555555555"
"message"="Hello World"
"key"="textbelt"
}
$submit = Invoke-WebRequest -Uri https://textbelt.com/text -Body $body -Method Post
import (
"net/http"
"net/url"
)
func main() {
values := url.Values{
"phone": {"5555555555"},
"message": {"Hello world"},
"key": {"textbelt"},
}
http.PostForm("https://textbelt.com/text", values)
}
Try it now: use key=textbelt
to send 1 free text per day. Create your own key to send more messages afterwards.
Textbelt offers open-source and paid versions:
Textbelt is a simple API. The best way to get started is to try it yourself, or view the documentation here.
Here's an example success response after sending an SMS:
{"success": true, "quotaRemaining": 40, "textId": 12345}
Example out-of-quota or invalid key response:
{"success": false, "quotaRemaining": 0, "error": "Out of quota"}
Example response to request with phone
, message
, or key
missing:
{"success": false, "error": "Incomplete request"}
Using the textId given by a successful sent text, load /status/<textId>
. For example, if your textId is 12345:
$ curl https://textbelt.com/status/12345
{"status": "DELIVERED"}
Possible return values include DELIVERED
(carrier has confirmed sending), SENT
(sent to carrier but confirmation receipt not available), SENDING
(queued or dispatched to carrier), FAILED
(not received), and UNKNOWN
(could not determine status).
Delivery statuses are not standardized between mobile carriers. For example, some carriers will report SMS as "delivered" when they attempt transmission to the handset while other carriers actually report delivery receipts from the handsets.
U.S. phone numbers only: Textbelt lets you receive replies after you've sent an SMS. Replies are sent by webhook, meaning you will have to set up an HTTP or HTTPS route on your website that will process inbound SMS.
Add a replyWebhookUrl
parameter to your HTTP request. For example:
$ curl -X POST https://textbelt.com/text \
--data-urlencode phone='5555555555' \
--data-urlencode message='Hello?' \
-d replyWebhookUrl='https://my.site/api/handleSmsReply' \
-d key=textbelt
Textbelt will POST the following JSON to your endpoint (in this case https://my.site/api/handleSmsReply
):
{
"fromNumber": "+1555123456",
"text": "Here is my reply"
}
Read more for another example.
Use /quota/<key>
to view remaining quota. For example, if your key is abc123:
$ curl https://textbelt.com/quota/abc123
{"success": true, "quotaRemaining": 98}
If you want to validate your key without actually using your text quota, append "_test
" to your key and you will receive a response from the /text
endpoint confirming that a text would send, but it will not consume your credits.
Create an API key to start sending and receiving SMS.
Generate an API key View documentation
Any questions? Email support@textbelt.com or read the FAQ.