Authentication
Each request made must include client authorisation in the header of the HTTP request. This will use basic HTTP access authentication.
The authorisation header is constructed by combining the username:apiPassword
string and encoding it in Base64. This string is prefixed by the Authorization: Basic
string.
For example, for the username username
and password apiPassword
, the resulting header would be:
Authorization: Basic dXNlcm5hbWU6YXBpUGFzc3dvcmQ=
The apiPassword is different from the platform access password. To obtain it, go to the APIs / Change API password menu of the platform.
It should be mentioned that in order to increase system security, the client must specify the IP from where it will connect, as only messages from the IP specified by the customer will be allowed.
Campaigns
Send SMS Message
POST
{{DASHBOARD_HOST}}/api/rest/sms
curl -X POST '{{DASHBOARD_HOST}}/api/rest/sms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"to": ["34666555444"],
"from": "TEST",
"message": "SMS text message"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"to": ["34666555444"],
"from": "TEST",
"message": "SMS text message"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "to": ["34666555444"], "from": "TEST", "message": "SMS text message" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sms"
payload = "{ \" to \" : [ \" 34666555444 \" ], \" from \" : \" TEST \" , \" message \" : \" SMS text message \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" to \" : [ \" 34666555444 \" ], \" from \" : \" TEST \" , \" message \" : \" SMS text message \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"to\": [\"34666555444\"], \"from\": \"TEST\", \"message\": \"SMS text message\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "XXXXXXXXXXXXX" ,
"parts" : 1 ,
"scheduledAt" : null ,
"expiresAt" : null
}
]
}
HTTP Response Code 207 (MULTI-STATUS)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "XXXXXXXXXXXXX" ,
"parts" : 1 ,
"scheduledAt" : null ,
"expiresAt" : null
},
{
"accepted" : false ,
"to" : "34" ,
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
Parameters
Parameter
Type
Mandatory
Description
message
string
Yes
Text of message. At most, there can be 160 characters if it is not specified that the message is multi-part (see parts
parameter). The text must be encoded in UTF-8.
to
array
Yes
Mobile phone number to receive message. Must include the prefix (e.g. in Spain 34666666666). This field allows you to specify multiple recipients.
from
string
Yes
Sender text, this label will consist of 15 numbers or 11 alphanumeric characters.
encoding
string
No
Possible values are 'gsm', 'gsm-pt' and 'utf-16'. The value gsm
for normal mailings with GSM7 coding and 160 characters per message, and the value utf-16
for UCS2 (UTF16) coding and 70 characters per message. If not specified, the default value is gsm
.
scheduleDate
string
No
Date of message sent in UTC format. If you need to send scheduled messages, the delivery date can be specified by indicating the date in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate mailings, this parameter does not have to be specified.
expirationDate
string
No
Message expiration date in UTC. Format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00).
parts
integer
No
Indicates the maximum number of parts into which the scheduled message will be divided. This variable is set to 1
by default, so if it is not specified and a message over 160 characters for gsm encoding is sent, the message will fail. Keep in mind that concatenated messages may only be 153 characters per part in gsm and 67 characters per part in utf-16
and each part is charged as one message. The server will only use the minimum necessary parts for sending the text even if the specified number of parts is higher than necessary. If the number of parts is less than that required for sending the text, the message will fail with error 105. The maximum number of parts allowed is 15
.
notificationUrl
string|array
No
URL to receive delivery notifications.
trans
integer
No
Possible values are 1 and 0. With value 0, the server does not change any character in the message, as this is the default value. With value 1, the server modifies the common invalid characters in GSM7 to valid characters with the following translation table: 'á' => 'a', 'í'=>'i', 'ó'=>'o', 'ú'=>'u', 'ç'=>'Ç', 'Á'=>'A', 'Í'=>'I', 'Ó'=>'O', 'Ú'=>'U', 'À'=>'A', 'È'=>'E', 'Ì'=>'I', 'Ò'=>'O', 'Ù'=>'U', 'º' => '', 'ª' => '', 'Õ' => 'O', 'õ' => 'o', 'â' => 'a', 'ê' => 'e', 'î'=>'i', 'ô'=>'o', 'û'=>'u', 'Â'=>'A', 'Ê'=>'E', 'Î'=>'I', 'Ô'=>'O', 'Û'=>'U', 'ã' => 'a', 'Ã' => 'A'.
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the delivery statistics will be added to the existing campaign.
tags
array
No
campaignName is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
certified
boolean
No
If it is specified as true, the message will be sent as certified. * Certified messages have additional cost
sub
array
No
array with substitution variables that will be applied to the message.
splitParts
boolean
No
For messages that exceed the maximum SMS length, the server will split the message into multiple SMS instead of using concatenated SMS. The default value is false
.
flash
boolean
No
Flash SMS is a message that appears directly on the device screen. Depending on the model and operating system it is possible to store it in the inbox and send concatenated messages.
availableTimes
array
No
It indicates the times in which the SMS will be sent. Json objects are defined in the form: [{"day": 1, "from": "09:00", "to": "21:00"}]
day
: a day of the range between Monday to Sunday is indicated, it must be a number between 1 and 7. Optional : If not specified, the range will apply to all days of the week. from
: time that defines the start of the time range in UTC 24 hour format. to
: time that defines the end of the time range in UTC 24 hour format.
otpConfig
object
No
In the case of adding the {OTP_CODE}
variable within the parameter "message", the OTP code parameters can be specified. For example:{"alpha": true, "length": 5}
alpha
: indicates whether the code is alphanumeric or numeric. The default value is false
.length
: length of the code. The minimum value is 3
and the maximum is 10
. The default value is 4
.maxAttempts
: maximum number of attempts. The minimum value is 1
and the maximum is 10
. The default value is 3
.maxSecondsValidity
: maximum number of seconds between code generation and code validation. The minimum value is 30
and the maximum is 600
. The default value is 60
.appId
: the same phone or email can be validated at the same time as long as it is with a different appId
. The default value is ""
.rejectIfPendingCode
: prevents the generation of a new OTP code if a previous one exists in pending status. The default value is false
.
To generate an unsubscribe URL you must add {UNSUB_URL} within the "message" parameter.
To generate an OTP code you must add {OTP_CODE} within the "message" parameter. To validate an OTP code you must make a request to otp/check .
Substitution variables
When using the sub parameter, the array must contain as many items as the send recipients, using the following format:
{
"from" : "TEST" ,
"to" : [ "34666555444" , "34666555333" ],
"message" : "Hello {name}" ,
"sub" : [
{ "name" : "first contact name" },
{ "name" : "second contact name" }
]
}
Custom variables can be indicated in the message body. These variables will be replaced by the contact's custom variables or by the variables indicated in the sub
parameter.
Multiple notification URLs
When using multiple notification URLs, the array must contain as many elements as the send recipients.
{
"from" : "TEST" ,
"to" : [ "34666555444" , "34666555333" ],
"message" : "SMS text message" ,
"notificationUrl" : [
"https://example.com/first-notification-url" ,
"https://example.com/second-notification-url"
]
}
It is possible to specify a different notification url per recipient.
For this you have to use an array for the notificationUrl
parameter. The array must contain as many elements as the send recipients.
Custom fields filters
It is possible to add the following filters to custom variables.
Filter
Description
Example
Result
lower
Return lowercase
text.
{name|lower}
my name
upper
Return text in uppercase
.
{name|upper}
MY NAME
capitalize
Return the text with the first letter of the first word in uppercase
.
{name|capitalize}
My name
capitalizeAll
Return the text with the first letter of each word in uppercase
.
{name|capitalizeAll}
My Name
formatDotComma
Returns the number with a dot
as thousands separator and comma
as decimal separator.
{number|formatDotComma}
1.234,56
formatCommaDot
Returns the number with a comma
as thousands separator and dot
as decimal separator.
{number|formatCommaDot}
1,234.56
shorten
Returns a shortened
url. It must be a valid url.
{url|shorten}
https://sms.tl/xxxxxx
Delivery notifications
If you wish to receive delivery notifications in real time, you must specify the variable notificationUrl
with the URL of the client where you want mailing status to be notified.
The operation involves specifying the URL where you want to make a request to our server for each HTTP request when a notification from the operator is received. To do this, the client must have an HTTP server capable of receiving such notifications.
Our server will send the variables using the GET method as the client wants. To do that in the URL that you send us, you have to write the variable name followed by an escape character that will contain the value; escape characters have the form of the %
character followed by a letter. This is an example URL:
https://example.com/notify.php?sender=%p&phone=%P&status=%s
These are the defined escape characters:
%i
{{NAME}} identifier that was delivered when mailing was sent.
%p
sender of SMS.
%P
phone number of SMS recipient.
%t
date the message was sent with format YYYY-MM-DD HH:MM
, ejemplo: 2020-09-21 14:18.
%c
cost of message.
%s
status: REJECTD
, DELIVRD
, EXPIRED
, DELETED
, UNDELIV
, ACCEPTD
, UNKNOWN
, RECEIVED
.
%m
operator mnc (only in countries where available).
%y
DLR date of message with YYYY-MM-DD HH:MM
format, e.j., 2020-09-21 14:19.
%n
part number (concatenated messages).
%C
campaign identifier.
%S
sending identifier.
To better explain the process, below is an example of the SMS message and its delivery notification.
First, we send the SMS with the notificationUrl variable to indicate the URL where we want to receive the delivery notification. We will add our mailing identifier to this URL to identify it unambiguously when we receive it. The final URL for the notification would be:
https://example.com/notify.php?sender=%p&phone=%P&status=%s&customId=123456
GET
{{DASHBOARD_HOST}}/api/rest/sms/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sms/<ID>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sms/<ID>' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sms/<ID>" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sms/<ID> ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sms/<ID>"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sms/<ID>" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sms/<ID>" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 200 (OK)
{
"data" : [
{
"id" : "XXXXXXXXXXXXX" ,
"from" : "SAMPLE" ,
"to" : "34666555444" ,
"message" : "SMS text message" ,
"campaignId" : 123456 ,
"sendingId" : 234567 ,
"isDelivered" : true ,
"isClicked" : false ,
"events" : [
{
"type" : "sent" ,
"date" : "2021-07-19T15:00:33+00:00" ,
"isMobile" : false ,
"browser" : "" ,
"os" : ""
},
{
"type" : "delivered" ,
"date" : "2021-07-19T15:00:33+00:00" ,
"isMobile" : false ,
"browser" : "" ,
"os" : ""
}
],
"customFields" : {
"email" : "test@test.com" ,
"phone" : "34666555444" ,
"name" : "Name"
},
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/sms/XXXXXXXXXXXXX"
}
}
]
}
Error response (HTTP 404)
{
"error" : {
"code" : 404 ,
"description" : "Resource not found"
}
}
Parameter
Type
Mandatory
Description
id
string
Yes
Identifier of the message returned in the response of api/rest/sms
in the id
field. It is possible to specify multiple identifiers separated by commas.
Send Email message
POST
{{DASHBOARD_HOST}}/api/rest/mailing
curl -X POST '{{DASHBOARD_HOST}}/api/rest/mailing' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"to": ["test@example.com"],
"fromName": "Info",
"fromEmail": "info@sample.com",
"body": "<html><head><title>TEST</title></head><body><a href=\"https://example.com\">link</a></body></html>",
"replyTo": "replyto@example.com",
"subject": "TEST"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/mailing' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"to": ["test@example.com"],
"fromName": "Info",
"fromEmail": "info@sample.com",
"body": "<html><head><title>TEST</title></head><body><a href=\"https://example.com\">link</a></body></html>",
"replyTo": "replyto@example.com",
"subject": "TEST"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/mailing" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@sample.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/mailing ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "to": ["test@example.com"], "fromName": "Info", "fromEmail": "info@sample.com", "body": "<html><head><title>TEST</title></head><body><a href= \ "https://example.com \ ">link</a></body></html>", "replyTo": "replyto@example.com", "subject": "TEST" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/mailing"
payload = "{ \" to \" : [ \" test@example.com \" ], \" fromName \" : \" Info \" , \" fromEmail \" : \" info@sample.com \" , \" body \" : \" <html><head><title>TEST</title></head><body><a href= \\\" https://example.com \\\" >link</a></body></html> \" , \" replyTo \" : \" replyto@example.com \" , \" subject \" : \" TEST \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/mailing" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" to \" : [ \" test@example.com \" ], \" fromName \" : \" Info \" , \" fromEmail \" : \" info@sample.com \" , \" body \" : \" <html><head><title>TEST</title></head><body><a href= \\\" https://example.com \\\" >link</a></body></html> \" , \" replyTo \" : \" replyto@example.com \" , \" subject \" : \" TEST \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/mailing" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"to\": [\"test@example.com\"], \"fromName\": \"Info\", \"fromEmail\": \"info@sample.com\", \"body\": \"<html><head><title>TEST</title></head><body><a href=\\\"https://example.com\\\">link</a></body></html>\", \"replyTo\": \"replyto@example.com\", \"subject\": \"TEST\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "test@example.com" ,
"id" : "XXXXXXXXXXXXX" ,
"scheduledAt" : null
}
]
}
HTTP Response Code 207 (MULTI-STATUS)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "test@example.com" ,
"id" : "XXXXXXXXXXXXX" ,
"scheduledAt" : null
},
{
"accepted" : false ,
"to" : "invalidEmail" ,
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
Parameters
Parameter
Type
Mandatory
Description
body
string
No
Email body in HTML
format and UTF-8
encoding. Required without templateId.
templateId
integer
No
Legacy template ID to send as the body of the email. Required without body. This ID refers to templates created from the previous version ({{DASHBOARD_HOST}} ) of the {{NAME}} application. It is recommended to use the templateV2Id parameter when possible.
templateV2Id
integer
No
Template ID to send as the body of the email. Required without body. This ID refers to the current version ({{HOST}} ) of the {{NAME}} application.
to
array
Yes
Email addresses of the sending. This field allows you to specify multiple recipients.
cc
array
No
Email addresses of the sending in carbon copy. This field allows you to specify multiple recipients.
bcc
array
No
Email addresses of the sending in blind carbon copy. This field allows you to specify multiple recipients.
fromEmail
string
Yes
Sender email The indicated email address must be validated on the {{NAME}} platform.
subject
string
Yes
Brief summary of the subject of the message.
fromName
string
No
Name of sender of the sending.
replyTo
string
Yes
Address for responding to the message. The indicated email address must be validated on the {{NAME}} platform.
scheduleDate
string
No
Date message sent in UTC format. If you need to send scheduled messages, the send date can be specified by indicating the date in the following format YYYYmmddHHiiss
(ej. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate mailings, this parameter does not have to be specified.
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the delivery statistics will be added to the existing campaign.
tags
array
No
campaignName is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
certified
boolean
No
If it is specified as true, the message will be sent as certified. * Certified messages have an additional cost
sub
array
No
Array with substitution variables that will be applied to the message.
attachments
array
No
Email attachments. An array of objects is defined as follows:[{ "name": "filename.txt", "content": "Ci4vYmluL3pvb2tlZ...", "contentType": "text/plain" }]
name
: file name.content
: file content in base64 .contentType
: file content type. * Attached files have an additional cost.
trackOpens
boolean
No
Add a pixel to get opening statistics. The default value is true
.
trackClicks
boolean
No
Track the links to get click statistics. The default value is true
.
otpConfig
object
No
In the case of adding the {OTP_CODE}
variable within the parameter "body", the OTP code parameters can be specified. For example:{"alpha": true, "length": 5}
alpha
: indicates whether the code is alphanumeric or numeric. The default value is false
.length
: length of the code. The minimum value is 3
and the maximum is 10
. The default value is 4
.maxAttempts
: maximum number of attempts. The minimum value is 1
and the maximum is 10
. The default value is 3
.maxSecondsValidity
: maximum number of seconds between code generation and code validation. The minimum value is 30
and the maximum is 600
. The default value is 60
.appId
: the same phone or email can be validated at the same time as long as it is with a different appId
. The default value is ""
.rejectIfPendingCode
: prevents the generation of a new OTP code if a previous one exists in pending status. The default value is false
.
To generate an unsubscribe URL you must add [unsubscribe_link] inside the href of a link in the "body" parameter.
For example: <a href="[unsubscribe_link]">Link</a>
To generate an OTP code you must add {OTP_CODE} within the "body" parameter. To validate an OTP code you must make a request to otp/check .
Substitution variables
When using the sub parameter, the array must contain as many items as the send recipients, using the following format:
{
"to" : [ "test@example.com" , "test2@example.com" ],
"fromName" : "Info" ,
"fromEmail" : "info@sample.com" ,
"body" : "<html><head><title>TEST</title></head><body>Hello {name}, <a href= \" https://example.com \" >link</a></body></html>" ,
"replyTo" : "replyto@example.com" ,
"subject" : "TEST" ,
"sub" : [
{ "name" : "first contact name" },
{ "name" : "second contact name" }
]
}
Custom variables can be indicated in the message body. These variables will be replaced by the contact's custom variables or by the variables indicated in the sub
parameter.
Send Voice message
POST
{{DASHBOARD_HOST}}/api/rest/voice
curl -X POST '{{DASHBOARD_HOST}}/api/rest/voice' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"to": ["34666666666"],
"message": "Esto es un test de mensaje de voz",
"gender": "F",
"language": "es_ES"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/voice' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"to": ["34666666666"],
"message": "Esto es un test de mensaje de voz",
"gender": "F",
"language": "es_ES"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/voice" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/voice ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "to": ["34666666666"], "message": "Esto es un test de mensaje de voz", "gender": "F", "language": "es_ES" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/voice"
payload = "{ \" to \" : [ \" 34666666666 \" ], \" message \" : \" Esto es un test de mensaje de voz \" , \" gender \" : \" F \" , \" language \" : \" es_ES \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/voice" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" to \" : [ \" 34666666666 \" ], \" message \" : \" Esto es un test de mensaje de voz \" , \" gender \" : \" F \" , \" language \" : \" es_ES \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/voice" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"to\": [\"34666666666\"], \"message\": \"Esto es un test de mensaje de voz\", \"gender\": \"F\", \"language\": \"es_ES\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666666666" ,
"id" : "XXXXXXXXXXXXX" ,
"scheduledAt" : null ,
"expiresAt" : null
}
]
}
HTTP Response Code 207 (MULTI-STATUS)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666666666" ,
"id" : "XXXXXXXXXXXXX" ,
"scheduledAt" : null ,
"expiresAt" : null
},
{
"accepted" : false ,
"to" : "34" ,
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
Parameters
Parameter
Type
Required
Description
message
string
Yes
Message text. At most it can have 500 characters. The text must be encoded in UTF-8
.
to
array
Yes
Mobile phone number to receive message. Must include the prefix (e.g. in Spain 34666666666). This field allows you to specify multiple recipients.
language
string
Yes
Language to convert the text; the options are: 'en_GB': English - United Kingdom, 'en_US': English - United States, 'es_ES': Spanish - España, 'es_US': Spanish - Latino, 'pt_PT': Portuguese - Portugal, 'pt_BR': Portuguese - Brazil, 'cmn_CN': Mandarin Chinese - China * , 'arb': Arab * , 'de_DE': German - Germany, 'fr_FR': French - France, 'it_IT': Italian - Italy, 'hi_IN': Indi - India * .* Available only in female gender.
gender
string
Yes
Gender of voice; the allowed values are 'F' for a woman's voice and 'M' for a man's voice.
callers
object
No
Object with the list of personalized senders by country to be used in the call. If the sender is not specified for a specific country, the default sender will be used. In order to st-up a customized sender, please contact the support department. Example: {"ES": "6123456789", "PT": "6987654321"}
scheduleDate
string
No
Date of message sent in UTC format. If you need to send scheduled messages, the delivery date can be specified by indicating the date in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate messages, this parameter does not have to be specified.
retries
integer
No
Maximum number of retries. Maximum 5
. If not specified, there will be no retries.
expirationDate
string
No
To determine the latest date on which the call can be performed. After this date, the call will be cancelled. By specifying the period of validity, retries will be automatically attempted, making the call again if the recipient does not answer. The date should be in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20).
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the mailing statistics will be added to the existing campaign.
tags
array
No
campaignName
is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
sub
array
No
array with substitution variables that will be applied to the message.
amd
boolean
No
Answer Machine Detection (AMD): Detects if the call has been answered by an answering machine, if so, automatically ends the call. The default value is false
.
Substitution variables
Custom variables can be indicated in the message body. These variables will be replaced by the contact's custom variables or by the variables indicated in the sub
parameter.
When using the sub parameter, the array must contain as many items as the send recipients.
Send Voice message with an audio file
POST
{{DASHBOARD_HOST}}/api/rest/voiceAudio
curl -X POST '{{DASHBOARD_HOST}}/api/rest/voiceAudio' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"to": ["34666666666"],
"audioUrl": "https://example.com/audio.mp3"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/voiceAudio' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"to": ["34666666666"],
"audioUrl": "https://example.com/audio.mp3"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/voiceAudio" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/voiceAudio ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "to": ["34666666666"], "audioUrl": "https://example.com/audio.mp3" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/voiceAudio"
payload = "{ \" to \" : [ \" 34666666666 \" ], \" audioUrl \" : \" https://example.com/audio.mp3 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/voiceAudio" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" to \" : [ \" 34666666666 \" ], \" audioUrl \" : \" https://example.com/audio.mp3 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/voiceAudio" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"to\": [\"34666666666\"], \"audioUrl\": \"https://example.com/audio.mp3\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666666666" ,
"id" : "XXXXXXXXXXXXX" ,
"scheduledAt" : null ,
"expiresAt" : null
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
Parameters
Parameter
Type
Required
Description
to
array
Yes
Mobile phone number to receive message. Must include the prefix (e.g. in Spain 34666666666). This field allows you to specify multiple recipients.
audioUrl
string
Yes
URL of the audio to be sent. Example: https://example.com/audio.mp3
callers
object
No
Object with the list of personalized senders by country to be used in the call. If the sender is not specified for a specific country, the default sender will be used. In order to st-up a customized sender, please contact the support department. Example: {"ES": "6123456789", "PT": "6987654321"}
scheduleDate
string
No
Date of message sent in UTC format. If you need to send scheduled messages, the delivery date can be specified by indicating the date in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate messages, this parameter does not have to be specified.
retries
integer
No
Maximum number of retries. Maximum 5
. If not specified, there will be no retries.
expirationDate
string
No
To determine the latest date on which the call can be performed. After this date, the call will be cancelled. By specifying the period of validity, retries will be automatically attempted, making the call again if the recipient does not answer. The date should be in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20).
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the mailing statistics will be added to the existing campaign.
tags
array
No
campaignName
is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
amd
boolean
No
Answer Machine Detection (AMD): Detects if the call has been answered by an answering machine, if so, automatically ends the call. The default value is false
.
Retry Policy
If the maximum number of retries is specified in the optional retries
variable, the system will automatically retry unanswered calls. This functionality does not generate additional costs, since only the calls that are answered by the recipient will be charged.
When the system detects that the call has not been answered, the call is repeated after 10 minutes
. The time elapsed from the unanswered call to the retry time will vary depending on the existing queue, but it is always greater than 10 minutes.
To prevent retries from taking place at unwanted times, it is recommended to specify the expiration date in the optional variable expirationDate.
Landing SMS
Send Landing SMS message
POST
{{DASHBOARD_HOST}}/api/rest/landingsms
curl -X POST '{{DASHBOARD_HOST}}/api/rest/landingsms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"to": ["34666555444"],
"message": "TEST API LANDING {LAND_URL}",
"from": "LANDINGAPI",
"templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/landingsms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"to": ["34666555444"],
"message": "TEST API LANDING {LAND_URL}",
"from": "LANDINGAPI",
"templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/landingsms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/landingsms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "to": ["34666555444"], "message": "TEST API LANDING {LAND_URL}", "from": "LANDINGAPI", "templateBody": "<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/landingsms"
payload = "{ \" to \" : [ \" 34666555444 \" ], \" message \" : \" TEST API LANDING {LAND_URL} \" , \" from \" : \" LANDINGAPI \" , \" templateBody \" : \" <html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html> \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/landingsms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" to \" : [ \" 34666555444 \" ], \" message \" : \" TEST API LANDING {LAND_URL} \" , \" from \" : \" LANDINGAPI \" , \" templateBody \" : \" <html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html> \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/landingsms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"to\": [\"34666555444\"], \"message\": \"TEST API LANDING {LAND_URL}\", \"from\": \"LANDINGAPI\", \"templateBody\": \"<html><head><title>LANDING TEST</title></head><body><h1>HELLO LANDING</h1></body></html>\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "XXXXXXXXXXXXX" ,
"parts" : 1 ,
"scheduledAt" : null ,
"expiresAt" : null
}
]
}
HTTP Response Code 207 (MULTI-STATUS)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "XXXXXXXXXXXXX" ,
"parts" : 1 ,
"scheduledAt" : null ,
"expiresAt" : null
},
{
"accepted" : false ,
"to" : "34" ,
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 102 ,
"description" : "No valid recipients"
}
}
Parameters
Parameter
Type
Mandatory
Description
message
string
Yes
Text of message. At most, there can be 160 characters if it is not specified that the message is multi-part (see parts
parameter). The text must be encoded in UTF-8
to
array
Yes
Mobile phone number to receive message. Must include the prefix (e.g. in Spain 34666666666). This field allows you to specify multiple recipients.
from
string
Yes
Sender text, this label will consist of 15 numbers or 11 alphanumeric characters.
encoding
string
No
Possible values are 'gsm', 'gsm-pt' and 'utf-16'. The value gsm
for normal mailings with GSM7 coding and 160 characters per message, and the value utf-16
for UCS2 (UTF16) coding and 70 characters per message. If not specified, the default value is gsm
.
scheduleDate
string
No
Date of message sent in UTC format. If you need to send scheduled messages, the delivery date can be specified by indicating the date in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate mailings, this parameter does not have to be specified.
expirationDate
string
No
Message expiration date in UTC. Format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00).
parts
integer
No
Indicates the maximum number of parts into which the scheduled message will be divided. This variable is set to 1
by default, so if it is not specified and a message over 160 characters for gsm encoding is sent, the message will fail. Keep in mind that concatenated messages may only be 153 characters per part in gsm and 67 characters per part in utf-16
and each part is charged as one message. The server will only use the minimum necessary parts for sending the text even if the specified number of parts is higher than necessary. If the number of parts is less than that required for sending the text, the message will fail with error 105. The maximum number of parts allowed is 8.
notificationUrl
string
No
URL to receive delivery notifications.
trans
integer
No
Possible values are 1 and 0. With value 0, the server does not change any character in the message, as this is the default value. With value 1, the server modifies the common invalid characters in GSM7 to valid characters with the following translation table: 'á' => 'a', 'í'=>'i', 'ó'=>'o', 'ú'=>'u', 'ç'=>'Ç', 'Á'=>'A', 'Í'=>'I', 'Ó'=>'O', 'Ú'=>'U', 'À'=>'A', 'È'=>'E', 'Ì'=>'I', 'Ò'=>'O', 'Ù'=>'U', 'º' => '', 'ª' => '', 'Õ' => 'O', 'õ' => 'o', 'â' => 'a', 'ê' => 'e', 'î'=>'i', 'ô'=>'o', 'û'=>'u', 'Â'=>'A', 'Ê'=>'E', 'Î'=>'I', 'Ô'=>'O', 'Û'=>'U', 'ã' => 'a', 'Ã' => 'A'.
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the delivery statistics will be added to the existing campaign.
tags
array
No
campaignName is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
certified
boolean
No
If it is specified as true, the message will be sent as certified. * Certified messages have additional cost
sub
array
No
array with substitution variables that will be applied to the message.
splitParts
boolean
No
For messages that exceed the maximum SMS length, the server will split the message into multiple SMS instead of using concatenated SMS. The default value is false
.
flash
boolean
No
Flash SMS is a message that appears directly on the device screen. Depending on the model and operating system it is possible to store it in the inbox and send concatenated messages.
templateBody
string
No
Content of the landing page in HTML
format and UTF-8
encoding. Required without templateId.
templateId
integer
No
Legacy template ID to send as the content of the landing page. Required without templateBody. This ID refers to templates created from the previous version ({{DASHBOARD_HOST}} ) of the {{NAME}} application. It is recommended to use the templateV2Id parameter when possible.
templateV2Id
integer
No
Template ID to send as the content of the landing page. Required without templateBody. This ID refers to the current version ({{HOST}} ) of the {{NAME}} application.
To generate an unsubscribe URL you must add {UNSUB_URL} within the "message" parameter.
Substitution variables
When using the sub parameter, the array must contain as many items as the send recipients, using the following format:
{
"from" : "TEST" ,
"to" : [ "34666555444" , "34666555333" ],
"message" : "Hello {name}" ,
"sub" : [
{ "name" : "first contact name" },
{ "name" : "second contact name" }
]
}
Custom variables can be indicated in the message body. These variables will be replaced by the contact's custom variables or by the variables indicated in the sub
parameter.
Custom fields filters
It is possible to add the following filters to custom variables.
Filtro
Description
Example
Result
lower
Return lowercase
text
{name|lower}
my name
upper
Return text in uppercase
{name|upper}
MY NAME
capitalize
Return the text with the first letter of the first word in uppercase
{name|capitalize}
My name
capitalizeAll
Return the text with the first letter of each word in uppercase
{name|capitalizeAll}
My Name
formatDotComma
Returns the number with a dot
as thousands separator and comma
as decimal separator
{number|formatDotComma}
1.234,56
formatCommaDot
Returns the number with a comma
as thousands separator and dot
as decimal separator
{number|formatCommaDot}
1,234.56
shorten
Returns a shortened
url. It must be a valid url.
{url|shorten}
https://sms.tl/xxxxxx
Send WhatsApp template
POST
{{DASHBOARD_HOST}}/api/rest/whatsapp
curl -X POST '{{DASHBOARD_HOST}}/api/rest/whatsapp' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"templateId": 123,
"from": "34666777555",
"messages": [
{
"to": "34666555444"
}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/whatsapp' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"templateId": 123,
"from": "34666777555",
"messages": [
{
"to": "34666555444"
}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/whatsapp" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/whatsapp ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "templateId": 123, "from": "34666777555", "messages": [ { "to": "34666555444" } ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/whatsapp"
payload = "{ \" templateId \" : 123, \" from \" : \" 34666777555 \" , \" messages \" : [ { \" to \" : \" 34666555444 \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/whatsapp" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" templateId \" : 123, \" from \" : \" 34666777555 \" , \" messages \" : [ { \" to \" : \" 34666555444 \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/whatsapp" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"templateId\": 123, \"from\": \"34666777555\", \"messages\": [ { \"to\": \"34666555444\" } ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 202 (ACCEPTED)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "04c80b02-8c0c-4884-bab8-89d6bc1fe406"
}
]
}
HTTP Response Code 207 (MULTI-STATUS)
{
"campaignId" : 100000 ,
"sendingId" : 100001 ,
"result" : [
{
"accepted" : true ,
"to" : "34666555444" ,
"id" : "8b4e5d35-dc16-4e2e-8a9c-c222db81f5ba"
},
{
"accepted" : false ,
"to" : "34" ,
"error" : {
"code" : 102 ,
"description" : "The messages.1.to field does not contain a valid phone number"
}
}
]
}
Error response (HTTP 400)
{
"error" : {
"code" : 140 ,
"description" : "Invalid template"
}
}
Parameters
Parameter
Type
Mandatory
Description
templateId
integer
Yes
ID of the WhatsApp template to be sent. The template must be approved for sending from the platform.
from
string
Yes
Sender of the message. The sender must be registered on the platform.
messages
array
Yes
Array of messages to send.
messages.*.to
string
Yes
Mobile phone number to receive message. Must include the international prefix (e.g. in Spain 34666666666).
messages.*.headerFields
array
No*
Array of positional substitution variables to be applied to the header. Required for templates with header variables.
messages.*.bodyFields
array
No*
Array of positional substitution variables to apply to the message body. Required for templates with message variables.
messages.*.callToActionFields
array
No*
Array of positional substitution variables to apply to interaction buttons. Required for templates with action variables.
messages.*.defaultAnswer
array
No
Default response to the user's first message.
messages.*.buttonAnswers
array
No
Array of positional responses to quick answer buttons.
messages.*.location
object
No*
Location information. Required for templates containing location.
messages.*.location.lat
string
No*
Latitude of the geographic point. Required for templates containing location.
messages.*.location.long
string
No*
Longitude of the geographical point. Required for templates containing location.
messages.*.location.name
string
No
Name of the location.
messages.*.location.address
string
No
Address of the location.
campaignName
string
No
Campaign name. If specified, a campaign will be created with the name indicated in the dashboard and which will contain the mailing statistics. If a campaign with this name already exists, the delivery statistics will be added to the existing campaign.
tags
array
No
campaignName is required if this parameter is specified. List of tags to add to the campaign. The tags can be used to filter the statistics in the dashboard.
Sending examples
Examples of sending various types of WhatsApp templates.
Sending template with variables and auto-answers.
{
"templateId" : 123 ,
"from" : "34666777555" ,
"messages" : [
{
"to" : "34666555444" ,
"headerFields" : [ "headerField1" ],
"bodyFields" : [ "bodyField1" , "bodyField2" ],
"callToActionFields" : [ "actionField1" ],
"defaultAnswer" : "Example answer" ,
"buttonAnswers" : [
"first button answer" ,
"second button answer" ,
]
}
]
}
Sending template with location.
{
"templateId" : 123 ,
"from" : "34666777555" ,
"messages" : [
{
"to" : "34666555444" ,
"location" : {
"lat" : "39.92516922986921" ,
"long" : "-0.10572674363232447" ,
"name" : "NRS-Group" ,
"address" : "Carrer, Av. Arcadi Garcia Sanz, 19, 12540 Vila-real, Castelló"
}
}
]
}
Sending template with authentication code.
{
"templateId" : 123 ,
"from" : "34666777555" ,
"messages" : [
{
"to" : "34666555444" ,
"bodyFields" : [ "auth_code" ]
}
]
}
Conversation list
GET
{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations
curl -X GET '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/whatsapp/conversations ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"from" : "34666777555" ,
"to" : "34666555444" ,
"totalMessages" : 10 ,
"status" : "OPEN" ,
"isSessionActive" : true ,
"sessionExpiresAt" : "2024-01-02T10:00:00+00:00" ,
"createdAt" : "2024-01-01T10:00:00+00:00" ,
"updatedAt" : "2024-01-01T10:00:00+00:00" ,
"links" : {
"messages" : "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
},
"contact" : {
"data" : {
"msisdn" : "34666555444" ,
"firstName" : "First" ,
"lastName" : "Last" ,
"email" : "email@example.com" ,
"interest" : "Interest example" ,
"comment" : "Comment example" ,
"country" : "ES"
}
}
}
],
"meta" : {
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations&page=2"
}
}
}
}
Filters
Parameter
Description
limit
Total number of conversations to display in a single request. Default value: 100
. Maximum: 1000
.
from
Filter by sender.
to
Filter by recipient.
Show a conversation
GET
{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/<from>/<to>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : {
"from" : "34666777555" ,
"to" : "34666555444" ,
"totalMessages" : 10 ,
"status" : "OPEN" ,
"isSessionActive" : true ,
"sessionExpiresAt" : "2024-01-02T10:00:00+00:00" ,
"createdAt" : "2024-01-01T10:00:00+00:00" ,
"updatedAt" : "2024-01-01T10:00:00+00:00" ,
"links" : {
"messages" : "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
},
"contact" : {
"data" : {
"msisdn" : "34666555444" ,
"firstName" : "First" ,
"lastName" : "Last" ,
"email" : "email@example.com" ,
"interest" : "Interest example" ,
"comment" : "Comment example" ,
"country" : "ES"
}
}
}
}
Show the messages in a conversation
GET
{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/<from>/<to>/messages
curl -X GET '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : "f564433e-7cd1-47fa-af98-1bd632411b26" ,
"type" : "text" ,
"msisdn" : "34666555444" ,
"content" : "User response" ,
"reactions" : [],
"sentAt" : "2024-01-01T11:00:00+00:00" ,
"deliveredAt" : "2024-01-01T11:00:00+00:00" ,
"readAt" : "2024-01-01T11:01:00+00:00" ,
"failedAt" : null
},
{
"id" : "a8249e62-55a8-4f17-bf6c-c7ad2d844374" ,
"type" : "template" ,
"msisdn" : "34666777555" ,
"content" : "Template content" ,
"reactions" : [ "👍" ],
"sentAt" : "2024-01-01T10:00:00+00:00" ,
"deliveredAt" : "2024-01-01T10:00:00+00:00" ,
"readAt" : "2024-01-01T10:01:00+00:00" ,
"failedAt" : null
}
],
"meta" : {
"status" : "OPEN" ,
"isSessionActive" : true ,
"sessionExpiresAt" : "2024-01-02T10:00:00+00:00" ,
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages&page=2"
}
}
}
}
Filters
Parameter
Description
limit
Total number of messages to display in a single request. Default value: 100
. Maximum: 1000
.
Send a message to a conversation
POST
{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/<from>/<to>/messages
curl -X POST '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"content": "Message content"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"content": "Message content"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"content\": \"Message content\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "content": "Message content" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages"
payload = "{ \" content \" : \" Message content \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" content \" : \" Message content \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/whatsapp/conversations/34666777555/34666555444/messages" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"content\": \"Message content\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
It is only possible to send messages to conversations with an active session.
You can reply to a conversation within 24 hours of the last message by checking the isSessionActive
and sessionExpiresAt
parameters of the conversation.
If you do not have an active session, it is only possible to send one template.
Parameters
Parameter
Type
Mandatory
Description
content
string
Yes
Content of the message. You can change the text format of your messages.
Scheduled messages
List
GET
{{DASHBOARD_HOST}}/api/rest/scheduled
curl -X GET '{{DASHBOARD_HOST}}/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/scheduled' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/scheduled ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/scheduled"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/scheduled" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
Multi GUID
{
"result" : [
{
"guid" : "100" ,
"type" : "SMS" ,
"sending_id" : 123 ,
"updated_at" : "2017-09-18 10:49:12" ,
"scheduled_at" : "2017-11-11 10:10:10"
},
{
"guid" : "101" ,
"type" : "SMS" ,
"sending_id" : 123 ,
"created_at" : "2017-09-18 10:49:12" ,
"updated_at" : "2017-09-18 10:49:12" ,
"scheduled_at" : "2017-11-11 10:10:10"
},
{
"guid" : "102" ,
"type" : "SMS" ,
"sending_id" : 123 ,
"created_at" : "2017-09-18 10:49:12" ,
"updated_at" : "2017-09-18 10:49:12" ,
"scheduled_at" : "2017-11-11 10:10:10"
}
],
"total" : 3
}
Single GUID
{
"result" : {
"guid" : "100" ,
"type" : "SMS" ,
"content" : {
"to" : "34666555444" ,
"from" : "SAMPLE" ,
"encoding" : "gsm" ,
"message" : "This is a test" ,
"campaignId" : 456 ,
"sendingId" : 123
},
"created_at" : "2017-09-18 10:49:12" ,
"updated_at" : "2017-09-18 10:49:12" ,
"scheduled_at" : "2017-11-11 10:10:10"
},
"total" : 1
}
Lists all scheduled mailings. Can be filtered by type (SMS or MAILING) and can
specify one GUID, multiple GUIDs or no GUIDs (to list all).
The content of the message is not shown in the list, unless a single GUID is specified.
Parameter
Type
Required
Description
guid
integer, array
No
Identifier of message or messages. One identifier, an array of identifiers or no identifiers can be used to show all.
type
string
No
SMS
o MAILING
sendingId
integer
No
Identifier of the sending.
Update
PUT
{{DASHBOARD_HOST}}/api/rest/scheduled
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"guid": [100,101],
"scheduleDate": "20171011093000"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/scheduled' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"guid": [100,101],
"scheduleDate": "20171011093000"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/scheduled ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "guid": [100,101], "scheduleDate": "20171011093000" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/scheduled"
payload = "{ \" guid \" : [100,101], \" scheduleDate \" : \" 20171011093000 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/scheduled" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" guid \" : [100,101], \" scheduleDate \" : \" 20171011093000 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"guid\": [100,101], \"scheduleDate\": \"20171011093000\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"result" : true ,
"updated" : 2
}
Updates the scheduled date of a mailing, multiple mailings or all scheduled mailings.
Can be filtered by GUID and/or type.
BEWARE : If no GUID is specified, all scheduled messages will be updated.
Parameter
Type
Required
Description
guid
integer, array
No
Identifier of message or messages. One identifier, an array of identifiers or no identifiers can be used to show all.
type
string
No
SMS
o MAILING
scheduleDate
string
Yes
Date of sending message in UTC format. If you need to send scheduled messages, the delivery date can be specified by indicating the date in the following format YYYYmmddHHiiss
(e.g. 20130215142000 would be 15 February 2013 at 14:20:00). For immediate mailings, this parameter does not have to be specified.
Delete
DELETE
{{DASHBOARD_HOST}}/api/rest/scheduled
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/scheduled' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"guid": [100, 101]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/scheduled' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_POSTFIELDS => '{
"guid": [100, 101]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"guid\": [100, 101] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/scheduled ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "guid": [100, 101] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/scheduled"
payload = "{ \" guid \" : [100, 101] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/scheduled" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" guid \" : [100, 101] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/scheduled" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"guid\": [100, 101] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"result" : true ,
"deleted" : 2
}
Deletes a mailing, multiple mailings or all scheduled mailings.
Can be filtered by GUID and/or type.
BEWARE : If no GUID is specified, all scheduled messages will be deleted.
Parameter
Type
Required
Description
guid
integer, array
No
Identifier of message or messages. One identifier, an array of identifiers or no identifiers can be used to show all.
type
string
No
SMS
o MAILING
Campaigns list
GET
{{DASHBOARD_HOST}}/api/rest/campaigns
curl -X GET '{{DASHBOARD_HOST}}/api/rest/campaigns' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/campaigns' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/campaigns" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/campaigns ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/campaigns"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/campaigns" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/campaigns" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"name" : "My campaign" ,
"type" : "basic" ,
"createdAt" : "2018-12-27T11:31:16+00:00" ,
"updatedAt" : "2018-12-27T11:31:16+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/campaigns/1" ,
"sendings" : "{{DASHBOARD_HOST}}/api/rest/campaigns/1/sendings"
},
"sendings" : {
"data" : [
{
"id" : 1 ,
"campaignName" : "My campaign" ,
"status" : "OPENED" ,
"channel" : "sms" ,
"total" : 2 ,
"processed" : 2 ,
"totalSmsParts" : 4 ,
"cost" : 0.02 ,
"currency" : "EUR" ,
"tags" : [],
"scheduledAt" : null ,
"expiresAt" : null ,
"startedAt" : null ,
"finishedAt" : null ,
"createdAt" : "2018-12-27T11:31:16+00:00" ,
"updatedAt" : "2018-12-27T11:31:22+00:00" ,
"events" : {
"delivered" : 2 ,
"opened" : 0 ,
"opened_unique" : 0 ,
"clicked" : 0 ,
"clicked_unique" : 0 ,
"unsubscribed" : 0 ,
"hard_bounced" : 0 ,
"complaint" : 0 ,
"sent" : 2 ,
"soft_bounced" : 0 ,
"undelivered" : 0 ,
"rejected" : 0 ,
"expired" : 0 ,
"unsubscribed_landing" : 0
},
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/sendings/1" ,
"eventsReport" : "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events"
}
}
]
}
}
]
}
Filters
Parameter
Description
name
Filter by campaign name. It is possible to use the character "*" as "wildcard". Example: ?name=CAMPAIGN_2020_*
channel
Filter by channel. Available values: sms
, mailing
, landing
, text2speech
, voice-interactive
Example: ?channel=sms
beforeDate
Show results prior
to the indicated date. The date must be specified in ISO 8601
format. Example: ?beforeDate=2019-01-01T00%3A00%3A00%2B00%3A00
afterDate
Show results after
the indicated date. The date must be specified in ISO 8601
format. Example: ?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00
The parameters must be correctly encoded (urlencode) with respect to the RFC 3986 standard to be supported by the server.
Response fields
Parameter
Description
name
Campaign name.
type
Campaign type. Possible values: basic
, automatic
, trigger
, testab
.
sendings
List of all the sendings associated with your campaign. For basic
and automatic
campaigns, the sendings number will always be 1.
sendings.*.status
Your sending status. Possible values: PENDING
: Sending scheduled for a future date. SAVED
: Saved sending. It will not be sent until the campaign is confirmed from the platform. SENDING
: Sending in progress. PAUSED
: Sending paused. FINISHED
: Sending finished. CANCELLED
: Sending cancelled. EDITING
: The sending is being edited from the platform. OPENED
: API shipments will report this status. Indicates that the sending can accept more messages. AUTOMATED
: Automated sending, waiting for the automation conditions to be met. WAITING
: "Trigger" sending, waiting for the sending conditions to be met.
sendings.*.channel
Sending channel. Possible values: sms
, mailing
, landing
, text2speech
, voice-interactive
.
sendings.*.total
Total number of messages to be sent.
sendings.*.processed
Total number of messages sent.
sendings.*.totalSmsParts
Only applicable to SMS sendings. The total number of SMS parts sent for concatenated sendings will be indicated.
sendings.*.cost
Sending cost.
sendings.*.currency
Currency code for the cost.
sendings.*.tags
Tags assigned to the sending.
sendings.*.scheduledAt
Schedule date of the campaign. No message will be sent before this date.
sendings.*.expiresAt
Expiry date of the campaign. After this date, no more messages will be sent.
sendings.*.events
Summary of the total events occurred during the sending. Events: delivered
: The message has been delivered to the contact. opened
: The contact has opened the message. Not applicable to sms and voice. opened_unique
: Total of unique openings. Not applicable to sms and voice. clicked
: The contact has clicked on a link included in the message. Not applicable to sms and voice. clicked_unique
: Total of unique clicks. Not applicable to sms and voice. unsubscribed
: The contact has unsubscribed. hard_bounced
: Total hard bounces generated by the campaign. Only applicable to mailing. complaint
: The contact has marked the message as unwanted. sent
: The message has been sent to the contact. soft_bounced
: Total soft bounces generated by the campaign. Only applicable to mailing. undelivered
: The message could not have been delivered to the contact. rejected
: The attempt to send the message has been rejected. expired
: The message has been rejected as the expiration date of the campaign has passed. unsubscribed_landing
: The contact has unsubscribed using the landing page included in the message.
Databases
GET
{{DASHBOARD_HOST}}/api/rest/contacts
curl -X GET '{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields,groups" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"email" : "email@example.com" ,
"phone" : "34666666666" ,
"countryIso" : "ES" ,
"landline" : "900222222" ,
"name" : "Name" ,
"surname" : "Last name" ,
"createdAt" : "2018-03-13T14:32:25+00:00" ,
"updatedAt" : "2018-07-04T13:57:09+00:00" ,
"customFields" : {
"data" : [
{
"key" : "color" ,
"type" : "string" ,
"value" : "green"
}
]
},
"groups" : {
"data" : [
{
"id" : 1 ,
"name" : "My Contact List"
}
]
}
}
],
"meta" : {
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/contacts?include=customFields%2Cgroups&page=2"
}
}
}
}
Filters
Parameter
Description
limit
Total contacts to display in a single request. Default value: 100
. Maximum: 1000
.
include
Include associated subresources in the response. It is possible to specify multiple values separated by commas. Available values: customFields
, groups
.
email
Filter contacts for a specific email: email=myemail@example.com.
phone
Filter contacts for a specific phone: phone=34666666666.
landline
Filter contacts for a specific landline phone: landline=900222222.
countryIso
Filter contacts for a specific country: countryIso=ES.
externalId
Filter contacts for a specific externalId: externalId=EXT1.
GET
{{DASHBOARD_HOST}}/api/rest/contacts/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/contacts/1?include=customFields,groups" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : {
"id" : 1 ,
"email" : "email@example.com" ,
"phone" : "34666666666" ,
"countryIso" : "ES" ,
"landline" : "900222222" ,
"name" : "Name" ,
"surname" : "Last name" ,
"createdAt" : "2018-03-13T14:32:25+00:00" ,
"updatedAt" : "2018-07-04T13:57:09+00:00" ,
"customFields" : {
"data" : [
{
"key" : "color" ,
"type" : "string" ,
"value" : "green"
}
]
},
"groups" : {
"data" : [
{
"id" : 1 ,
"name" : "My Contact List"
}
]
}
}
}
Filters
Parameter
Description
include
Include associated subresources in the response. It is possible to specify multiple values separated by commas. Available values: customFields
, groups
.
POST
{{DASHBOARD_HOST}}/api/rest/contacts
curl -X POST '{{DASHBOARD_HOST}}/api/rest/contacts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"email": "new.contact@example.com",
"phone": "3466666666",
"countryIso": "ES",
"groupsNames": ["My contact list"],
"customFields": [
{
"key": "company",
"value": "ACME inc."
}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/contacts' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"email": "new.contact@example.com",
"phone": "3466666666",
"countryIso": "ES",
"groupsNames": ["My contact list"],
"customFields": [
{
"key": "company",
"value": "ACME inc."
}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/contacts" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/contacts ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/contacts"
payload = "{ \" email \" : \" new.contact@example.com \" , \" phone \" : \" 3466666666 \" , \" countryIso \" : \" ES \" , \" groupsNames \" : [ \" My contact list \" ], \" customFields \" : [ { \" key \" : \" company \" , \" value \" : \" ACME inc. \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/contacts" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" email \" : \" new.contact@example.com \" , \" phone \" : \" 3466666666 \" , \" countryIso \" : \" ES \" , \" groupsNames \" : [ \" My contact list \" ], \" customFields \" : [ { \" key \" : \" company \" , \" value \" : \" ACME inc. \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/contacts" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"email" : "new.contact@example.com" ,
"phone" : "3466666666" ,
"countryIso" : "ES" ,
"landline" : null ,
"name" : null ,
"surname" : null ,
"createdAt" : "2018-03-13T14:32:25+00:00" ,
"updatedAt" : "2018-03-13T14:32:25+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/contacts/1"
}
}
}
Error response
{
"error" : {
"code" : 422 ,
"description" : "The email field is required."
}
}
Parameters
Parameter
Type
Required
Description
email
string
Required when phone
or landline
is not specified
Email of the new contact.
phone
string
Required when email
or landline
is not specified
Mobile phone number of the contact.
landline
string
Required when email
or phone
is not specified
Landline phone number of the contact.
countryIso
string
Required when phone
or landline
is specified
Two-letter ISO code of the contact's country.
groupsIds
array
Required if groupsNames
is not specified
List of groups to which the new contact will be added. To obtain group IDs please check the documentation for the corresponding endpoint.
groupsNames
array
Required if groupsIds
is not specified
Alternatively, if the list of group IDs is not available, a list with the group names to which the contact is to be added can be specified.
name
string
No
Contact name.
surname
string
No
Contact surname(s).
customFields[]key
string
No
Name of the custom field to be added.
customFields[]type
string
No
Type of custom field. Possible values: string
, date
, decimal
. For date fields the value must be in ISO8601 format. Default value: string
.
customFields[]value
string
No
Custom field value.
PUT
{{DASHBOARD_HOST}}/api/rest/contacts/<ID>
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/contacts/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"email": "new.contact@example.com",
"phone": "3466666666",
"countryIso": "ES",
"groupsNames": ["My contact list"],
"customFields": [
{
"key": "company",
"value": "ACME inc."
}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/contacts/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"email": "new.contact@example.com",
"phone": "3466666666",
"countryIso": "ES",
"groupsNames": ["My contact list"],
"customFields": [
{
"key": "company",
"value": "ACME inc."
}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/contacts/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "email": "new.contact@example.com", "phone": "3466666666", "countryIso": "ES", "groupsNames": ["My contact list"], "customFields": [ { "key": "company", "value": "ACME inc." } ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/contacts/1"
payload = "{ \" email \" : \" new.contact@example.com \" , \" phone \" : \" 3466666666 \" , \" countryIso \" : \" ES \" , \" groupsNames \" : [ \" My contact list \" ], \" customFields \" : [ { \" key \" : \" company \" , \" value \" : \" ACME inc. \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" email \" : \" new.contact@example.com \" , \" phone \" : \" 3466666666 \" , \" countryIso \" : \" ES \" , \" groupsNames \" : [ \" My contact list \" ], \" customFields \" : [ { \" key \" : \" company \" , \" value \" : \" ACME inc. \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"email\": \"new.contact@example.com\", \"phone\": \"3466666666\", \"countryIso\": \"ES\", \"groupsNames\": [\"My contact list\"], \"customFields\": [ { \"key\": \"company\", \"value\": \"ACME inc.\" } ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"id" : 1 ,
"email" : "new.contact@example.com" ,
"phone" : "3466666666" ,
"countryIso" : "ES" ,
"landline" : null ,
"name" : null ,
"surname" : null ,
"createdAt" : "2018-03-13T14:32:25+00:00" ,
"updatedAt" : "2018-03-13T14:32:25+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/contacts/1"
}
}
}
Error response
{
"error" : {
"code" : 422 ,
"description" : "The email field is required."
}
}
Parameters
Parameter
Type
Required
Description
email
string
Required when phone
or landline
is not specified
Email of the new contact.
phone
string
Required when email
or landline
is not specified
Mobile phone number of the contact.
landline
string
Required when email
or phone
is not specified
Landline phone number of the contact.
countryIso
string
Required when phone
or landline
is specified
Two-letter ISO code of the contact's country.
groupsIds
array
Required if groupsNames
is not specified
List of groups to which the new contact will be added. To obtain group IDs please check the documentation for the corresponding endpoint.
groupsNames
array
Required if groupsIds
is not specified
Alternatively, if the list of group IDs is not available, a list with the group names to which the contact is to be added can be specified.
name
string
No
Contact name.
surname
string
No
Contact surname(s).
customFields[]key
string
No
Name of the custom field to be added.
customFields[]type
string
No
Type of custom field. Possible values: string
, date
, decimal
. For date fields the value must be in ISO8601 format. Default value: string
.
customFields[]value
string
No
Custom field value.
DELETE
{{DASHBOARD_HOST}}/api/rest/contacts/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/contacts/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/contacts/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/contacts/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/contacts/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/contacts/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
If the request has been successful, it will respond with an HTTP 204 code.
Groups
Groups list
GET
{{DASHBOARD_HOST}}/api/rest/groups
curl -X GET '{{DASHBOARD_HOST}}/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/groups' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/groups" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/groups ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/groups"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/groups" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/groups" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"name" : "My contact list"
}
],
"meta" : {
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/groups?page=2"
}
}
}
}
Filters
Parameter
Description
limit
Total contacts to display in a single request. Default value: 100
. Maximum: 1000
.
Show a group
GET
{{DASHBOARD_HOST}}/api/rest/groups/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/groups/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/groups/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/groups/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/groups/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/groups/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/groups/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/groups/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : {
"id" : 1 ,
"name" : "My contact list"
}
}
Create a new group
POST
{{DASHBOARD_HOST}}/api/rest/groups
curl -X POST '{{DASHBOARD_HOST}}/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "My new contact list"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/groups' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"name": "My new contact list"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/groups" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"My new contact list\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/groups ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "My new contact list" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/groups"
payload = "{ \" name \" : \" My new contact list \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/groups" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" My new contact list \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/groups" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"My new contact list\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"name" : "My new contact list"
}
}
Error response
{
"error" : {
"code" : 422 ,
"description" : "The name field is required."
}
}
Parameters
Parameter
Type
Required
Description
name
string
Yes
Name of the New Group.
Update a group
PUT
{{DASHBOARD_HOST}}/api/rest/groups/<ID>
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/groups' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "My new contact list"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/groups' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"name": "My new contact list"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/groups" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"My new contact list\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/groups ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "My new contact list" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/groups"
payload = "{ \" name \" : \" My new contact list \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/groups" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" My new contact list \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/groups" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"My new contact list\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"id" : 1 ,
"name" : "My new contact list"
}
}
Error response
{
"error" : {
"code" : 422 ,
"description" : "The name field is required."
}
}
Parameters
Parameter
Type
Required
Description
name
string
Yes
Name of the New Group.
Delete a group
DELETE
{{DASHBOARD_HOST}}/api/rest/groups/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/groups/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/groups/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/groups/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/groups/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/groups/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/groups/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/groups/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
If the request has been successful, it will respond with an HTTP 204 code.
Validation list
GET
{{DASHBOARD_HOST}}/api/rest/validation/emails
curl -X GET '{{DASHBOARD_HOST}}/api/rest/validation/emails' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/validation/emails' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/validation/emails ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/validation/emails"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : [
{
"id" : 1 ,
"status" : "finished" ,
"total" : 10 ,
"processed" : 10 ,
"valid" : 9 ,
"estimatedCost" : 0.03 ,
"cost" : 0.03 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T08:30:54+00:00" ,
"updatedAt" : "2018-09-20T08:31:00+00:00" ,
"finishedAt" : "2018-09-20T08:31:00+00:00" ,
"resultUrl" : "{{DASHBOARD_HOST}}/api/rest/validation/emails/1/result"
}
],
"meta" : {
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/validation/emails?page=2"
}
}
}
}
Show a validation
GET
{{DASHBOARD_HOST}}/api/rest/validation/emails/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/validation/emails/123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/validation/emails/123' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/validation/emails/123 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/validation/emails/123"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"id" : 1 ,
"status" : "finished" ,
"total" : 2 ,
"processed" : 2 ,
"valid" : 1 ,
"estimatedCost" : 0.007 ,
"cost" : 0.007 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T08:30:54+00:00" ,
"updatedAt" : "2018-09-20T08:31:00+00:00" ,
"finishedAt" : "2018-09-20T08:31:00+00:00" ,
"resultUrl" : "{{DASHBOARD_HOST}}/api/rest/validation/emails/1/result"
}
}
Validation results (CSV)
GET
{{DASHBOARD_HOST}}/api/rest/validation/emails/<ID>/result
curl -X GET '{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/validation/emails/123/result ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123/result" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
email;result
valid@example.com;deliverable
notvalid@example.com;undeliverable
unknown@example.com;risky
Validate emails
POST
{{DASHBOARD_HOST}}/api/rest/validation/emails
curl -X POST '{{DASHBOARD_HOST}}/api/rest/validation/emails' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"groupsIds": [1111],
"force": false,
"notificationUrl": "https://example.com/notificationUrl"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/validation/emails' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"groupsIds": [1111],
"force": false,
"notificationUrl": "https://example.com/notificationUrl"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/validation/emails ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "groupsIds": [1111], "force": false, "notificationUrl": "https://example.com/notificationUrl" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/validation/emails"
payload = "{ \" groupsIds \" : [1111], \" force \" : false, \" notificationUrl \" : \" https://example.com/notificationUrl \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" groupsIds \" : [1111], \" force \" : false, \" notificationUrl \" : \" https://example.com/notificationUrl \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/validation/emails" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"groupsIds\": [1111], \"force\": false, \"notificationUrl\": \"https://example.com/notificationUrl\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : {
"id" : 2 ,
"status" : "pending" ,
"total" : 1 ,
"processed" : 0 ,
"valid" : 0 ,
"estimatedCost" : 0.0035 ,
"cost" : 0 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T10:03:22+00:00" ,
"updatedAt" : "2018-09-20T10:03:22+00:00" ,
"finishedAt" : null ,
"resultUrl" : null
}
}
The validation is done in the following way, a request is made indicating the group IDs or emails to validate. It is possible to validate one or more groups. It is possible to validate one or more emails.
If the request is correct, the request will return the status "pending", which means that it is queued to be processed.
Once the validation process starts, it will notify with an "started" status and when it finishes it will notify with "finished" with the data with the total of processed and the total of valid among other data. Also in the "finished" notification the url will be received in order to obtain the complete detail.
Parameters
Parameter
Type
Mandatory
Description
groupsIds
array
No (whenever there are emails)
List of groups to be validated (consult groups endpoint) within the contacts API.
emails
array
No (whenever there are groupIds)
List of emails to validate.
force
boolean
No
In case of being true
, emails that have already been verified will be verified. Default value false
.
allowRisky
boolean
No
Default value false
. If the value is false
, risky emails will be added to the blacklist, preventing them from being sent. If the value is true
, emails will be allowed to be sent.
notificationUrl
string
No
Callback URL in which progress notifications will be received (see notification annex).
Delete a validation
DELETE
{{DASHBOARD_HOST}}/api/rest/validation/emails/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/validation/emails/123' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/validation/emails/123' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/validation/emails/123 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/validation/emails/123"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/validation/emails/123" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
It is possible to eliminate a validation from your list of validations.
If the request has been successful, it will respond with an HTTP 204 code.
Notification examples
Notification STARTED
{
"data" : {
"id" : 2 ,
"status" : "started" ,
"total" : 1 ,
"processed" : 0 ,
"valid" : 0 ,
"estimatedCost" : 0.0035 ,
"cost" : 0.0035 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T10:03:22+00:00" ,
"updatedAt" : "2018-09-20T10:03:22+00:00" ,
"finishedAt" : null ,
"resultUrl" : null ,
"error" : ""
}
}
Notification FINISHED
{
"data" : {
"id" : 2 ,
"status" : "finished" ,
"total" : 1 ,
"processed" : 1 ,
"valid" : 1 ,
"estimatedCost" : 0.0035 ,
"cost" : 0.0035 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T07:23:19+00:00" ,
"updatedAt" : "2018-09-20T07:23:56+00:00" ,
"finishedAt" : "2018-09-20T07:23:56+00:00" ,
"resultUrl" : "{{DASHBOARD_HOST}}/api/rest/validation/emails/2/result" ,
"error" : ""
}
}
Notification FAILED
{
"data" : {
"id" : 2 ,
"status" : "failed" ,
"total" : 1 ,
"processed" : 0 ,
"valid" : 0 ,
"estimatedCost" : 0.0035 ,
"cost" : 0 ,
"currency" : "EUR" ,
"createdAt" : "2018-09-20T10:03:22+00:00" ,
"updatedAt" : "2018-09-20T10:03:22+00:00" ,
"finishedAt" : null ,
"resultUrl" : null ,
"error" : "Failed to process email validation"
}
}
Blacklist
GET
{{DASHBOARD_HOST}}/api/rest/v2/blacklist/{type}
curl -X GET '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"type" : "sms" ,
"recipient" : "99000000000" ,
"isDefinitive" : false ,
"sendingId" : 123 ,
"campaignName" : "TEST_CAMPAIGN" ,
"createdAt" : "2020-01-01T00:00:00+00:00"
}
],
"meta" : {
"pagination" : {
"total" : 500 ,
"count" : 100 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 5 ,
"links" : {
"next" : "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms?page=2"
}
}
}
}
URL Parameters
Parameter
Description
type
Blacklist type: sms
, mailing
, voice
.
Filters
Parameter
Description
limit
Total of contacts to be shown in a single request. Default value: 100
. Maximum: 1000
.
recipient
Filter by recipient. Example: ?recipient=test%40example.com
sendingId
Filter by sendingId. Example: ?sendingId=123
PUT
{{DASHBOARD_HOST}}/api/rest/v2/blacklist/{type}
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "99000000000"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"recipient": "99000000000"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"recipient\": \"99000000000\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "recipient": "99000000000" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms"
payload = "{ \" recipient \" : \" 99000000000 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" recipient \" : \" 99000000000 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"recipient\": \"99000000000\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"type" : "sms" ,
"recipient" : "99000000000" ,
"isDefinitive" : false ,
"campaignName" : null ,
"createdAt" : "2020-01-01T00:00:00+00:00"
}
}
URL Parameters
Parameter
Description
type
Blacklist type: sms
, mailing
, voice
.
Parameters
Parameter
Type
Mandatory
Description
recipient
string
Yes
Recipient to add to the blacklist.
DELETE
{{DASHBOARD_HOST}}/api/rest/v2/blacklist/{type}
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "99000000000"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_POSTFIELDS => '{
"recipient": "99000000000"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"recipient\": \"99000000000\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "recipient": "99000000000" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms"
payload = "{ \" recipient \" : \" 99000000000 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" recipient \" : \" 99000000000 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/blacklist/sms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"recipient\": \"99000000000\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
URL Parameters
Parameter
Description
type
Blacklist type: sms
, mailing
, voice
.
Parameters
Parameter
Type
Mandatory
Description
recipient
string
Yes
Recipient to remove from the blacklist.
If the request has been correct it will be answered with a HTTP 204 code.
Templates and files
Templates
This API refers to templates created from the previous version ({{DASHBOARD_HOST}} ) of the {{NAME}} application.
List templates
GET
{{DASHBOARD_HOST}}/api/rest/templates
curl -X GET '{{DASHBOARD_HOST}}/api/rest/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"name" : "Template 1" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2018-08-17T12:31:10+00:00" ,
"updatedAt" : null
}
],
"meta" : {
"pagination" : {
"total" : 1 ,
"count" : 1 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 1 ,
"links" : []
}
}
}
Show a template
GET
{{DASHBOARD_HOST}}/api/rest/templates/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"id" : 1 ,
"name" : "Template 1" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2018-08-17T12:31:10+00:00" ,
"updatedAt" : null
}
}
Create a new template
POST
{{DASHBOARD_HOST}}/api/rest/templates
curl -X POST '{{DASHBOARD_HOST}}/api/rest/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "New Template", "html": "<h1>Hello world</h1>" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates"
payload = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"name" : "New Template" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2020-01-00T00:00:00+00:00" ,
"updatedAt" : "2020-01-00T00:00:00+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/templates/1" ,
"preview" : "{{DASHBOARD_HOST}}/api/rest/templates/1/preview"
}
}
}
Parameter
Type
Required
Description
name
string
Yes
Template Name.
html
string
Yes
Content of the template in HTML format and UTF-8
coding.
Update a template
PUT
{{DASHBOARD_HOST}}/api/rest/templates/<ID>
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "New Template", "html": "<h1>Hello world</h1>" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates/1"
payload = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"name" : "New Template" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2020-01-00T00:00:00+00:00" ,
"updatedAt" : "2020-01-00T00:00:00+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/templates/1" ,
"preview" : "{{DASHBOARD_HOST}}/api/rest/templates/1/preview"
}
}
}
Parameter
Type
Required
Description
name
string
Yes
Template Name.
html
string
Yes
Content of the template in HTML format and UTF-8
coding.
Delete a template
DELETE
{{DASHBOARD_HOST}}/api/rest/templates/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
If the request has been successful, it will respond with an HTTP 204 code.
Preview a template
GET
{{DASHBOARD_HOST}}/api/rest/templates/<ID>/preview
curl -X GET '{{DASHBOARD_HOST}}/api/rest/templates/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/templates/1/preview' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/templates/1/preview" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/templates/1/preview ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/templates/1/preview"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/templates/1/preview" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/templates/1/preview" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
The response will contain a preview of the template in HTML format.
Custom variables
Custom variables can be used on templates. These variables will be replaced by the contact's custom fields before sending by using the syntax {variable}.
For example, to include the custom variable "name" in a HTML template:
<html>
<head>
<title> TEST</title>
</head>
<body>
<h1> Hello {name}</h1>
</body>
</html>
Custom links
The templates accept the following substitution patterns for HTML links.
Pattern
Description
[unsubscribe_link]
Link to the unsubscribe page.
[form_{ID}]
Link to the form with id {ID}
[show_link]
Link to preview the template from the web browser. Useful for mail sendings.
[attachment_{ID}]
Link to the attachment with id {ID}
For example to include a link to the form with id "12":
<a href= "[form_12]" > Form link</a>
Templates V2
This API refers to templates created from the current version ({{HOST}} ) of the {{NAME}} application.
List templates
GET
{{DASHBOARD_HOST}}/api/rest/v2/templates
curl -X GET '{{DASHBOARD_HOST}}/api/rest/v2/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"name" : "Template 1" ,
"type" : "HTML" ,
"createdAt" : "2018-08-17T12:31:10+00:00" ,
"updatedAt" : null
}
],
"meta" : {
"pagination" : {
"total" : 1 ,
"count" : 1 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 1 ,
"links" : []
}
}
}
Show a template
GET
{{DASHBOARD_HOST}}/api/rest/v2/templates/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 200)
{
"data" : {
"id" : 1 ,
"name" : "Template 1" ,
"type" : "HTML" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2018-08-17T12:31:10+00:00" ,
"updatedAt" : null
}
}
Create a new template
POST
{{DASHBOARD_HOST}}/api/rest/v2/templates
curl -X POST '{{DASHBOARD_HOST}}/api/rest/v2/templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "New Template", "html": "<h1>Hello world</h1>" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates"
payload = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"name" : "New Template" ,
"type" : "HTML" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2020-01-00T00:00:00+00:00" ,
"updatedAt" : "2020-01-00T00:00:00+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" ,
"preview" : "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview"
}
}
}
Parameter
Type
Required
Description
name
string
Yes
Template Name.
html
string
Yes
Content of the template in HTML format and UTF-8
coding.
Update a template
PUT
{{DASHBOARD_HOST}}/api/rest/v2/templates/<ID>
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"name": "New Template",
"html": "<h1>Hello world</h1>"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "New Template", "html": "<h1>Hello world</h1>" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates/1"
payload = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" New Template \" , \" html \" : \" <h1>Hello world</h1> \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"New Template\", \"html\": \"<h1>Hello world</h1>\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response (HTTP 201)
{
"data" : {
"id" : 1 ,
"name" : "New Template" ,
"type" : "HTML" ,
"html" : "<h1>Hello world</h1>" ,
"createdAt" : "2020-01-00T00:00:00+00:00" ,
"updatedAt" : "2020-01-00T00:00:00+00:00" ,
"links" : {
"self" : "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" ,
"preview" : "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview"
}
}
}
Parameter
Type
Required
Description
name
string
Yes
Template Name.
html
string
Yes
Content of the template in HTML format and UTF-8
coding.
Delete a template
DELETE
{{DASHBOARD_HOST}}/api/rest/v2/templates/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
If the request has been successful, it will respond with an HTTP 204 code.
Preview a template
GET
{{DASHBOARD_HOST}}/api/rest/v2/templates/<ID>/preview
curl -X GET '{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/v2/templates/1/preview" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
The response will contain a preview of the template in HTML format.
Custom variables
Custom variables can be used on templates. These variables will be replaced by the contact's custom fields before sending by using the syntax {variable}.
For example, to include the custom variable "name" in a HTML template:
<html>
<head>
<title> TEST</title>
</head>
<body>
<h1> Hello {name}</h1>
</body>
</html>
Custom links
The templates accept the following substitution patterns for HTML links.
Pattern
Description
[unsubscribe_link]
Link to the unsubscribe page.
[form_{ID}]
Link to the form with id {ID}
[show_link]
Link to preview the template from the web browser. Useful for mail sendings.
[attachment_{ID}]
Link to the attachment with id {ID}
For example to include a link to the form with id "12":
<a href= "[form_12]" > Form link</a>
POST
{{DASHBOARD_HOST}}/api/rest/form
curl -X POST '{{DASHBOARD_HOST}}/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "My_form",
"rejectButton": true,
"backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg",
"logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png",
"formFields": [
{"type": "h3", "label": "Your opinion is very important to us"},
{"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"name": "My_form",
"rejectButton": true,
"backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg",
"logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png",
"formFields": [
{"type": "h3", "label": "Your opinion is very important to us"},
{"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg\", \"logoUrl\": \"{{DASHBOARD_HOST}}/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "My_form", "rejectButton": true, "backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg", "logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png", "formFields": [ {"type": "h3", "label": "Your opinion is very important to us"}, {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"} ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms"
payload = "{ \" name \" : \" My_form \" , \" rejectButton \" : true, \" backgroundUrl \" : \" {{DASHBOARD_HOST}}/assets/login/img/wizard.jpg \" , \" logoUrl \" : \" {{DASHBOARD_HOST}}/assets/img/logo.png \" , \" formFields \" : [ { \" type \" : \" h3 \" , \" label \" : \" Your opinion is very important to us \" }, { \" type \" : \" text \" , \" label \" : \" Name \" , \" required \" : true, \" description \" : \" Insert your name \" , \" placeholder \" : \" Insert your name \" , \" customField \" : \" form_name \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" My_form \" , \" rejectButton \" : true, \" backgroundUrl \" : \" {{DASHBOARD_HOST}}/assets/login/img/wizard.jpg \" , \" logoUrl \" : \" {{DASHBOARD_HOST}}/assets/img/logo.png \" , \" formFields \" : [ { \" type \" : \" h3 \" , \" label \" : \" Your opinion is very important to us \" }, { \" type \" : \" text \" , \" label \" : \" Name \" , \" required \" : true, \" description \" : \" Insert your name \" , \" placeholder \" : \" Insert your name \" , \" customField \" : \" form_name \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg\", \"logoUrl\": \"{{DASHBOARD_HOST}}/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Example Request
{
"name" : "My_form" ,
"rejectButton" : true ,
"backgroundUrl" : "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg" ,
"logoUrl" : "{{DASHBOARD_HOST}}/assets/img/logo.png" ,
"formFields" : [
{
"type" : "h3" ,
"label" : "Your opinion is very important to us"
},
{
"type" : "text" ,
"label" : "Name" ,
"required" : true ,
"description" : "Insert your name" ,
"placeholder" : "Insert your name" ,
"customField" : "form_name"
},
{
"type" : "email" ,
"label" : "Email" ,
"required" : true ,
"description" : "Insert your email" ,
"placeholder" : "Insert your email" ,
"customField" : "form_email"
},
{
"type" : "radio" ,
"label" : "How satisfied are you with our platform?" ,
"required" : true ,
"description" : "Select your response depending on your satisfaction" ,
"customField" : "form_satisfaction" ,
"options" : [
{
"label" : "Very satisfied" ,
"value" : "10"
},
{
"label" : "Somewhat satisfied" ,
"value" : "8"
},
{
"label" : "Neither satisfied nor dissatisfied" ,
"value" : "6"
},
{
"label" : "Somewhat dissatisfied" ,
"value" : "4"
},
{
"label" : "Very dissatisfied" ,
"value" : "2"
}
]
}
]
}
Parameters
Parameter
Type
Required
Description
name
string
Yes
Unique name of the form.
editable
boolean
No
'true': once sent, the client can send it again. 'false': once sent, the client will not be able to send it again. true
by default.
rejectButton
boolean
No
'true': in addition to Submit button, Reject button will appear. Reject button does not send the data. 'false': only Submit button will appear. false
by default.
backgroundUrl
string
No
Form background image url.
logoUrl
string
No
Form logo image url.
formFields
array
Yes
Set of elements that the form will have. See annex to see all the elements.
Form example:
PUT
{{DASHBOARD_HOST}}/api/rest/forms/<ID>
curl -X PUT '{{DASHBOARD_HOST}}/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"name": "My_form",
"rejectButton": true,
"backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg",
"logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png",
"formFields": [
{"type": "h3", "label": "Your opinion is very important to us"},
{"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'PUT' ,
CURLOPT_POSTFIELDS => '{
"name": "My_form",
"rejectButton": true,
"backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg",
"logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png",
"formFields": [
{"type": "h3", "label": "Your opinion is very important to us"},
{"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "PUT" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg\", \"logoUrl\": \"{{DASHBOARD_HOST}}/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' put ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "name": "My_form", "rejectButton": true, "backgroundUrl": "{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg", "logoUrl": "{{DASHBOARD_HOST}}/assets/img/logo.png", "formFields": [ {"type": "h3", "label": "Your opinion is very important to us"}, {"type": "text", "label": "Name", "required": true, "description": "Insert your name", "placeholder": "Insert your name", "customField": "form_name"} ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms"
payload = "{ \" name \" : \" My_form \" , \" rejectButton \" : true, \" backgroundUrl \" : \" {{DASHBOARD_HOST}}/assets/login/img/wizard.jpg \" , \" logoUrl \" : \" {{DASHBOARD_HOST}}/assets/img/logo.png \" , \" formFields \" : [ { \" type \" : \" h3 \" , \" label \" : \" Your opinion is very important to us \" }, { \" type \" : \" text \" , \" label \" : \" Name \" , \" required \" : true, \" description \" : \" Insert your name \" , \" placeholder \" : \" Insert your name \" , \" customField \" : \" form_name \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "PUT" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Put . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" name \" : \" My_form \" , \" rejectButton \" : true, \" backgroundUrl \" : \" {{DASHBOARD_HOST}}/assets/login/img/wizard.jpg \" , \" logoUrl \" : \" {{DASHBOARD_HOST}}/assets/img/logo.png \" , \" formFields \" : [ { \" type \" : \" h3 \" , \" label \" : \" Your opinion is very important to us \" }, { \" type \" : \" text \" , \" label \" : \" Name \" , \" required \" : true, \" description \" : \" Insert your name \" , \" placeholder \" : \" Insert your name \" , \" customField \" : \" form_name \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"name\": \"My_form\", \"rejectButton\": true, \"backgroundUrl\": \"{{DASHBOARD_HOST}}/assets/login/img/wizard.jpg\", \"logoUrl\": \"{{DASHBOARD_HOST}}/assets/img/logo.png\", \"formFields\": [ {\"type\": \"h3\", \"label\": \"Your opinion is very important to us\"}, {\"type\": \"text\", \"label\": \"Name\", \"required\": true, \"description\": \"Insert your name\", \"placeholder\": \"Insert your name\", \"customField\": \"form_name\"} ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Parameters
Parameter
Type
Required
Description
name
string
Yes
Unique name of the form.
editable
boolean
No
'true': once sent, the client can send it again. 'false': once sent, the client will not be able to send it again. true
by default.
rejectButton
boolean
No
'true': in addition to Submit button, Reject button will appear. Reject button does not send the data. 'false': only Submit button will appear. false
by default.
backgroundUrl
string
No
Form background image url.
logoUrl
string
No
Form logo image url.
formFields
array
Yes
Set of elements that the form will have. See annex to see all the elements.
GET
{{DASHBOARD_HOST}}/api/rest/forms
curl -X GET '{{DASHBOARD_HOST}}/api/rest/forms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"id" : 1 ,
"name" : "Form 1" ,
"placeholder" : "{FORM_1}" ,
"createdAt" : "2018-08-21T11:51:33+00:00" ,
"updatedAt" : null
}
],
"meta" : {
"pagination" : {
"total" : 1 ,
"count" : 1 ,
"per_page" : 100 ,
"current_page" : 1 ,
"total_pages" : 1 ,
"links" : []
}
}
}
GET
{{DASHBOARD_HOST}}/api/rest/forms/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/forms/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : {
"id" : 1 ,
"name" : "Form 1" ,
"placeholder" : "{FORM_1}" ,
"createdAt" : "2018-08-21T11:51:33+00:00" ,
"updatedAt" : null
}
}
DELETE
{{DASHBOARD_HOST}}/api/rest/forms/<ID>
curl -X DELETE '{{DASHBOARD_HOST}}/api/rest/forms/1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms/1' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'DELETE' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms/1" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "DELETE" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' delete ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms/1 ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms/1"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "DELETE" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms/1" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Delete . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms/1" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
If the request has been successful, it will respond with an HTTP 204 code.
GET
{{DASHBOARD_HOST}}/api/rest/forms/<ID>/preview
curl -X GET '{{DASHBOARD_HOST}}/api/rest/forms/1/preview' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/forms/1/preview' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/forms/1/preview" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/forms/1/preview ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/forms/1/preview"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/forms/1/preview" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/forms/1/preview" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
The response will contain a preview of the form in HTML format.
If the request has been successful, it will respond with an HTTP 200 code.
H1
H1
{
"type" : "h1" ,
"label" : "My title"
}
H2
H2
{
"type" : "h2" ,
"label" : "My title"
}
H3
H3
{
"type" : "h3" ,
"label" : "My title"
}
H4
H4
{
"type" : "h4" ,
"label" : "My title"
}
Paragraph
Paragraph
{
"type" : "p" ,
"label" : "This is my paragraph"
}
Blockquote
Blockquote
{
"type" : "blockquote" ,
"label" : "My blockquote"
}
Input text
Input text
{
"type" : "text" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_string_custom_field"
}
Input password
{
"type" : "password" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_string_custom_field"
}
Input email
{
"type" : "email" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_string_custom_field"
}
Input number
{
"type" : "number" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_decimal_custom_field"
}
Textarea
Textarea
{
"type" : "textarea" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_string_custom_field" ,
"rows" : 3
}
Date picker
Date picker
{
"type" : "date" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_date_custom_field"
}
Color picker
Color picker
{
"type" : "color" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"placeholder" : "My placeholder" ,
"customField" : "my_string_custom_field"
}
Country select
Country select
{
"type" : "countrySelector" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"customField" : "my_string_custom_field"
}
Select
Select
{
"type" : "select" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"customField" : "my_string_custom_field" ,
"options" : [
{ "label" : "Label 1" , "value" : "value1" },
{ "label" : "Label 2" , "value" : "value2" },
{ "label" : "Label 3" , "value" : "value3" }
]
}
Input radio
{
"type" : "radio" ,
"label" : "My field" ,
"required" : true ,
"description" : "Help text" ,
"customField" : "my_string_custom_field" ,
"options" : [
{ "label" : "Label 1" , "value" : "value1" },
{ "label" : "Label 2" , "value" : "value2" },
{ "label" : "Label 3" , "value" : "value3" }
]
}
Input checkbox
{
"type" : "checkbox" ,
"label" : "My checkbox text" ,
"required" : true ,
"customField" : "my_decimal_custom_field" ,
}
URL Shortener
Generation short URLs
POST
{{DASHBOARD_HOST}}/api/rest/shortener/shorten
Request
curl -X POST '{{DASHBOARD_HOST}}/api/rest/shortener/shorten' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"urls": [
{"longUrl": "https://example.com/test1"},
{"longUrl": "https://example.com/test2"},
{"longUrl": "invalidUrl"}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/shortener/shorten' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"urls": [
{"longUrl": "https://example.com/test1"},
{"longUrl": "https://example.com/test2"},
{"longUrl": "invalidUrl"}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/shortener/shorten" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/shortener/shorten ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "urls": [ {"longUrl": "https://example.com/test1"}, {"longUrl": "https://example.com/test2"}, {"longUrl": "invalidUrl"} ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/shortener/shorten"
payload = "{ \" urls \" : [ { \" longUrl \" : \" https://example.com/test1 \" }, { \" longUrl \" : \" https://example.com/test2 \" }, { \" longUrl \" : \" invalidUrl \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/shortener/shorten" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" urls \" : [ { \" longUrl \" : \" https://example.com/test1 \" }, { \" longUrl \" : \" https://example.com/test2 \" }, { \" longUrl \" : \" invalidUrl \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/shortener/shorten" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"urls\": [ {\"longUrl\": \"https://example.com/test1\"}, {\"longUrl\": \"https://example.com/test2\"}, {\"longUrl\": \"invalidUrl\"} ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"longUrl" : "https://example.com/test1" ,
"shortUrl" : "https://sms.tl/dvRINN" ,
"error" : false
},
{
"longUrl" : "https://example.com/test2" ,
"shortUrl" : "https://sms.tl/GFA6Fm" ,
"error" : false
},
{
"longUrl" : "invalidUrl" ,
"shortUrl" : null ,
"error" : true
}
]
}
Image generator
Generation of images
POST
{{DASHBOARD_HOST}}/api/rest/images/generate
Request
curl -X POST '{{DASHBOARD_HOST}}/api/rest/images/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"images": [
{
"externalId": "test1",
"extension": "jpg",
"base64": "BASE64_ENCODED_STRING"
},
{
"externalId": "test2",
"extension": "png",
"base64": "BASE64_ENCODED_STRING"
}
]
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/images/generate' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"images": [
{
"externalId": "test1",
"extension": "jpg",
"base64": "BASE64_ENCODED_STRING"
},
{
"externalId": "test2",
"extension": "png",
"base64": "BASE64_ENCODED_STRING"
}
]
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/images/generate" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/images/generate ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "images": [ { "externalId": "test1", "extension": "jpg", "base64": "BASE64_ENCODED_STRING" }, { "externalId": "test2", "extension": "png", "base64": "BASE64_ENCODED_STRING" } ] } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/images/generate"
payload = "{ \" images \" : [ { \" externalId \" : \" test1 \" , \" extension \" : \" jpg \" , \" base64 \" : \" BASE64_ENCODED_STRING \" }, { \" externalId \" : \" test2 \" , \" extension \" : \" png \" , \" base64 \" : \" BASE64_ENCODED_STRING \" } ] }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/images/generate" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" images \" : [ { \" externalId \" : \" test1 \" , \" extension \" : \" jpg \" , \" base64 \" : \" BASE64_ENCODED_STRING \" }, { \" externalId \" : \" test2 \" , \" extension \" : \" png \" , \" base64 \" : \" BASE64_ENCODED_STRING \" } ] }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/images/generate" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"images\": [ { \"externalId\": \"test1\", \"extension\": \"jpg\", \"base64\": \"BASE64_ENCODED_STRING\" }, { \"externalId\": \"test2\", \"extension\": \"png\", \"base64\": \"BASE64_ENCODED_STRING\" } ] }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"externalId" : "test1" ,
"imageUrl" : "{{DASHBOARD_HOST}}/uploads/UCuh4pdOsW58ZEXX/1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014.jpg" ,
"error" : false
},
{
"externalId" : "test2" ,
"imageUrl" : "{{DASHBOARD_HOST}}/uploads/UCuh4pdOsW58ZEXX/60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752.jpg" ,
"error" : false
}
]
}
Parameters
Parameter
Type
Mandatory
Description
externalId
string
Yes
External ID to identify the image in the response.
extension
string
Yes
Image extension. Allowed extensions: jpg, png.
base64
string
Yes
Base64 encoded image.
Download certificates
Certified SMS
GET
{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID> ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sms/certificates/<ID>" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Parameter
Type
Mandatory
Description
id
string
Yes
Identifier of the message returned in the response of api/rest/sms
in the id
field.
Certified emails
GET
{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>
curl -X GET '{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID> ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/mailing/certificates/<ID>" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Parameter
Type
Mandatory
Description
id
string
Yes
Identifier of the message returned in the response of api/rest/mailing
in the id
field.
Events
Event Notifications
Introduction
The status notification service sets out to inform the customer's server about the events generated in the {{NAME}} service. Notifications will be made for mailings sent via any type of channel. This means that the customer can track each mailing in real time.
A single mailing can cause multiple events, so a bulk mailing may generate a significant number of notifications to the customer's server. To avoid server saturation, the events to be notified are queued up in {{NAME}} , so there may be a delay in delivering notifications if the customer's server is unable to manage the volume of notifications generated.
In order to enable this functionality, the customer must provide a URL where http POST requests will be made to notify an event.
Receiving new notification events
HTTP METHOD: POST
Content-Type: application/x-www-form-urlencoded
Parameters
Parameter
Type
Description
id
string
Alphanumeric identifier that was delivered in the message API. If the message was sent via the website, it will have no value.
channel
string
Indicates the channel of the mailing to which the notification refers. The possible values are: sms
, mailing
, landing
, text2speech
.
contactId
integer
Unique contact identifier.
campaignId
integer
Campaign identifier. If it was sent by API and you did not specify campaignName in the mailing, its value will be 0.
campaignName
string
Campaign name. If it was sent by API and you did not specify campaignName in the mailing, its chain value will be blank.
formId
integer
Unique form identifier. (Only for form events)
event
string
Indicates the event that has occurred. The possible values are: delivered
, opened
, clicked
, unsubscribed
, hard_bounced
, complaint
, sent
, soft_bounced
, undelivered
, rejected
, expired
, unsubscribed_landing
, form_opened
, form_submitted
, form_rejected
.
extra
string
Extra parameter with additional information of the event in JSON format. The "form_submitted" event will contain the values entered in the form by the user in the following format: {"formValues":{"param1":"value1", "param2": "value2", ...}}
The "clicked" event will contain the encoded url that has been clicked: {"url":"url_encoded"}
.
smtpResponse
string
Optional variable defined for the email channel and for the events delivered
, hard_bounced
, soft_bounced
. The response of the SMTP server of the recipient mail is returned.
eventDate
string
Date when event occured.
Notifications will be retried up to 5 times in case the client's server responds with an HTTP code other than 200 OK.
The waiting period between notifications is progressive, so the first retry will be made within 1 minute, the second after 2 minutes since the previous retry, the third after 3 minutes, etc.
Events report by sending
Reporte de eventos
GET
{{DASHBOARD_HOST}}/api/rest/sendings/<sendingId>/reports/events
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/events" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Filters
Parameter
Description
beforeDate
Show the results previous
to the indicated date. The date should be specified in ISO 8601
format.
afterDate
Show the results after
the indicated date. The date should be specified in ISO 8601
format.
showCustomFields
If set to 1, shows the custom fields used.
The parameters must be correctly encoded (urlencode) in relation to the standard RFC 3986 in order to be admitted by the server.
For example, to consult the event report between the dates 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:
{{DASHBOARD_HOST}}/api/rest/sendings/{sendingId}/reports/events?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00
Get the detailed report of events generated by a campaign. The response will be in text/csv
format and will contain the following columns:
For voice campaigns:
campaignName,campaignId,sendingId,contactId,event,phone,email,landline,countryIso,callDurationSeconds,createdAt
For the other channels:
campaignName,campaignId,sendingId,contactId,event,phone,email,landline,countryIso,browser,os,url,createdAt
Keystroke report Introduction
It returns a report with the telephone numbers together with the key pressed and the voice message.
This report is only available in voice interactive channel sendings.
Url
GET
{{DASHBOARD_HOST}}/api/rest/sendings/<sendingId>/reports/keys
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys ' ,
headers : {
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys"
payload = {}
headers = {
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sendings/1/reports/keys" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Filters
Parameter
Description
beforeDate
Show the results previous
to the indicated date. The date should be specified in ISO 8601
format.
afterDate
Show the results after
the indicated date. The date should be specified in ISO 8601
format.
The parameters must be correctly encoded (urlencode) in relation to the standard RFC 3986 in order to be admitted by the server.
For example, to consult the event report between the dates 2019-01-01T00:00:00+00:00 y 2019-02-01T00:00:00+00:00:
{{DASHBOARD_HOST}}/api/rest/sendings/{sendingId}/reports/keys?afterDate=2019-01-01T00%3A00%3A00%2B00%3A00&beforeDate=2019-02-01T00%3A00%3A00%2B00%3A00
Get the detailed keystrokes report for a voice interactive sending. The response will be in text/csv
format and will contain the following columns: phonenumber
, key
, message
OTP
Generate code
POST
{{DASHBOARD_HOST}}/api/rest/otp/generate
curl -X POST '{{DASHBOARD_HOST}}/api/rest/otp/generate' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "34666555444"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/otp/generate' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"recipient": "34666555444"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/otp/generate" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"recipient\": \"34666555444\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/otp/generate ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "recipient": "34666555444" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/otp/generate"
payload = "{ \" recipient \" : \" 34666555444 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/otp/generate" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" recipient \" : \" 34666555444 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/otp/generate" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"recipient\": \"34666555444\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 200 (OK)
{
"data" : {
"recipient" : "34666555444" ,
"code" : "1234" ,
"attempts" : 0 ,
"maxAttempts" : 3 ,
"maxSecondsValidity" : 60 ,
"appId" : "" ,
"createdAt" : "2020-01-01T12:00:00+00:00" ,
"updatedAt" : "2020-01-01T12:00:00+00:00" ,
"expiresAt" : "2020-01-01T12:01:00+00:00"
}
}
Error response (HTTP 422)
{
"error" : {
"code" : 422 ,
"description" : "The recipient field must be a valid phone or email."
}
}
Parameters
Parameter
Type
Mandatory
Description
recipient
string
Yes
User's phone number or email.
alpha
boolean
No
Indicates whether the code is alphanumeric or numeric. The default value is false
.
length
integer
No
Length of the code. The minimum value is 3
and the maximum is 10
. The default value is 4
.
maxAttempts
integer
No
Maximum number of attempts. The minimum value is 1
and the maximum is 10
. The default value is 3
.
maxSecondsValidity
integer
No
Maximum number of seconds between code generation and code validation. The minimum value is 30
and the maximum is 600
. The default value is 60
.
appId
string
No
The same phone or email can be validated at the same time as long as it is with a different appId
. The default value is ""
.
rejectIfPendingCode
boolean
No
Prevents the generation of a new OTP code if a previous one exists in pending status. The default value is false
.
Check code
POST
{{DASHBOARD_HOST}}/api/rest/otp/check
curl -X POST '{{DASHBOARD_HOST}}/api/rest/otp/check' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-d '{
"recipient": "34666555444",
"code": "1234"
}'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/otp/check' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => '{
"recipient": "34666555444",
"code": "1234"
}' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/otp/check" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "POST" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
String requestBody = "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }" ;
connection . setDoOutput ( true );
DataOutputStream wr = new DataOutputStream ( connection . getOutputStream ());
wr . writeBytes ( requestBody );
wr . flush ();
wr . close ();
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' post ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/otp/check ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
},
data : ' { "recipient": "34666555444", "code": "1234" } '
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/otp/check"
payload = "{ \" recipient \" : \" 34666555444 \" , \" code \" : \" 1234 \" }"
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "POST" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/otp/check" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Post . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
request . body = "{ \" recipient \" : \" 34666555444 \" , \" code \" : \" 1234 \" }"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/otp/check" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddParameter ( "application/json" , "{ \"recipient\": \"34666555444\", \"code\": \"1234\" }" , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
HTTP Response Code 200 (OK)
{
"data" : {
"valid" : true ,
"reason" : "Valid" ,
"otp" : {
"data" : {
"recipient" : "34666555444" ,
"code" : "1234" ,
"attempts" : 1 ,
"maxAttempts" : 3 ,
"maxSecondsValidity" : 60 ,
"appId" : "" ,
"createdAt" : "2020-01-01T12:00:00+00:00" ,
"updatedAt" : "2020-01-01T12:00:00+00:00" ,
"expiresAt" : "2020-01-01T12:01:00+00:00"
}
}
}
}
{
"data" : {
"valid" : false ,
"reason" : "Expired" ,
"otp" : {
"data" : {
"recipient" : "34666555444" ,
"code" : "1234" ,
"attempts" : 1 ,
"maxAttempts" : 3 ,
"maxSecondsValidity" : 60 ,
"appId" : "" ,
"createdAt" : "2020-01-01T12:00:00+00:00" ,
"updatedAt" : "2020-01-01T12:00:00+00:00" ,
"expiresAt" : "2020-01-01T12:01:00+00:00"
}
}
}
}
Error response (HTTP 422)
{
"error" : {
"code" : 422 ,
"description" : "The recipient field is required."
}
}
Parameters
Parameter
Type
Mandatory
Description
recipient
string
Yes
User's phone number or email.
code
string
Yes
Code to check.
caseSensitive
boolean
No
Use case-sensitive code comparison. The default value is false
.
appId
string
No
The same phone or email can be validated at the same time as long as it is with a different appId
. The default value is ""
.
Responses
Reason
Valid
Description
Valid
Yes
The code is valid.
Invalid code
No
The code is not valid.
Maximum attempts reached
No
The number of attempts has exceeded the maximum.
Expired
No
The validation time has exceeded the maximum.
Account
It returns account information such as username
, email
, time zone
, language
, balance
, creation date
, country
and currency
.
GET
{{DASHBOARD_HOST}}/api/rest/account
curl -X GET '{{DASHBOARD_HOST}}/api/rest/account' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/account' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/account" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/account ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/account"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/account" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/account" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Coverage
Returns the complete SMS
coverage by network
.
GET
{{DASHBOARD_HOST}}/api/rest/sms/coverage
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sms/coverage' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sms/coverage' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sms/coverage" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sms/coverage ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sms/coverage"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sms/coverage" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sms/coverage" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"countryIso" : "AD" ,
"countryName" : "Andorra" ,
"networkName" : "Default" ,
"mcc" : "213" ,
"mnc" : null ,
"cost" : 0.065 ,
"currencyCode" : "EUR" ,
"currencySymbol" : "€"
},
{
"countryIso" : "AD" ,
"countryName" : "Andorra" ,
"networkName" : "Servei De Tele. DAndorra" ,
"mcc" : "213" ,
"mnc" : "003" ,
"cost" : 0.065 ,
"currencyCode" : "EUR" ,
"currencySymbol" : "€"
},
{
"countryIso" : "AE" ,
"countryName" : "United Arab Emirates" ,
"networkName" : "Default" ,
"mcc" : "424" ,
"mnc" : null ,
"cost" : 0.0868 ,
"currencyCode" : "EUR" ,
"currencySymbol" : "€"
}
]
}
Returns the SMS
coverage grouped by country
indicating the minimum and maximum cost of each country.
GET
{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry
curl -X GET '{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN'
<?php
$curl = curl_init ();
curl_setopt_array ( $curl , array (
CURLOPT_URL => '{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array (
'Content-Type: application/json' ,
'Authorization: Basic YOUR_AUTH_TOKEN'
),
));
$response = curl_exec ( $curl );
curl_close ( $curl );
echo $response ;
import java.io.DataOutputStream ;
import java.io.BufferedReader ;
import java.io.InputStreamReader ;
import java.net.URL ;
import java.net.HttpsURLConnection ;
public class App {
public static void main ( String [] args ) {
try {
URL url = new URL ( "{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry" );
HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ();
connection . setRequestMethod ( "GET" );
connection . setRequestProperty ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
connection . setRequestProperty ( "Accept" , "application/json" );
BufferedReader in = new BufferedReader ( new InputStreamReader ( connection . getInputStream ()));
String inputLine ;
StringBuffer response = new StringBuffer ();
while (( inputLine = in . readLine ()) != null ) {
response . append ( inputLine );
}
in . close ();
System . out . println ( response . toString ());
} catch ( Exception e ) {
// TODO: handle exception
}
}
}
var axios = require ( ' axios ' );
var config = {
method : ' get ' ,
url : ' {{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' Authorization ' : ' Basic YOUR_AUTH_TOKEN '
}
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import requests
url = "{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry"
payload = {}
headers = {
'Content-Type' : 'application/json' ,
'Authorization' : 'Basic YOUR_AUTH_TOKEN'
}
response = requests . request ( "GET" , url , headers = headers , data = payload )
print ( response . text )
require "uri"
require "net/http"
url = URI ( "{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry" )
https = Net :: HTTP . new ( url . host , url . port )
https . use_ssl = true
request = Net :: HTTP :: Get . new ( url )
request [ "Content-Type" ] = "application/json"
request [ "Authorization" ] = "Basic YOUR_AUTH_TOKEN"
response = https . request ( request )
puts response . read_body
using System ;
using RestSharp ;
namespace HelloWorldApplication {
class HelloWorld {
static void Main ( string [] args ) {
var client = new RestClient ( "{{DASHBOARD_HOST}}/api/rest/sms/coverageByCountry" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Basic YOUR_AUTH_TOKEN" );
request . AddHeader ( "Content-Type" , "application/json" );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
}
}
}
Response
{
"data" : [
{
"countryIso" : "AD" ,
"countryName" : "Andorra" ,
"networks" : [
"Servei De Tele. DAndorra"
],
"minCost" : 0.065 ,
"maxCost" : 0.065 ,
"currencyCode" : "EUR" ,
"currencySymbol" : "€"
},
{
"countryIso" : "AE" ,
"countryName" : "United Arab Emirates" ,
"networks" : [
"DU" ,
"Etisalat"
],
"minCost" : 0.0868 ,
"maxCost" : 0.0868 ,
"currencyCode" : "EUR" ,
"currencySymbol" : "€"
}
]
}
Errors
Error Code
HTTP Code
Description
0
202
Accepted for delivery
101
500
Internal Database error
102
400
No valid recipients
103
401
Username or password unknown
104
400
Text message missing
105
400
Text message too long
106
400
Sender missing
107
400
Sender too long
108
400
No valid Datetime for send
109
400
Notification URL incorrect
110
400
Exceeded maximum parts allowed or incorrect number of parts
111
402
Not enough credits
112
401
IP address not allowed
113
400
Invalid coding
114
400
Invalid subject
115
400
Sender is not verified
116
400
Invalid replyTo
117
400
ReplyTo is not verified
118
401
Email blocked for exceeding the hard-bounced limit allowed
119
400
Invalid expiration date
120
400
Invalid GUID
121
400
Invalid scheduled date
122
500
Update error
123
500
Delete error
125
400
Invalid JSON
126
400
Empty campaign name
130
400
Invalid voice language
131
400
Invalid voice gender
132
400
Invalid voice caller
133
400
Invalid audio URL
134
400
Unsupported audio format
140
400
Template missing
141
400
Missing landing placeholder
142
400
Can't split variable placeholders
150
400
Missing billing profile
151
400
Error retrieving TPV url
152
400
Invalid VAT
153
400
Invalid method
154
400
Invalid conversion rate
155
400
Max limit reached
156
400
Min limit reached
157
400
Error generating invoice
160
400
Invalid voice interactive language
161
400
Invalid voice interactive gender
162
400
Invalid voice interactive caller
163
400
Invalid voice interactive audio URL
164
400
Unsupported voice interactive audio format
165
400
Invalid voice interactive speech type
166
400
Ivalid voice interactive menu option type
167
400
Trying to save an existing campaign
168
400
Empty speech type
169
400
Empty menu
170
400
Empty phone key
171
400
Phone Key is not a number
172
400
Phone key out of range
173
400
Empty menu options for sub menu
174
400
Empty phone prefix for call transfer
175
400
Empty phone for call transfer
176
400
Call retries value is not an integer
177
400
Call retries value out of range
178
400
Cost limit value is not an integer
179
400
Speech retries value is not an integer
180
400
Speech retries value out of range
181
400
Speech timeout seconds value is not an integer
182
400
Speech timeout seconds value out of range
183
400
Available times value is not an array
184
400
Available times day is not an integer
185
400
Available times day out of range
186
400
Available times from hour format error
187
400
Available times to hour format error
188
400
Available times from hour is greater than to hour
189
400
Missing available time object property
190
400
Call Retries is specified but its value is empty
191
400
Cost limit is specified but its value is empty
192
400
Speech Retries is specified but its value is empty
193
400
Speech timeout seconds is specified but its value is empty
194
400
Available times is specified but its value is empty
195
400
No valid contacts external IDs
196
400
Available times range is too short
422
422
Input validation error
Annexes GSM character set GSM basic
character set
0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x00
@
Δ
SP
0
¡
P
¿
p
0x01
£
_
!
1
A
Q
a
q
0x02
$
Φ
"
2
B
R
b
r
0x03
¥
Γ
#
3
C
S
c
s
0x04
è
Λ
¤
4
D
T
d
t
0x05
é
Ω
%
5
E
U
e
u
0x06
ù
Π
&
6
F
V
f
v
0x07
ì
Ψ
'
7
G
W
g
w
0x08
ò
Σ
(
8
H
X
h
x
0x09
Ç
Θ
)
9
I
Y
i
y
0x0A
LF
Ξ
*
:
J
Z
j
z
0x0B
Ø
ESC
+
;
K
Ä
k
ä
0x0C
ø
Æ
,
<
L
Ö
l
ö
0x0D
CR
æ
-
=
M
Ñ
m
ñ
0x0E
Å
ß
.
>
N
Ü
n
ü
0x0F
å
É
/
?
O
§
o
à
* Special characters
GSM extended
character set
These characters occupy two positions
0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x00
|
0x01
0x02
0x03
0x04
^
0x05
€
0x06
0x07
0x08
{
0x09
}
0x0A
FF
0x0B
SS2
0x0C
[
0x0D
CR2
~
0x0E
]
0x0F
\
* Special characters
GSM-PT character set GSM-PT basic
character set
0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x00
@
Δ
SP
0
Í
P
~
p
0x01
£
_
!
1
A
Q
a
q
0x02
$
ª
"
2
B
R
b
r
0x03
¥
Ç
#
3
C
S
c
s
0x04
ê
À
º
4
D
T
d
t
0x05
é
∞
%
5
E
U
e
u
0x06
ú
^
&
6
F
V
f
v
0x07
í
\
'
7
G
W
g
w
0x08
ó
€
(
8
H
X
h
x
0x09
ç
Ó
)
9
I
Y
i
y
0x0A
LF
|
*
:
J
Z
j
z
0x0B
Ô
ESC
+
;
K
Ã
k
ã
0x0C
ô
Â
,
<
L
Õ
l
õ
0x0D
CR
â
-
=
M
Ú
m
`
0x0E
Á
Ê
.
>
N
Ü
n
ü
0x0F
á
É
/
?
O
§
o
à
* Special characters
** Characters different from GSM
GSM-PT extended
character set
These characters occupy two positions
0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x00
|
0x01
À
Â
0x02
Φ
0x03
Γ
0x04
^
0x05
ê
Ω
Ú
€
ú
0x06
Π
0x07
Ψ
0x08
Σ
{
0x09
ç
Θ
}
Í
í
0x0A
FF
0x0B
Ô
SS2
Ã
ã
0x0C
ô
[
Õ
õ
0x0D
CR2
~
0x0E
Á
]
0x0F
á
Ê
\
Ó
ó
â
* Special characters
** Characters different from GSM
Sending Restrictions by Country
Many countries have regulations designed to protect users from unwanted communications, both via SMS and voice calls. To ensure your campaigns reach their destination correctly and avoid blocks or penalties, it is essential to adhere to these rules.
Each country defines its own conditions and restrictions regarding commercial communications, so it is important to understand and respect the specifics of each. It is important to keep in mind that these conditions and restrictions are subject to the current legislation of each country and may change. 360nrs is not responsible for non-compliance with these policies; the responsibility lies with the client.
Below, you will find the restrictions for the main countries so you can operate safely and effectively. If you have any questions or if the recipient country is not listed below, we recommend contacting our customer service team.
Preliminary Considerations
In all countries, customer consent is required to receive SMS or voice calls.
For promotional SMS messages, an unsubscribe option must be included in the SMS content.
🇫🇷 France
Commercial or promotional SMS messages sent to France must comply with certain legal regulations, which are described below. Transactional messages, however, are not subject to these restrictions.
Prohibited Content
Sending messages related to politics, religion, gambling, or unsolicited promotions is strictly prohibited.
Time Restrictions
Marketing SMS messages can only be sent Monday through Saturday, between 8:00 AM and 10:00 PM. Any messages sent outside of these hours will be automatically blocked and scheduled for resending at the next permitted time. That is, if you try to send an SMS on Sunday at 2:00 PM, it won't be sent until Monday at 8:00 AM.
Sender Conditions
Contact support@360nrs.com for more information and to validate your sender.
Recipient Unsubscribe
It is mandatory to add the STOP au [STOP_CODE] as an opt-out instruction at the end of your marketing SMS messages to France.
🇪🇸 Spain
SMS messages sent to Spain have certain legal conditions. Any SMS identified as marketing content will be subject to the conditions listed in the sections below.
Prohibited Content
Sending messages related to political or religious topics, gambling, or unsolicited promotions is strictly prohibited.
🇬🇧 United Kingdom
SMS messages sent to the United Kingdom are limited to certain regulatory conditions. Any SMS messages identified as marketing content will be subject to the conditions listed below.
Prohibited Content
Sending messages related to political or religious themes or unsolicited promotions is strictly prohibited.
If you send adult or gambling content, you must ensure that the recipient's age has been verified in compliance with PSA and Ofcom Guidelines.
🇺🇸 United States
Commercial or promotional SMS messages sent to the United States must comply with certain legal regulations, which are described below. Transactional messages, however, are not subject to these restrictions.
Restricted Content
The use of public URL shorteners, such as bit.ly or tinyurl, is not permitted. However, the use of custom domains within these services is permitted. Therefore, you may use 360nrs' own URL shortener.
In addition, sending messages containing sexually explicit or pornographic content, abusive or harassing material, information related to firearms, including fireworks, or references to alcohol, tobacco, or illegal drugs is strictly prohibited. Sending messages about gambling, investment opportunities, the repeated sending or receiving of one-time access codes (OTPs) on behalf of other providers, activities considered high financial risk, loans or loan forgiveness, credit repair services, debt collection, or tax-related matters is also prohibited. Likewise, content linked to cryptocurrency, including those related to OTPs, unsolicited real estate inquiries such as WeBuyHomes, or promotions associated with multi-level marketing is not permitted.
Sender Conditions
Contact support@360nrs.com for more information and to validate your sender.
🇨🇴 Colombia Time Restrictions
Marketing SMS messages can only be sent Monday through Friday, between 7:00 AM and 7:00 PM, and Saturdays from 8:00 AM to 3:00 PM. Sending promotional messages is not permitted on Sundays and public holidays. Any messages sent outside of these hours will be automatically blocked and scheduled for forwarding at the next permitted time. This means that if you attempt to send an SMS on Sunday at 2:00 PM, it will not be sent until Monday at 8:00 AM.
Restricted Content
Promotional SMS content may, in some cases, require prior registration before sending. Additionally, the 360nrs platform may automatically add the sender's name to the beginning of the message or include a URL at the end, depending on the channel's or destination country's conditions.
Prohibited Content
Sending messages related to political or religious topics, gambling, or unsolicited promotions is strictly prohibited.
🇮🇪 Ireland
Before sending any marketing traffic, the express consent (opt-in) of mobile device users is required.
Restricted Content
Sending messages related to politics, religion, gambling, or unsolicited promotions is strictly prohibited.
Sender Terms
Contact support@360nrs.com for more information and to validate your sender.