Comment on page
👩💻
Quick Start
HTTP SMS is an open-source service that converts your android phone into an SMS Gateway so you can send and receive SMS messages using an intuitive HTTP API.
API requests to HTTP SMS are authenticated using API keys in the
x-api-key
header. Any request that doesn't include an API key will return a 401 (Unauthorized)
response.To send and receive SMS messages using your android phone, you will need to download and install our android app on your phone so it can be triggered to send an SMS message when you make a request to the HTTP SMS API.
To send an SMS message using an android phone, send an authenticated
POST
request to the https://api.httpsms.com/v1/messages/send
endpoint.post
https://api.httpsms.com/v1
/messages/send
Send a new SMS message
PHP
Javascript
Python
curl
Go
c-sharp
Java
// initialize guzzle client https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client();
$apiKey = "Get API Key from https://httpsms.com/settings";
$res = $client->request('POST', 'https://api.httpsms.com/v1/messages/send', [
'headers' => [
'x-api-key' => $apiKey,
],
'json' => [
'content' => 'This is a sample text message',
'from' => "+18005550199",
'to' => '+18005550100'
]
]);
echo $res->getBody();
let apiKey = "Get API Key from https://httpsms.com/settings";
fetch('https://api.httpsms.com/v1/messages/send', {
method: 'POST',
headers: {
'x-api-key': apiKey,
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"content": "This is a sample text message",
"from": "+18005550199",
"to": "+18005550100"
})
})
.then(res => res.json())
.then((data) => console.log(data));
import requests
import json
api_key = "Get API Key from https://httpsms.com/settings"
url = 'https://api.httpsms.com/v1/messages/send'
headers = {
'x-api-key': api_key,
'Accept': 'application/json',
'Content-Type': 'application/json'
}
payload = {
"content": "This is a sample text message",
"from": "+18005550199",
"to": "+18005550100"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
curl --location --request POST 'https://api.httpsms.com/v1/messages/send' \
--header 'x-api-key: Get API Key from https://httpsms.com/settings' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": "+18005550199",
"to": "+18005550100",
"content": "This is a sample text message"
}'
import "github.com/NdoleStudio/httpsms-go"
client := htpsms.New(htpsms.WithAPIKey(/* API Key from https://httpsms.com/settings */))
client.Messages.Send(context.Background(), &httpsms.MessageSendParams{
Content: "This is a sample text message",
From: "+18005550199",
To: "+18005550100",
})
var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", ""/* Get API Key from https://httpsms.com/settings */);
var response = await client.PostAsync(
"https://api.httpsms.com/v1/messages/send",
new StringContent(
JsonSerializer.Serialize(new {
from = "+18005550199",
To = "+18005550100",
Content = "This is a sample text message",
}),
Encoding.UTF8,
"application/json"
)
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
var client = HttpClient.newHttpClient();
var apiKey = "Get API Key from https://httpsms.com/settings";
JSONObject request = new JSONObject();
request.put("content", "This is a sample text message");
request.put("from", "+18005550199")
request.put("to", "+18005550100")
// create a request
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.httpsms.com/v1/messages/send"))
.header("accept", "application/json")
.header("x-api-key", apiKey)
.setEntity(new StringEntity(request.toString()))
.POST()
.build();
// use the client to send the request
var response = client.send(request, new JsonBodyHandler<>(APOD.class));
// the response:
System.out.println(response.body().get());
The best way to interact with our API is to use one of our official libraries:
Go
# install the go package using the "go get" command
go get github.com/NdoleStudio/httpsms-go
Last modified 7mo ago