SMS gateway API connection
SMS API is a programming interface that facilitates communication between your application and mobile operators' SMS gateway. It allows you to send and receive SMS messages using simple HTTP requests, without the need for direct connection to telecommunications infrastructure.
Easy integration
High reliability
Delivery speed
Global coverage
Detailed reports
API first
Why SmsManager?
API built for developer comfort each API request can contain custom JSON data so that delivery receipts or incoming replies can be easily matched.
Developer portal with call examples and a detailed description of the API structure.
Sandbox and testing option the developer portal includes functionality for real-time testing and request validation. Thanks to that you can prepare your integration very quickly.
Examples in many languages - PHP, JavaScript, Node.js, Python, Java, Go, Ruby, .NET, ...
Quick start
Send a message
- JSON
- CURL
{
"body": "Your first SMS via API!",
"to": [{"phone_number": "+420777123456"}]
}
curl -X POST https://api.smsmngr.com/v2/message \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"body": "Your first SMS via API!",
"to": [{"phone_number": "+420777123456"}]
}'
API response
{
"request_id": "c3917016-4540-4a26-b2f9-f96028788dbe",
"accepted": [{
"key": "0",
"message_id": "8c8e93ce-3fdd-4f9a-8918-cf8b0b40502a"
}],
"rejected": []
}
Authentication
To send messages you will always need an API key.
If you use the standard JSON API, you will always need to enrich the request header with x-api-key and correctly define Content-Type: application/json.
Content-Type: application/json x-api-key: YOUR_API_KEY
JSON API Endpoint
Our JSON API is designed to be stable and high-performing.
A response from our API always means confirmation that the request has been received (and an ID assigned). Not that the message has been sent. To truly verify a message's status, use the REST API through which we provide detailed message status.
Because we use a JSON structure, we adjust and add functionality directly into individual API versions.
Usage examples
- PHP
- Python
- Go
- Ruby
- Java
- .NET
- Node.js
<?php
$apikey = 'your-api-key-here'; // Replace with your actual API key
$number = 'phone-number-here'; // Replace with the target phone number
$text = 'message-text-here'; // Replace with the message text
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.smsmngr.com/v2/message');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
'to' => array(array('phone_number' => $number)),
'body' => $text
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'x-api-key:' . $apikey
));
// Execute the request and capture the response
$response = curl_exec($ch);
curl_close($ch);
// Process the response
$response = json_decode($response, true);
if ($response['accepted'] && $response['accepted'][0]) { // SMS was sent successfully
echo 'Status: Accepted';
echo 'ID: ' . $response['accepted'][0]['message_id'];
} else {
echo 'Status: Rejected';
}
import requests
import json
api_key = 'your-api-key-here'
phone_number = 'phone-number-here'
text = 'message-text-here'
url = 'https://api.smsmngr.com/v2/message'
headers = {
'Content-Type': 'application/json',
'x-api-key': api_key
}
payload = {
'to': [{'phone_number': phone_number}],
'body': text
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
response_data = response.json()
if 'accepted' in response_data and response_data['accepted']:
print('Status: Accepted')
print('ID:', response_data['accepted'][0]['message_id'])
else:
print('Status: Rejected')
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiKey := "your-api-key-here"
phoneNumber := "phone-number-here"
text := "message-text-here"
messageData := map[string]interface{}{
"to": []map[string]string{{"phone_number": phoneNumber}},
"body": text,
}
jsonData, _ := json.Marshal(messageData)
req, _ := http.NewRequest("POST", "https://api.smsmngr.com/v2/message", bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result map[string]interface{}
json.Unmarshal(body, &result)
if accepted, ok := result["accepted"].([]interface{}); ok && len(accepted) > 0 {
message := accepted[0].(map[string]interface{})
fmt.Println("Status: Accepted")
fmt.Println("ID:", message["message_id"])
} else {
fmt.Println("Status: Rejected")
}
}
require 'net/http'
require 'uri'
require 'json'
api_key = 'your-api-key-here'
phone_number = 'phone-number-here'
text = 'message-text-here'
uri = URI.parse('https://api.smsmngr.com/v2/message')
request = Net::HTTP::Post.new(uri)
request.content_type = 'application/json'
request['x-api-key'] = api_key
request.body = JSON.dump({
'to' => [{'phone_number' => phone_number}],
'body' => text
})
req_options = {
use_ssl: uri.scheme == 'https'
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
response_data = JSON.parse(response.body)
if response_data['accepted'] && !response_data['accepted'].empty?
puts "Status: Accepted"
puts "ID: #{response_data['accepted'][0]['message_id']}"
else
puts "Status: Rejected"
end
// Requires Java 11+ for HttpClient
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// Add a JSON processing library like Gson or Jackson to your project
// Example with manual string building for simplicity
public class SendSms {
public static void main(String[] args) throws Exception {
String apiKey = "your-api-key-here";
String phoneNumber = "phone-number-here";
String text = "message-text-here";
String jsonPayload = String.format(
"{\"to\":[{\"phone_number\":\"%s\"}],\"body\":\"%s\"}",
phoneNumber, text
);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.smsmngr.com/v2/message"))
.header("Content-Type", "application/json")
.header("x-api-key", apiKey)
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
// In a real application, parse the JSON to check the 'accepted' array.
}
}
// Requires .NET 5+ for modern HttpClient usage with JSON helpers
// Add package: System.Net.Http.Json
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Threading.Tasks;
using System.Collections.Generic;
public class SmsSender
{
public static async Task Main(string[] args)
{
var apiKey = "your-api-key-here";
var phoneNumber = "phone-number-here";
var text = "message-text-here";
using var client = new HttpClient();
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("x-api-key", apiKey);
var payload = new
{
to = new[] { new { phone_number = phoneNumber } },
body = text
};
var response = await client.PostAsJsonAsync("https://api.smsmngr.com/v2/message", payload);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<SmsResponse>();
if (result?.Accepted?.Count > 0)
{
Console.WriteLine("Status: Accepted");
Console.WriteLine($"ID: {result.Accepted[0].MessageId}");
}
else
{
Console.WriteLine("Status: Rejected");
}
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
}
public class SmsResponse
{
public List<AcceptedMessage> Accepted { get; set; }
public List<object> Rejected { get; set; }
}
public class AcceptedMessage
{
public string Key { get; set; }
public string MessageId { get; set; }
}
const response = await fetch('https://api.smsmngr.com/v2/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your-api-key-here'
},
body: JSON.stringify({
to: [{
phone_number: 'phone-number-here'
}],
body: 'message-text-here'
})
});
const responseText = await response.json();
if(response.accepted && response.accepted[0]){ // SMS was sent successfully
console.log('Status: Accepted');
console.log('ID:', response.accepted[0].message_id);
}
else{
console.log('Status: Rejected');
}
Ready to send WhatsApp messages too?
Send a message
If you have already implemented our API, you can easily extend message sending to WhatsApp as well. You have control over the order of sent messages as well as the content of the message sent via SMS.
Thanks to a smart combination of SMS and WhatsApp messages you can significantly reduce your messaging costs.
- JSON
{
"flow":[
{
"whatsapp_template": {
"template_name": "welcome",
"language": "cs",
"sender": "987651234567890"
}
},
{
"sms": {
"body": "If you don't have WhatsApp, you'll get an SMS!"
}
}
],
"to": [{"phone_number": "+420777123456"}]
}
API response
{
"request_id": "c3917016-4540-4a26-b2f9-f96028788dbe",
"accepted": [{
"key": "0",
"message_id": "8c8e93ce-3fdd-4f9a-8918-cf8b0b40502a"
}],
"rejected": []
}
Start using our SMS gateway API today
Ready to start reaching your customers through the most effective communication channel? The process is quick and simple. Sign up in a minute, get your API key and send your first SMS today with our simple API.