Update an email template
curl --request PATCH \
--url https://api.heymilo.ai/api/v2/email-templates/{template_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"subject": "<string>",
"content": "<string>",
"blackout_period": {
"timezone": "Europe/Berlin",
"start_hour": 22,
"end_hour": 7,
"enabled": true
}
}
'import requests
url = "https://api.heymilo.ai/api/v2/email-templates/{template_id}"
payload = {
"name": "<string>",
"subject": "<string>",
"content": "<string>",
"blackout_period": {
"timezone": "Europe/Berlin",
"start_hour": 22,
"end_hour": 7,
"enabled": True
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
subject: '<string>',
content: '<string>',
blackout_period: {timezone: 'Europe/Berlin', start_hour: 22, end_hour: 7, enabled: true}
})
};
fetch('https://api.heymilo.ai/api/v2/email-templates/{template_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.heymilo.ai/api/v2/email-templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'subject' => '<string>',
'content' => '<string>',
'blackout_period' => [
'timezone' => 'Europe/Berlin',
'start_hour' => 22,
'end_hour' => 7,
'enabled' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.heymilo.ai/api/v2/email-templates/{template_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.patch("https://api.heymilo.ai/api/v2/email-templates/{template_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heymilo.ai/api/v2/email-templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "B31EB9E73BEE",
"template_key": "WEB_INTERVIEW_INVITATION",
"name": "Custom Interview Invitation",
"subject": "Interview Confirmation for {{job_title}} at {{company_name}}",
"content": "<p>Hello {{candidate_name}}, ...</p>",
"created_at": 1739612400,
"updated_at": 1739617200,
"object": "email_template",
"blackout_period": {
"enabled": true,
"timezone": "America/New_York",
"start_hour": 22,
"end_hour": 7
},
"content_warnings": [
{}
]
},
"meta": {}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}Update an email template
Change a template’s name, subject, body or blackout period. Only fields present in the request body are modified. The template_key cannot be changed. Every group mapping this template sends the new version straight away.
PATCH
/
api
/
v2
/
email-templates
/
{template_id}
Update an email template
curl --request PATCH \
--url https://api.heymilo.ai/api/v2/email-templates/{template_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"subject": "<string>",
"content": "<string>",
"blackout_period": {
"timezone": "Europe/Berlin",
"start_hour": 22,
"end_hour": 7,
"enabled": true
}
}
'import requests
url = "https://api.heymilo.ai/api/v2/email-templates/{template_id}"
payload = {
"name": "<string>",
"subject": "<string>",
"content": "<string>",
"blackout_period": {
"timezone": "Europe/Berlin",
"start_hour": 22,
"end_hour": 7,
"enabled": True
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
subject: '<string>',
content: '<string>',
blackout_period: {timezone: 'Europe/Berlin', start_hour: 22, end_hour: 7, enabled: true}
})
};
fetch('https://api.heymilo.ai/api/v2/email-templates/{template_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.heymilo.ai/api/v2/email-templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'subject' => '<string>',
'content' => '<string>',
'blackout_period' => [
'timezone' => 'Europe/Berlin',
'start_hour' => 22,
'end_hour' => 7,
'enabled' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.heymilo.ai/api/v2/email-templates/{template_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.patch("https://api.heymilo.ai/api/v2/email-templates/{template_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heymilo.ai/api/v2/email-templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"subject\": \"<string>\",\n \"content\": \"<string>\",\n \"blackout_period\": {\n \"timezone\": \"Europe/Berlin\",\n \"start_hour\": 22,\n \"end_hour\": 7,\n \"enabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "B31EB9E73BEE",
"template_key": "WEB_INTERVIEW_INVITATION",
"name": "Custom Interview Invitation",
"subject": "Interview Confirmation for {{job_title}} at {{company_name}}",
"content": "<p>Hello {{candidate_name}}, ...</p>",
"created_at": 1739612400,
"updated_at": 1739617200,
"object": "email_template",
"blackout_period": {
"enabled": true,
"timezone": "America/New_York",
"start_hour": 22,
"end_hour": 7
},
"content_warnings": [
{}
]
},
"meta": {}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The request body failed validation",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "invalid_param",
"message": "title must be between 3 and 200 characters",
"param": "title"
}
]
}
}Authorizations
Body
application/json
Request body for updating an email template. Send only what changes.
Response
Successful Response
Was this page helpful?