Update a template
curl --request POST \
--url https://{notifuseDomain}/api/templates.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
'import requests
url = "https://{notifuseDomain}/api/templates.update"
payload = {
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_id: 'ws_1234567890',
id: 'welcome_email',
name: 'Welcome Email',
channel: 'email',
category: 'transactional',
template_macro_id: '<string>',
test_data: {},
settings: {}
})
};
fetch('https://{notifuseDomain}/api/templates.update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{notifuseDomain}/api/templates.update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workspace_id' => 'ws_1234567890',
'id' => 'welcome_email',
'name' => 'Welcome Email',
'channel' => 'email',
'category' => 'transactional',
'template_macro_id' => '<string>',
'test_data' => [
],
'settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{notifuseDomain}/api/templates.update"
payload := strings.NewReader("{\n \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\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://{notifuseDomain}/api/templates.update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{notifuseDomain}/api/templates.update")
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 \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"template": {
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"version": 1,
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "support@example.com",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"integration_id": "<string>",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
},
"settings": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "Template not found"
}{
"error": "Failed to update template"
}Templates
Update a template
Updates an existing template. Creates a new version of the template.
POST
/
api
/
templates.update
Update a template
curl --request POST \
--url https://{notifuseDomain}/api/templates.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
'import requests
url = "https://{notifuseDomain}/api/templates.update"
payload = {
"workspace_id": "ws_1234567890",
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"template_macro_id": "<string>",
"test_data": {},
"settings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspace_id: 'ws_1234567890',
id: 'welcome_email',
name: 'Welcome Email',
channel: 'email',
category: 'transactional',
template_macro_id: '<string>',
test_data: {},
settings: {}
})
};
fetch('https://{notifuseDomain}/api/templates.update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{notifuseDomain}/api/templates.update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workspace_id' => 'ws_1234567890',
'id' => 'welcome_email',
'name' => 'Welcome Email',
'channel' => 'email',
'category' => 'transactional',
'template_macro_id' => '<string>',
'test_data' => [
],
'settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{notifuseDomain}/api/templates.update"
payload := strings.NewReader("{\n \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\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://{notifuseDomain}/api/templates.update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{notifuseDomain}/api/templates.update")
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 \"workspace_id\": \"ws_1234567890\",\n \"id\": \"welcome_email\",\n \"name\": \"Welcome Email\",\n \"channel\": \"email\",\n \"category\": \"transactional\",\n \"template_macro_id\": \"<string>\",\n \"test_data\": {},\n \"settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"template": {
"id": "welcome_email",
"name": "Welcome Email",
"channel": "email",
"category": "transactional",
"version": 1,
"email": {
"subject": "Welcome, {{user_name}}!",
"compiled_preview": "<string>",
"visual_editor_tree": {
"type": "mjml",
"children": []
},
"sender_id": "sender_123",
"reply_to": "support@example.com",
"subject_preview": "Get started with your account",
"text": "<string>"
},
"web": {
"content": {},
"html": "<string>",
"plain_text": "<string>"
},
"template_macro_id": "<string>",
"integration_id": "<string>",
"test_data": {
"user_name": "John Doe",
"action_url": "https://example.com/action"
},
"settings": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "Template not found"
}{
"error": "Failed to update template"
}Authorizations
API token for authentication
Body
application/json
The ID of the workspace
Example:
"ws_1234567890"
ID of the template to update
Maximum string length:
32Example:
"welcome_email"
Name of the template
Maximum string length:
32Example:
"Welcome Email"
Communication channel
Available options:
email, web Example:
"email"
Template category
Available options:
marketing, transactional, welcome, opt_in, unsubscribe, bounce, blocklist, blog, other Example:
"transactional"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
ID of the template macro (layout) to use
Test data for template preview
Channel-specific settings
Response
Template updated successfully
Show child attributes
Show child attributes
⌘I
