curl --request POST \
--url https://my.cloudtalk.io/api/sms/send.json \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": "<string>",
"message": "<string>",
"sender": "<string>",
"country_code": "<string>",
"images_by_url": [
"<string>"
],
"images": [
"<string>"
],
"file_by_url": "<string>",
"file": "<string>"
}
'import requests
url = "https://my.cloudtalk.io/api/sms/send.json"
payload = {
"recipient": "<string>",
"message": "<string>",
"sender": "<string>",
"country_code": "<string>",
"images_by_url": ["<string>"],
"images": ["<string>"],
"file_by_url": "<string>",
"file": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipient: '<string>',
message: '<string>',
sender: '<string>',
country_code: '<string>',
images_by_url: ['<string>'],
images: ['<string>'],
file_by_url: '<string>',
file: '<string>'
})
};
fetch('https://my.cloudtalk.io/api/sms/send.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://my.cloudtalk.io/api/sms/send.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'recipient' => '<string>',
'message' => '<string>',
'sender' => '<string>',
'country_code' => '<string>',
'images_by_url' => [
'<string>'
],
'images' => [
'<string>'
],
'file_by_url' => '<string>',
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://my.cloudtalk.io/api/sms/send.json"
payload := strings.NewReader("{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://my.cloudtalk.io/api/sms/send.json")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cloudtalk.io/api/sms/send.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"responseData": {
"success": "true|false",
"data": "{'recipient': 'string','message': 'string','sender': 'string','country_code': 'string'}\n |SMS send failed|Not allowed country.|Unknown number|Limit exceeded|Bad number configuration"
}
}{
"responseData": {
"status": 400,
"message": "Bad request"
}
}{
"responseData": {
"status": 401,
"message": "Unauthorized action"
}
}{
"responseData": {
"status": 403,
"message": "Insufficient Funds"
}
}{
"responseData": {
"status": 500,
"message": "Something went wrong."
}
}Send sms
The success response for sms/send.json may include false success attribute, where attribute data is populated with the provider error message
curl --request POST \
--url https://my.cloudtalk.io/api/sms/send.json \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"recipient": "<string>",
"message": "<string>",
"sender": "<string>",
"country_code": "<string>",
"images_by_url": [
"<string>"
],
"images": [
"<string>"
],
"file_by_url": "<string>",
"file": "<string>"
}
'import requests
url = "https://my.cloudtalk.io/api/sms/send.json"
payload = {
"recipient": "<string>",
"message": "<string>",
"sender": "<string>",
"country_code": "<string>",
"images_by_url": ["<string>"],
"images": ["<string>"],
"file_by_url": "<string>",
"file": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
recipient: '<string>',
message: '<string>',
sender: '<string>',
country_code: '<string>',
images_by_url: ['<string>'],
images: ['<string>'],
file_by_url: '<string>',
file: '<string>'
})
};
fetch('https://my.cloudtalk.io/api/sms/send.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://my.cloudtalk.io/api/sms/send.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'recipient' => '<string>',
'message' => '<string>',
'sender' => '<string>',
'country_code' => '<string>',
'images_by_url' => [
'<string>'
],
'images' => [
'<string>'
],
'file_by_url' => '<string>',
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://my.cloudtalk.io/api/sms/send.json"
payload := strings.NewReader("{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://my.cloudtalk.io/api/sms/send.json")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://my.cloudtalk.io/api/sms/send.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"recipient\": \"<string>\",\n \"message\": \"<string>\",\n \"sender\": \"<string>\",\n \"country_code\": \"<string>\",\n \"images_by_url\": [\n \"<string>\"\n ],\n \"images\": [\n \"<string>\"\n ],\n \"file_by_url\": \"<string>\",\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"responseData": {
"success": "true|false",
"data": "{'recipient': 'string','message': 'string','sender': 'string','country_code': 'string'}\n |SMS send failed|Not allowed country.|Unknown number|Limit exceeded|Bad number configuration"
}
}{
"responseData": {
"status": 400,
"message": "Bad request"
}
}{
"responseData": {
"status": 401,
"message": "Unauthorized action"
}
}{
"responseData": {
"status": 403,
"message": "Insufficient Funds"
}
}{
"responseData": {
"status": 500,
"message": "Something went wrong."
}
}Authorizations
HTTP Basic Authentication. Use your API Access Key ID as the username and your API Access Key Secret as the password. Generate keys in the CloudTalk Dashboard under Account -> Settings -> API Keys (https://dashboard.cloudtalk.io/menu/account/settings/API-keys).
Body
Recipient number in E.164 format. To send Whatsapp message include prefix "whatsapp:+421..." to both sender and recipient numbers.
Message body/content.
Sender number in E.164 format. To send Whatsapp message include prefix "whatsapp:+421..." to both sender and recipient numbers.
Country code of recipient number.
Image to be send as MMS. Will be downloaded from URL. MAX 5MB. Can contain up to 5 urls.
Image sent as blob to be send as MMS. MAX 5MB. Can contain up to 5 images.
File to be send to Whatsapp. Will be downloaded from URL. MAX 16MB. To send Whatsapp message recipient and sender number must contain prefix "whatsapp:" example "whatsapp:+421...". Field message must be empty.
File sent as blob to be send to Whatsapp. MAX 16MB. To send Whatsapp message recipient and sender number must contain prefix "whatsapp:" example "whatsapp:+421...". Field message must be empty.
Response
Status of sms sending
Show child attributes
Show child attributes