Enhance your communication workflow with real-time messaging and updates.
curl --location 'https://sms-brazil.com/sms-send?key=API_KEY&t=short&to=%2B5511987654321&msg=tes%2Bmessage'
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string apiKey = "API_KEY"; // Replace with your actual API key
string url = "https://sms-brazil.com/sms-send?key=" + apiKey;
string json = @"{
""tipo_envio"": ""common"",
""referencia"": ""API Send Test"",
""rota"": 99,
""mensagens"": [
{
""numero"": ""11987654321"",
""mensagem"": ""Test message #1"",
""DataAgendamento"": ""2023-01-01 10:10:00"",
""Codigo_cliente"": ""myRefCode-0""
},
{
""numero"": ""11912345678"",
""mensagem"": ""Test message #2"",
""DataAgendamento"": ""2023-01-01 10:10:00"",
""Codigo_cliente"": ""myRefCode-1""
}
]
}";
using (HttpClient client = new HttpClient())
{
var content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
}
}
}
}
program SmsSendExample;
{$APPTYPE CONSOLE}
uses
SysUtils, IdHTTP, IdSSL, IdSSLOpenSSL, superobject;
const
ApiKey = 'your_api_key_here'; // Replace with your actual API key
BaseUrl = 'https://sms-brazil.com/sms-send?key=' + ApiKey;
var
HttpClient: TIdHTTP;
RequestData: ISuperObject;
ResponseData: string;
begin
HttpClient := TIdHTTP.Create(nil);
try
// SSL configuration
HttpClient.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
HttpClient.HandleRedirects := True;
// Create JSON data
RequestData := SO(
['tipo_envio', 'common',
'referencia', 'API Send Test',
'rota', 99,
'mensagens', SA([
SO(['numero', '11987654321',
'mensagem', 'Test message #1',
'DataAgendamento', '2023-01-01 10:10:00',
'Codigo_cliente', 'myRefCode-0']),
SO(['numero', '11912345678',
'mensagem', 'Test message #2',
'DataAgendamento', '2023-01-01 10:10:00',
'Codigo_cliente', 'myRefCode-1'])
])
]);
// Convert JSON data to string
ResponseData := RequestData.AsString;
// Set HTTP headers
HttpClient.Request.ContentType := 'application/json';
// Perform POST request
ResponseData := HttpClient.Post(BaseUrl, ResponseData);
// Output response
Writeln('Response: ' + ResponseData);
finally
HttpClient.Free;
end;
end.
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONArray;
import org.json.JSONObject;
public class SmsSendExample {
public static void main(String[] args) throws Exception {
// Define the API endpoint and API key
String apiKey = "your_api_key_here"; // Replace with your actual API key
String url = "https://sms-brazil.com/sms-send?key=" + apiKey;
// Define the JSON data
JSONObject jsonData = new JSONObject();
jsonData.put("tipo_envio", "common");
jsonData.put("referencia", "API Send Test");
jsonData.put("rota", 99);
JSONArray messagesArray = new JSONArray();
JSONObject message1 = new JSONObject();
message1.put("numero", "11987654321");
message1.put("mensagem", "Test message #1");
message1.put("DataAgendamento", "2023-01-01 10:10:00");
message1.put("Codigo_cliente", "myRefCode-0");
messagesArray.put(message1);
JSONObject message2 = new JSONObject();
message2.put("numero", "11912345678");
message2.put("mensagem", "Test message #2");
message2.put("DataAgendamento", "2023-01-01 10:10:00");
message2.put("Codigo_cliente", "myRefCode-1");
messagesArray.put(message2);
jsonData.put("mensagens", messagesArray);
// Convert JSON data to string
String jsonString = jsonData.toString();
// Create HTTP connection
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
// Set request method
con.setRequestMethod("POST");
// Set request headers
con.setRequestProperty("Content-Type", "application/json");
// Enable output for POST data
con.setDoOutput(true);
// Write JSON data to request body
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
wr.writeBytes(jsonString);
wr.flush();
}
// Get response code
int responseCode = con.getResponseCode();
System.out.println("Response Code: " + responseCode);
// Read response
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// Print response
System.out.println("Response: " + response.toString());
}
}
}
const axios = require('axios');
// Define the API endpoint and API key
const url = "https://sms-brazil.com/sms-send?key=API_KEY";
const apiKey = "your_api_key_here"; // Replace with your actual API key
// Define the JSON data
const jsonData = {
"tipo_envio": "common",
"referencia": "API Send Test",
"rota": 99,
"mensagens": [
{
"numero": "11987654321",
"mensagem": "Test message #1",
"DataAgendamento": "2023-01-01 10:10:00",
"Codigo_cliente": "myRefCode-0"
},
{
"numero": "11912345678",
"mensagem": "Test message #2",
"DataAgendamento": "2023-01-01 10:10:00",
"Codigo_cliente": "myRefCode-1"
}
]
};
// Make POST request
axios.post(url, jsonData)
.then(response => {
console.log("Request successful!");
console.log("Response:");
console.log(response.data);
})
.catch(error => {
console.error("Request failed:", error.response.status);
console.error("Response data:", error.response.data);
});
import json
import requests
# Define the API endpoint and API key
api_key = "your_api_key_here" # Replace with your actual API key
url = "https://sms-brazil.com/sms-send?key=" + api_key
# Define the JSON data
json_data = {
"tipo_envio": "common",
"referencia": "API Send Test",
"rota": 99,
"mensagens": [
{
"numero": "11987654321",
"mensagem": "Test message #1",
"DataAgendamento": "2023-01-01 10:10:00",
"Codigo_cliente": "myRefCode-0"
},
{
"numero": "11912345678",
"mensagem": "Test message #2",
"DataAgendamento": "2023-01-01 10:10:00",
"Codigo_cliente": "myRefCode-1"
}
]
}
# Convert JSON data to string
json_str = json.dumps(json_data)
# Make POST request
response = requests.post(url, data=json_str)
# Check response status
if response.status_code == 200:
print("Request successful!")
print("Response:")
print(response.text)
else:
print("Request failed with status code:", response.status_code)
require 'net/http'
require 'uri'
require 'json'
# Define the API endpoint and API key
api_key = 'your_api_key_here' # Replace with your actual API key
url = URI.parse("https://sms-brazil.com/sms-send?key=#{api_key}")
# Define the JSON data
json_data = {
tipo_envio: 'common',
referencia: 'API Send Test',
rota: 99,
mensagens: [
{
numero: '11987654321',
mensagem: 'Test message #1',
DataAgendamento: '2023-01-01 10:10:00',
Codigo_cliente: 'myRefCode-0'
},
{
numero: '11912345678',
mensagem: 'Test message #2',
DataAgendamento: '2023-01-01 10:10:00',
Codigo_cliente: 'myRefCode-1'
}
]
}
# Convert JSON data to string
json_string = json_data.to_json
# Create HTTP connection
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
# Create HTTP request
request = Net::HTTP::Post.new(url.request_uri)
request['Content-Type'] = 'application/json'
request.body = json_string
# Perform HTTP request
response = http.request(request)
# Output response
puts "Response Code: #{response.code}"
puts "Response Body: #{response.body}"
<?php
$apiKey = "your_api_key_here"; // Replace with your actual API key
// Define the API endpoint and API key
$url = "https://sms-brazil.com/sms-send?key=" + $apiKey;
// Define the JSON data
$jsonData = array(
"tipo_envio" => "common",
"referencia" => "API Send Test",
"rota" => 99,
"mensagens" => array(
array(
"numero" => "11987654321",
"mensagem" => "Test message #1",
"DataAgendamento" => "2023-01-01 10:10:00",
"Codigo_cliente" => "myRefCode-0"
),
array(
"numero" => "11912345678",
"mensagem" => "Test message #2",
"DataAgendamento" => "2023-01-01 10:10:00",
"Codigo_cliente" => "myRefCode-1"
)
)
);
// Convert JSON data to string
$jsonString = json_encode($jsonData);
// Initialize curl session
$ch = curl_init($url);
// Set the POST method
curl_setopt($ch, CURLOPT_POST, 1);
// Set the POST data
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($jsonString)
));
// Return response instead of outputting it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the request
$response = curl_exec($ch);
// Check for errors
if ($response === false) {
echo "Error: " . curl_error($ch);
} else {
// Output response
echo "Response: " . $response;
}
// Close curl session
curl_close($ch);
?>
Sub SendSms()
Dim apiKey As String
Dim url As String
Dim jsonData As String
Dim xmlhttp As Object
Dim responseText As String
' Define the API endpoint and API key
apiKey = "your_api_key_here" ' Replace with your actual API key
url = "https://sms-brazil.com/sms-send?key=" & apiKey
' Define the JSON data
jsonData = "{""tipo_envio"":""common"",""referencia"":""API Send Test"",""rota"":99," & _
"""mensagens"":[{""numero"":""11987654321"",""mensagem"":""Test message #1"",""DataAgendamento"":""2023-01-01 10:10:00"",""Codigo_cliente"":""myRefCode-0""}," & _
"{""numero"":""11912345678"",""mensagem"":""Test message #2"",""DataAgendamento"":""2023-01-01 10:10:00"",""Codigo_cliente"":""myRefCode-1""}]}"
' Create XMLHTTP object
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
' Open connection
xmlhttp.Open "POST", url, False
' Set request headers
xmlhttp.setRequestHeader "Content-Type", "application/json"
' Send request
xmlhttp.send jsonData
' Get response text
responseText = xmlhttp.responseText
' Output response
Debug.Print "Response: " & responseText
End Sub
No credit card required + free credit for testing.
That identifies and grant you access to the service.
Connect your code with our API, the way that suits you best.
Send fast, unlimited bulk SMS and receive DLR data in real-time.