curl --request PUT \
--url https://api.emailr.dev/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Welcome Email",
"subject": "Welcome to {{company}}",
"html_content": "<h1>Welcome {{name}}</h1>",
"text_content": "Welcome {{name}}",
"variables": [
"name",
"company"
],
"from_email": "[email protected]",
"from_name": "Acme Inc",
"reply_to": "[email protected]",
"preview_text": "Check out what's new...",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"newsletter",
"vip"
]
}
EOFimport requests
url = "https://api.emailr.dev/v1/templates/{id}"
payload = {
"name": "Welcome Email",
"subject": "Welcome to {{company}}",
"html_content": "<h1>Welcome {{name}}</h1>",
"text_content": "Welcome {{name}}",
"variables": ["name", "company"],
"from_email": "[email protected]",
"from_name": "Acme Inc",
"reply_to": "[email protected]",
"preview_text": "Check out what's new...",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": ["newsletter", "vip"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Welcome Email',
subject: 'Welcome to {{company}}',
html_content: '<h1>Welcome {{name}}</h1>',
text_content: 'Welcome {{name}}',
variables: ['name', 'company'],
from_email: '[email protected]',
from_name: 'Acme Inc',
reply_to: '[email protected]',
preview_text: 'Check out what\'s new...',
inbox_id: '123e4567-e89b-12d3-a456-426614174000',
tags: ['newsletter', 'vip']
})
};
fetch('https://api.emailr.dev/v1/templates/{id}', 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://api.emailr.dev/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Welcome Email',
'subject' => 'Welcome to {{company}}',
'html_content' => '<h1>Welcome {{name}}</h1>',
'text_content' => 'Welcome {{name}}',
'variables' => [
'name',
'company'
],
'from_email' => '[email protected]',
'from_name' => 'Acme Inc',
'reply_to' => '[email protected]',
'preview_text' => 'Check out what\'s new...',
'inbox_id' => '123e4567-e89b-12d3-a456-426614174000',
'tags' => [
'newsletter',
'vip'
]
]),
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://api.emailr.dev/v1/templates/{id}"
payload := strings.NewReader("{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.emailr.dev/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"subject": "<string>",
"html_content": "<string>",
"text_content": "<string>",
"variables": [
"<string>"
],
"from_email": "<string>",
"from_name": "<string>",
"reply_to": "<string>",
"preview_text": "<string>",
"preview_html": "<string>",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"newsletter",
"vip"
],
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}Update template
Update an existing template
curl --request PUT \
--url https://api.emailr.dev/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Welcome Email",
"subject": "Welcome to {{company}}",
"html_content": "<h1>Welcome {{name}}</h1>",
"text_content": "Welcome {{name}}",
"variables": [
"name",
"company"
],
"from_email": "[email protected]",
"from_name": "Acme Inc",
"reply_to": "[email protected]",
"preview_text": "Check out what's new...",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"newsletter",
"vip"
]
}
EOFimport requests
url = "https://api.emailr.dev/v1/templates/{id}"
payload = {
"name": "Welcome Email",
"subject": "Welcome to {{company}}",
"html_content": "<h1>Welcome {{name}}</h1>",
"text_content": "Welcome {{name}}",
"variables": ["name", "company"],
"from_email": "[email protected]",
"from_name": "Acme Inc",
"reply_to": "[email protected]",
"preview_text": "Check out what's new...",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": ["newsletter", "vip"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Welcome Email',
subject: 'Welcome to {{company}}',
html_content: '<h1>Welcome {{name}}</h1>',
text_content: 'Welcome {{name}}',
variables: ['name', 'company'],
from_email: '[email protected]',
from_name: 'Acme Inc',
reply_to: '[email protected]',
preview_text: 'Check out what\'s new...',
inbox_id: '123e4567-e89b-12d3-a456-426614174000',
tags: ['newsletter', 'vip']
})
};
fetch('https://api.emailr.dev/v1/templates/{id}', 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://api.emailr.dev/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Welcome Email',
'subject' => 'Welcome to {{company}}',
'html_content' => '<h1>Welcome {{name}}</h1>',
'text_content' => 'Welcome {{name}}',
'variables' => [
'name',
'company'
],
'from_email' => '[email protected]',
'from_name' => 'Acme Inc',
'reply_to' => '[email protected]',
'preview_text' => 'Check out what\'s new...',
'inbox_id' => '123e4567-e89b-12d3-a456-426614174000',
'tags' => [
'newsletter',
'vip'
]
]),
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://api.emailr.dev/v1/templates/{id}"
payload := strings.NewReader("{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.emailr.dev/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Welcome Email\",\n \"subject\": \"Welcome to {{company}}\",\n \"html_content\": \"<h1>Welcome {{name}}</h1>\",\n \"text_content\": \"Welcome {{name}}\",\n \"variables\": [\n \"name\",\n \"company\"\n ],\n \"from_email\": \"[email protected]\",\n \"from_name\": \"Acme Inc\",\n \"reply_to\": \"[email protected]\",\n \"preview_text\": \"Check out what's new...\",\n \"inbox_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"subject": "<string>",
"html_content": "<string>",
"text_content": "<string>",
"variables": [
"<string>"
],
"from_email": "<string>",
"from_name": "<string>",
"reply_to": "<string>",
"preview_text": "<string>",
"preview_html": "<string>",
"inbox_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"newsletter",
"vip"
],
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}Authorizations
API key authentication. Use your API key as the bearer token.
Path Parameters
"123e4567-e89b-12d3-a456-426614174000"
Body
1"Welcome Email"
1"Welcome to {{company}}"
"<h1>Welcome {{name}}</h1>"
"Welcome {{name}}"
["name", "company"]
Default from email address. Must match a verified domain.
Display name for the sender.
"Acme Inc"
Reply-To email address for template-based emails.
Preview text (preheader) shown in email clients.
"Check out what's new..."
Optional inbox ID. When provided, the inbox's name, from address, and reply-to address are used as defaults unless explicit values are given. Set to null to remove inbox association.
"123e4567-e89b-12d3-a456-426614174000"
Tags for categorization. Lowercase, max 50 chars each, max 20 tags.
["newsletter", "vip"]
Response
Template updated
"123e4567-e89b-12d3-a456-426614174000"
Preview HTML content for AI agent review workflow
Associated inbox ID for sender identity defaults
"123e4567-e89b-12d3-a456-426614174000"
Tags for categorization.
["newsletter", "vip"]