Templates
Update Template
Update an existing email template’s content, subject, or settings using the AutoSend API.
PUT
/
templates
/
{templateId}
curl --request PUT \
--url https://api.autosend.com/v1/templates/A-abc123def456ghi789jk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}'
import requests
url = "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk', {
method: 'PUT',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$templateId = 'A-abc123def456ghi789jk';
$url = "https://api.autosend.com/v1/templates/{$templateId}";
$data = [
'templateName' => 'Updated Welcome Email',
'subject' => 'Welcome aboard, {{firstName}}!',
'emailTemplate' => '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
'previewText' => 'Your journey starts here'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
payload := map[string]interface{}{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class UpdateTemplate {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/templates/A-abc123def456ghi789jk");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"templateName\": \"Updated Welcome Email\",\n" +
" \"subject\": \"Welcome aboard, {{firstName}}!\",\n" +
" \"emailTemplate\": \"<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>\",\n" +
" \"previewText\": \"Your journey starts here\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"templateId": "A-abc123def456ghi789jk",
"templateName": "Updated Welcome Email",
"description": "Welcome email for new users",
"subject": "Welcome aboard, {{firstName}}!",
"previewText": "Your journey starts here",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"templateType": "transactional",
"builderType": "code",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-03-17T14:45:00.000Z"
}
}
curl --request PUT \
--url https://api.autosend.com/v1/templates/A-abc123def456ghi789jk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}'
import requests
url = "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk', {
method: 'PUT',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$templateId = 'A-abc123def456ghi789jk';
$url = "https://api.autosend.com/v1/templates/{$templateId}";
$data = [
'templateName' => 'Updated Welcome Email',
'subject' => 'Welcome aboard, {{firstName}}!',
'emailTemplate' => '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
'previewText' => 'Your journey starts here'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
payload := map[string]interface{}{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class UpdateTemplate {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/templates/A-abc123def456ghi789jk");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"templateName\": \"Updated Welcome Email\",\n" +
" \"subject\": \"Welcome aboard, {{firstName}}!\",\n" +
" \"emailTemplate\": \"<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>\",\n" +
" \"previewText\": \"Your journey starts here\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"templateId": "A-abc123def456ghi789jk",
"templateName": "Updated Welcome Email",
"description": "Welcome email for new users",
"subject": "Welcome aboard, {{firstName}}!",
"previewText": "Your journey starts here",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"templateType": "transactional",
"builderType": "code",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-03-17T14:45:00.000Z"
}
}
Authorizations
string | header
required
Bearer authentication header of the form Bearer
<token>, where <token> is your auth token.Path Parameters
string
required
The unique identifier of the template to update.Example:
"A-abc123def456ghi789jk"Body
Template fields to update. All fields are optional — only provided fields will be updated.string
Name of the template (max 90 characters).Maximum length:
90Example: "Updated Welcome Email"string
Email subject line (max 988 characters). Supports Handlebars template variables.Maximum length:
988Example: "Welcome aboard, {{firstName}}!"string
Short description of the template (max 140 characters).Maximum length:
140Example: "Updated welcome email for new users"string
Email preview text / preheader (max 140 characters).Maximum length:
140Example: "Your journey starts here"string
HTML content of the email template. Supports Handlebars syntax for dynamic variables.Example:
<h1>Hey {{firstName}}!</h1>
<p>We are excited to have you at {{companyName}}.</p>
string
Type of the template.Allowed values:
transactional, marketingExample: "transactional"object
Dynamic variables configuration for the template.Example:
{
"firstName": "string",
"companyName": "string"
}
string
ID of the sender to associate with this template. The sender must belong to the same project.Example:
"60d5ec49f1b2c72d9c8b4567"Response
Template updated successfullyboolean
Indicates if the request was successfulExample:
trueobject
The updated template object
Show child attributes
Show child attributes
string
Unique template identifierExample:
"A-abc123def456ghi789jk"string
Name of the templateExample:
"Updated Welcome Email"string
Template descriptionExample:
"Welcome email for new users"string
Email subject lineExample:
"Welcome aboard, {{firstName}}!"string
Email preview textExample:
"Your journey starts here"string
HTML content of the template
string
Type of templateExample:
"transactional"string
Builder type usedExample:
"code"string
ISO 8601 timestamp of creationExample:
"2026-01-15T10:30:00.000Z"string
ISO 8601 timestamp of last updateExample:
"2026-03-17T14:45:00.000Z"Was this page helpful?
⌘I
curl --request PUT \
--url https://api.autosend.com/v1/templates/A-abc123def456ghi789jk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}'
import requests
url = "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk', {
method: 'PUT',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$templateId = 'A-abc123def456ghi789jk';
$url = "https://api.autosend.com/v1/templates/{$templateId}";
$data = [
'templateName' => 'Updated Welcome Email',
'subject' => 'Welcome aboard, {{firstName}}!',
'emailTemplate' => '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
'previewText' => 'Your journey starts here'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <token>',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/templates/A-abc123def456ghi789jk"
payload := map[string]interface{}{
"templateName": "Updated Welcome Email",
"subject": "Welcome aboard, {{firstName}}!",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"previewText": "Your journey starts here",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class UpdateTemplate {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/templates/A-abc123def456ghi789jk");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("Authorization", "Bearer <token>");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"templateName\": \"Updated Welcome Email\",\n" +
" \"subject\": \"Welcome aboard, {{firstName}}!\",\n" +
" \"emailTemplate\": \"<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>\",\n" +
" \"previewText\": \"Your journey starts here\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/templates/A-abc123def456ghi789jk')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri.path)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
templateName: 'Updated Welcome Email',
subject: 'Welcome aboard, {{firstName}}!',
emailTemplate: '<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>',
previewText: 'Your journey starts here'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"templateId": "A-abc123def456ghi789jk",
"templateName": "Updated Welcome Email",
"description": "Welcome email for new users",
"subject": "Welcome aboard, {{firstName}}!",
"previewText": "Your journey starts here",
"emailTemplate": "<h1>Hey {{firstName}}!</h1><p>We are excited to have you at {{companyName}}.</p>",
"templateType": "transactional",
"builderType": "code",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-03-17T14:45:00.000Z"
}
}