Stopping postponed and not yet sent SMS messages
With this API you can delete SMS messages that have not yet been sent or interrupt the sending process. For scheduled SMS messages, the transmission time must be in the future. If the SMS is not scheduled, the transmission to the mobile phone provider may take a few seconds, which will possibly allow you to stop the transmission in exceptional cases.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Sort order direction (ascending or descending)
Sort by timestamp when the entity was created
Sort order direction (ascending or descending)
Sort by timestamp when the message was transmitted to the mobile network
Boolean filter SMS by the is_sent field to distinguish between already sent and not yet sent sms
Boolean filter SMS by the is_unicode field to distinguish between GSM and Unicode messages
Unique entity UUID
Exact filter by SMS ID
Exact filter by SMS ID
Exact filter SMS by the phone’s countries (ISO 3166-1 alpha-2)
Status of the SMS delivery from gateway
Example
1Exact filter SMS by the delivery report status
Exact filter SMS by the delivery report statuses
Exact filter SMS by the statuses codes
Timestamp when message was sent to the mobile network provider
Exact filter SMS by the send to gateway timestamp
Exact and range filter SMS by send to gateway timestamps
Scheduled delivery timestamp
Exact filter SMS by the delivery timestamp
Exact and range filter SMS by the delivery timestamps
Timestamp when the entity was added to the system by the user
Exact filter entities by the creation timestamp
Exact and range filter entities by the creation timestamps
Range filter SMS by the message chars count
Exact and range filter SMS by the message chars count
Count of the SMS parts (concatenated messages)
Exact filter SMS by the message parts count
Exact and range filter SMS by the message parts count
Unique entity UUID
Exact filter SMS by the Bulk
Exact and range filter SMS by the Bulk
Exact filter SMS by the sources
Exact and range filter SMS by the sources
The message text can have a length of up to 1530 characters. With a Unicode SMS, the maximum character length is reduced to 670 characters. Internal encoding is UTF-8.
Partial case-insensitive text filter SMS by the message text
Partial text filter SMS by the phone number
Sender-ID of the message. Can be a number (up to 15 digits) or a text (up to 11 character). In case of a number please use preferentially E.164 phone number format. A sender of text may contain spaces but no other special characters. Please note that some countries do not support own sender IDs or do require pre-registration. Our system automatically tries to detect whether a sender ID is a text or a phone number. Avoid special characters in a number and enter it the same way as it would be dialed on a phone.
For voice messages (text2speech, text2speech_ssml): if sender_id does not conform to E.164 format (e.g., missing leading +, non-digit characters), the message will be sent from the system default number +493075435114. Some downstream telephony providers may override or not respect the user-defined sender number — the actual caller ID presented to the recipient depends on provider capabilities.
Partial text case-insensitive filter SMS by the sender number or text
IP address of the host which sent request
Example
192.168.1.1Partial text filter SMS by the IP which created the message
API key identifier
Exact filter entities by the used API key
Exact filter entities by the used API keys
String which will be send back to your endpoint. E.g. it can be usable to pass your system message id.
Exact filter SMS by callback_data property
Exact filter SMS by callback_data property
Responses
Section titled “ Responses ”Count of the canceled SMS
Batch cancel operation response
object
Count of the SMS which was canceled
Example generated
{ "deleted_sms_count": 1}Invalid input
Client ID or API key isn’t active or invalid!
Account isn’t activated. Please wait or contact to support!
The request was well-formed but was unable to be followed due to semantic errors
IP address was temporary blocked, because during short time from it was sent many request with invalid credentials. Please wait and try later.
Code Samples
curl -X POST https://api.lox24.eu/sms/ops/batch_cancel?uuid=20f39273-0566-11ea-a637-96000028b339 \ -H 'X-LOX24-AUTH-TOKEN: 1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx'using Newtonsoft.Json.Linq;using System;using System.IO;using System.Net;using System.Text;
namespace Lox24.Api{ class client { static void Main() { string key = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx"; string text = "Test";
var query = "text=" + text + "&uuid[]=ab6b6ceb-903a-11ea-aa81-96000028b339&uuid[]=7c7a6661-902e-11ea-aa81-96000028b339"; string url = "https://api.lox24.eu/sms/ops/batch_cancel?" + query;
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ReadWriteTimeout = 100000; httpWebRequest.Accept = "application/json"; httpWebRequest.Method = "POST"; //httpWebRequest.KeepAlive = true; httpWebRequest.Headers.Add("X-LOX24-AUTH-TOKEN", key); httpWebRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
try { using (HttpWebResponse resp = (HttpWebResponse)httpWebRequest.GetResponse()) { if(resp.StatusCode == HttpStatusCode.OK) { Console.WriteLine("Success: SMS was canceled!"); } else { Console.WriteLine("Error: SMS wasn't canceled canceled!"); }
Stream respStream = resp.GetResponseStream(); using (StreamReader sr = new StreamReader(respStream, Encoding.UTF8)) { string responseText = sr.ReadToEnd(); Console.WriteLine("responseText : {0}", responseText); } }
} catch (WebException ex) { var webResponse = ex.Response as System.Net.HttpWebResponse; Console.WriteLine("Error:{0}", webResponse.StatusCode);
switch (webResponse.StatusCode) { case HttpStatusCode.Unauthorized: // 401 Console.WriteLine("Error:401 Client ID or API key isn't active or invalid!"); break; case HttpStatusCode.Forbidden: // 403 Console.WriteLine("Error:403 Account isn't activated. Please wait or contact to support!"); break; case HttpStatusCode.InternalServerError: // 500 case HttpStatusCode.BadGateway: //502 case HttpStatusCode.ServiceUnavailable: // 503 case HttpStatusCode.GatewayTimeout: // 504 Console.WriteLine("System error! Please contact to LOX24 support!"); break; } } } }package main
import ( "fmt" "io/ioutil" "log" "net/http")
func main() {
const Method = "POST" const URL = "https://api.lox24.eu/sms/ops/batch_cancel?uuid=20f39273-0566-11ea-a637-96000028b339" const Token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx"
client := &http.Client{}
req, err := http.NewRequest(Method, URL, nil) if err != nil { log.Fatal(err) }
req.Header.Add("X-LOX24-AUTH-TOKEN", Token) req.Header.Add("Accept", "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 200: fmt.Println((string(body))) 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) }}package eu.lox24.doc.sms;
import java.io.IOException;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 SmsOpsCancelSmsCollection {
public static void main(String[] args) {
var key = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx";
var text = ""; var query = "text=" + text + "&uuid[]=ab6b6ceb-903a-11ea-aa81-96000028b339&uuid[]=7c7a6661-902e-11ea-aa81-96000028b339"; var url = "https://api.lox24.eu/sms/ops/batch_cancel?" + query;
var httpRequest = HttpRequest.newBuilder(URI.create(url)) .timeout(Duration.ofMillis(100000)) .setHeader("Accept", "application/json") // or application/ld+json .setHeader("X-LOX24-AUTH-TOKEN", key) .POST(HttpRequest.BodyPublishers.ofString("")) .build();
var client = HttpClient.newBuilder() .version(HttpClient.Version.HTTP_1_1) // Http 1.1 clients are kept alive be default .build();
try { var httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
if (httpResponse.statusCode() == HttpURLConnection.HTTP_OK) { System.out.println("Success:" + httpResponse.statusCode() + " " + "Success: SMS was canceled!"); System.out.println("Response text : \n" + httpResponse.body()); } else { System.out.println("Error: SMS wasn't canceled!"); System.out.println("Response text : \n" + httpResponse.body());
System.out.println("Error: " + httpResponse.statusCode());
switch (httpResponse.statusCode()) {
case HttpURLConnection.HTTP_UNAUTHORIZED: // 401 System.out.println("Error:401 Client ID or API key isn't active or invalid!"); break; case HttpURLConnection.HTTP_FORBIDDEN: // 403 System.out.println("Error:403 Account isn't activated. Please wait or contact to support!"); break; case HttpURLConnection.HTTP_NOT_FOUND: // 404 System.out.println("Error:404 Resource not found"); break; case HttpURLConnection.HTTP_INTERNAL_ERROR: // 500 case HttpURLConnection.HTTP_BAD_GATEWAY: //502 case HttpURLConnection.HTTP_UNAVAILABLE: // 503 case HttpURLConnection.HTTP_GATEWAY_TIMEOUT: // 504 System.out.println("System error! Please contact to LOX24 support!"); break; }
}
} catch (IOException | InterruptedException e) { e.printStackTrace(); } }}const host = 'api.lox24.eu';const token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx";
var query = "uuid[]=44657141-9830-11ea-aa81-96000028b339&uuid[]=5dd2ba0e-9830-11ea-aa81-96000028b339&_order[created_at]=desc";
const https = require('https');const options = { hostname: host, path: '/sms/ops/batch_cancel?' + query, method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'X-LOX24-AUTH-TOKEN': token }}
const req = https.request(options, res => { if (res.statusCode == 200) { console.log("Success: code = 200 - Count of the canceled SMS"); res.on('data', d => { process.stdout.write(d) }) } else if (res.statusCode == 401) { console.log("Error: code = 401 - Client ID or API key isn't active or invalid!"); } else if (res.statusCode == 403) { console.log("Error: code = 403 - Account isn't activated. Please wait or contact to support!"); } else { console.log("Error: code = " + res.statusCode ); }})
req.on('error', error => { console.error(error)})
req.end();<?php
$token = '1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx';
$uri = 'https://api.lox24.eu/sms/ops/batch_cancel';
$filters = [ //'text' => 'Test', 'uuid' => [ '8481900d-86ce-11ea-aa81-96000028b339', 'd5ceb189-86cd-11ea-aa81-96000028b339', ],];
$uri .= $filters ? '?' . http_build_query($filters) : '';$curl = curl_init();
echo $uri;
curl_setopt_array($curl, [ CURLOPT_POST => true, CURLOPT_URL => $uri, CURLOPT_HTTPHEADER => [ "X-LOX24-AUTH-TOKEN: {$token}", 'Accept: application/json', // or application/ld+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);}import jsonimport requests
token = "1234567:e3f3a759b6677959b6ebfcxxxxxxxxxx"text = "Test"
query = f"text={text}&uuid[]=ab6b6ceb-903a-11ea-aa81-96000028b339&uuid[]=7c7a6661-902e-11ea-aa81-96000028b339"
url = f"https://api.lox24.eu/sms/ops/batch_cancel?{query}"
headers = { 'Accept': 'application/json', 'X-LOX24-AUTH-TOKEN': token,}
try: # timeout is 100 seconds, the payload is automatically converted to json format res = requests.post(url, headers=headers, timeout=100) if res.status_code != 200: # Ok print("Error: SMS wasn't canceled") res.raise_for_status() else: print(f'Success: code = {res.status_code} - SMS was canceled') print("Response: ", json.dumps(res.json(), indent=4))
except requests.HTTPError: if res.status_code == 401: print("Error: code = 401 - Client ID or API key isn't active or invalid!") elif res.status_code == 403: print("Error: code = 403 - Account isn't activated. Please wait or contact to support!") elif res.status_code in (500, 502, 503, 504): print("System error! Please contact to LOX24 support!") else: print(f"Error: code {res.status_code}") print(json.dumps(res.json(), indent=4))