cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"name": "Test Template",
"template": "Hi {{ firstName }}, Welcome to Sakari!",
"type": "SMS"
}'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates',
headers:
{ 'Content-Type': 'application/json' },
body:
{ name: 'Test Template',
template: 'Hi {{ firstName }}, Welcome to Sakari!',
type: 'SMS' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Content-Type' => 'application/json'
));
$request->setBody('{
"name": "Test Template",
"template": "Hi {{ firstName }}, Welcome to Sakari!",
"type": "SMS"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/templates"
payload = {
"name": "<string>",
"type": "SMS",
"template": "Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes",
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/v1/accounts/{accountId}/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"pagination": {
"limit": 123,
"offset": 123,
"hasNext": true
},
"data": [
{
"id": "<string>",
"name": "<string>",
"type": "SMS",
"template": "Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes",
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
],
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
]
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}templates
Create template
POST
/
v1
/
accounts
/
{accountId}
/
templates
cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"name": "Test Template",
"template": "Hi {{ firstName }}, Welcome to Sakari!",
"type": "SMS"
}'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates',
headers:
{ 'Content-Type': 'application/json' },
body:
{ name: 'Test Template',
template: 'Hi {{ firstName }}, Welcome to Sakari!',
type: 'SMS' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Content-Type' => 'application/json'
));
$request->setBody('{
"name": "Test Template",
"template": "Hi {{ firstName }}, Welcome to Sakari!",
"type": "SMS"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/templates"
payload = {
"name": "<string>",
"type": "SMS",
"template": "Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes",
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sakari.io/v1/accounts/{accountId}/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"SMS\",\n \"template\": \"Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes\",\n \"media\": [\n {\n \"url\": \"<string>\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"pagination": {
"limit": 123,
"offset": 123,
"hasNext": true
},
"data": [
{
"id": "<string>",
"name": "<string>",
"type": "SMS",
"template": "Hi {{{firstName}}}. Grab 20% off today only at ABC Shoes",
"media": [
{
"url": "<string>",
"type": "<string>",
"name": "<string>",
"filename": "<string>"
}
],
"created": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
},
"updated": {
"at": "2023-11-07T05:31:56Z",
"by": {
"id": "<string>",
"name": "Joe Bloggs",
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joe@bloggs.com",
"source": "<string>",
"subSource": "<string>"
}
}
}
]
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}{
"success": true,
"error": {
"code": "CONT-010",
"description": "Contact has requested no further communication"
}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Account to apply operations to
Body
application/json
⌘I