SMS API for
Developers.
SMS, voice messages, and verification codes via REST
The LOX24 SMS API connects your application to 880 mobile networks worldwide. Through a REST interface with JSON, you send SMS and voice messages, receive replies via webhook, and send verification codes, operated exclusively on servers in Europe.
- REST + JSON
- 99.9% availability
- Webhooks
- Servers in Germany
What is an SMS API?
What features does the SMS API offer?
How easy is it to integrate the SMS API?
Authentication and endpoints of the LOX24 SMS API
All requests go to https://api.lox24.eu and are authenticated via the header X-LOX24-AUTH-TOKEN . The token consists of your user ID and an API key (:), which you create in your customer account. Requests and responses use JSON. After three failed login attempts within one minute, the API blocks the requesting IP for ten minutes.
BASE URLhttps://api.lox24.euHeader: X-LOX24-AUTH-TOKEN
POST/sms
POST/sms/dryrun
GET/sms
POST/bulks
GET/incomings
POST/verify_codes
/groups/phones/blocked_numbers
/campaigns/links
GET/me
You can find all endpoints with examples in the API Documentation. The OpenAPI specification can be loaded directly into Postman, Insomnia, or a code generator.
Code examples for curl, PHP, Python, Java, Go, C#, and JavaScript
#!/usr/bin/env bash
curl -X POST https://api.lox24.eu/sms \
-H 'Content-Type: application/json' \
-H 'X-LOX24-AUTH-TOKEN: 1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx' \
-d '{
"sender_id": "My Sender",
"phone": "+49751234567",
"source": 111,
"service_code": "direct",
"text": "Test message",
"delivery_at": 1573724611,
"is_unicode": true,
"callback_data": "123456",
"voice_lang": "DE"
}''My Sender',
'text' => "First line\nSecond line",
'service_code' => 'direct',
'phone' => '+49751234567',
'delivery_at' => 1573724611,
'is_unicode' => true,
'callback_data' => '123456',
'voice_lang' => 'DE',
];
if(!$body = json_encode($body)) {
die('JSON encoding error!');
}
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_URL => $uri,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
"X-LOX24-AUTH-TOKEN: {$token}",
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
]);
$response = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$data = json_decode($response, JSON_OBJECT_AS_ARRAY);
if(201 === $code) {
echo 'Success: response data = ' . var_export($data, true);
} else {
echo "Error: code = {$code}, data = " . var_export($data, true);
}package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
const Method = "POST"
const URL = "https://api.lox24.eu/sms"
const Token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx"
payload := map[string]interface{}{
"sender_id": "My Sender",
"phone": "+49751234567",
"source": 111,
"service_code": "direct",
"text": "Test message",
"delivery_at": 1593724611,
"is_unicode": true,
"callback_data": "123456",
"voice_lang": "DE",
}
jsonPayload, _ := json.Marshal(payload)
client := &http.Client{}
req, err := http.NewRequest(Method, URL, bytes.NewBuffer(jsonPayload))
if err != nil {
log.Fatal(err)
}
req.Header.Add("X-LOX24-AUTH-TOKEN", Token)
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
switch res.StatusCode {
case 201:
fmt.Println((string(body)))
case 400:
fmt.Println("Error: code = 400 - Invalid input")
case 401:
fmt.Println("Error: code = 401 - Client ID or API key isn't active or invalid!")
case 403:
fmt.Println("Error: code = 403 - Account isn't activated. Please wait or contact to support!")
default:
fmt.Printf("Error: code = %d\n", res.StatusCode)
}
}using Newtonsoft.Json;
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Lox24.Api
{
class client
{
static void Main()
{
string key = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx";
string url = "https://api.lox24.eu/sms";
var data = new {
sender_id = "My Sender",
text = "Test message",
service_code = "direct",
phone = "+49751234567",
delivery_at = 1573724611,
is_unicode = true,
callback_data = "123456",
voice_lang = "DE"
};
string postdata = JsonConvert.SerializeObject(data);
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Accept = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.Headers.Add("X-LOX24-AUTH-TOKEN", key);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(postdata);
}
using (HttpWebResponse resp = (HttpWebResponse)httpWebRequest.GetResponse())
{
if (resp.StatusCode == HttpStatusCode.Created)
Console.WriteLine("Success: sms resource created");
}
}
}
}import json
import requests
token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx"
url = 'https://api.lox24.eu/sms'
data = {
'sender_id': "My Sender",
'text': "Test message",
'service_code': "direct",
'phone': "+49751234567",
'delivery_at': 1573724611,
'is_unicode': True,
'callback_data': '123456',
'voice_lang': 'DE'
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-LOX24-AUTH-TOKEN': token,
}
try:
# timeout is 100 seconds, the payload is automatically converted to json
res = requests.post(url, headers=headers, json=data, timeout=100)
if res.status_code != 201: # Created
print("Error: Wrong response code on create sms")
res.raise_for_status()
else:
print(f'Success: code = {res.status_code} - sms resource created')
print("Response: ", json.dumps(res.json(), indent=4))
except requests.HTTPError:
if res.status_code == 400:
print("Error:400 Invalid input")
elif res.status_code == 401:
print("Error: code = 401 - Client ID or API key isn't active or invalid!")
elif res.status_code == 402:
print("Error:402 There are not enough funds on your account!")
elif res.status_code == 403:
print("Error: code = 403 - Account isn't activated!")package eu.lox24.doc.sms;
import org.json.JSONObject;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class PostSmsCollection {
public static void main(String[] args) {
var key = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx";
var url = "https://api.lox24.eu/sms";
var json = new JSONObject();
json.put("sender_id", "My Sender");
json.put("text", "Test message");
json.put("service_code", "direct");
json.put("phone", "+49751234567");
json.put("delivery_at", 1573724611);
json.put("is_unicode", true);
var httpRequest = HttpRequest.newBuilder(URI.create(url))
.timeout(Duration.ofMillis(100000))
.setHeader("Content-Type", "application/json; charset=utf-8")
.setHeader("Accept", "application/json")
.setHeader("X-LOX24-AUTH-TOKEN", key)
.POST(HttpRequest.BodyPublishers.ofString(json.toString()))
.build();
var client = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.build();
try {
var httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
if (httpResponse.statusCode() == HttpURLConnection.HTTP_CREATED) {
System.out.println("Success: sms resource created");
System.out.println(httpResponse.body());
} else {
System.out.println("Error: wrong response code " + httpResponse.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}/*
* Post sms
*/
const token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx";
var postObj = {
sender_id: 'My Sender',
text: 'Test message',
service_code: 'direct',
phone: '+49751234567',
delivery_at: 1573724611,
is_unicode: true,
callback_data: "123456",
voice_lang: "DE"
};
var postdata = JSON.stringify(postObj);
const https = require('https');
const options = {
hostname: 'api.lox24.eu',
path: '/sms',
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Content-Length': postdata.length,
'X-LOX24-AUTH-TOKEN': token
}
}
const req = https.request(options, res => {
if (res.statusCode == 201) {
console.log("Success: code = 201 - sms resource created");
res.on('data', d => { process.stdout.write(d) })
}
else if (res.statusCode == 400) console.log("Error: code = 400 - Invalid input");
else if (res.statusCode == 401) console.log("Error: code = 401 - API key isn't active or invalid!");
else if (res.statusCode == 402) console.log("Error: code = 402 - Not enough funds on your account!");
})
req.on('error', error => { console.error(error) })
req.write(postdata);
req.end();PARAMETERS FOR POST /sms · JSON
phoneRecipient number in international format, e.g. +49151…
textMessage text. Longer texts are split across multiple SMS.
sender_idSender: text of up to 11 characters or a phone number of up to 15 digits.
service_codeDelivery type, e.g. direct (default) or text2speech for voice messages.
delivery_atSend time as a Unix timestamp, for scheduled SMS.
is_unicodetrue for emojis and special characters (UCS-2); otherwise the GSM character set is used.
callback_dataCustom identifier, e.g. an order number. Returned in the delivery report.
voice_langLanguage of the voice message, e.g. DE. If not specified, the API detects the language automatically (20 languages).
You can find all parameters, required fields, and response formats in the API Documentation.
SMS API Even Without a Developer
Want to benefit from the LOX24 SMS API for your business but don't have a developer to help you? No problem. We have the solution. With our Zapier integration, you can easily connect your software to our API without any programming knowledge. You don't need any support from your IT department.
- More than 6,745 applicationsWith our SMS API solution, you can use Zapier to communicate with more than 6,745 applications that you use for your business.
- SMS Gateway for Your AppMany applications already support SMS sending with LOX24 out of the box, e.g. Bitrix24, Theorg, and Synology.
- No programming knowledge requiredYou don't need any support from your IT department.
What you can build with the LOX24 SMS API
One API, many use cases: from login codes and shipping updates to campaigns with click tracking, all functions run through the same interface, the same API key, and the same billing.
POST /verify_codesPOST /smsPOST /bulks · /campaignsGET /incomings · WebhookFraud check APIMCP serverWhat else the LOX24 SMS API can do
Besides sending, the LOX24 SMS API offers everything an integration needs day to day: webhooks, test mode, blocklists, and queries for pricing and your account.
Frequently asked questions about the LOX24 SMS API
How do I authenticate with the LOX24 SMS API?
With every request, you send the header X-LOX24-AUTH-TOKEN with the value :. You create the API key in your LOX24 customer account. You can also restrict access to your servers using an IP restriction.
Is there an OpenAPI specification?
Yes. The complete specification of the LOX24 API v2 is available at doc.lox24.eu/openapi-en.json. You can import it into Postman or Insomnia, or use it to generate a client in your language.
Can I test the API without sending SMS?
Yes, via the endpoint POST /sms/dryrun. It validates your request as in live operation and triggers a simulated delivery report, without any SMS being sent.
What format should I use for phone numbers?
In international format with country code, for example +49151… for a German mobile number.
How do I send voice messages instead of SMS?
You set service_code on text2speech. LOX24 calls the recipient and reads the text aloud. You specify the language with voice_lang , or the API detects it automatically from the text (20 languages).
What is the most reliable way to send verification codes?
Via the endpoint /verify_codes. There you define a sequence of channels, for example Telegram first, then voice call, and SMS last. If the code doesn't arrive on one channel, LOX24 automatically tries the next.
Are there SDKs or libraries?
Full API documentation
Create an API key now and send your first SMS
Sign up for free, create your API key in your customer account, and test the integration with a dry run. You'll get a starting credit of 50 cents for your first real SMS.
