curl --request PUT \
--url https://core-api.getaptly.com/api/templates/{id} \
--header 'Content-Type: application/json' \
--header 'x-token: <api-key>' \
--data '
{
"companyId": "{{companyId}}",
"userId": "{{userId}}",
"name": "Move-in welcome",
"description": "Sent to new residents on move-in day",
"templateType": "email",
"subject": "Welcome to your new home",
"content": "<p>Welcome!</p>",
"htmlBuilder": false
}
'import requests
url = "https://core-api.getaptly.com/api/templates/{id}"
payload = {
"companyId": "{{companyId}}",
"userId": "{{userId}}",
"name": "Move-in welcome",
"description": "Sent to new residents on move-in day",
"templateType": "email",
"subject": "Welcome to your new home",
"content": "<p>Welcome!</p>",
"htmlBuilder": False
}
headers = {
"x-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyId: '{{companyId}}',
userId: '{{userId}}',
name: 'Move-in welcome',
description: 'Sent to new residents on move-in day',
templateType: 'email',
subject: 'Welcome to your new home',
content: '<p>Welcome!</p>',
htmlBuilder: false
})
};
fetch('https://core-api.getaptly.com/api/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://core-api.getaptly.com/api/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([
'companyId' => '{{companyId}}',
'userId' => '{{userId}}',
'name' => 'Move-in welcome',
'description' => 'Sent to new residents on move-in day',
'templateType' => 'email',
'subject' => 'Welcome to your new home',
'content' => '<p>Welcome!</p>',
'htmlBuilder' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-token: <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://core-api.getaptly.com/api/templates/{id}"
payload := strings.NewReader("{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-token", "<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.put("https://core-api.getaptly.com/api/templates/{id}")
.header("x-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://core-api.getaptly.com/api/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"_id": "<string>",
"companyId": "<string>",
"name": "<string>",
"templateType": "sms",
"archived": true,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Update a template
Replaces the fields of an existing template. The payload and its validation are
identical to POST /api/templates — including the merge-field placeholders
documented there, whose available values come from
GET /api/board/{boardId}/merge-fields. On top of the template permission, the
acting user must have access to the library folder the template sits in. A
template that does not exist — or belongs to another company — returns 404; an
archived one returns 403, since it is the caller’s own and
GET /api/templates/{id} still returns it.
curl --request PUT \
--url https://core-api.getaptly.com/api/templates/{id} \
--header 'Content-Type: application/json' \
--header 'x-token: <api-key>' \
--data '
{
"companyId": "{{companyId}}",
"userId": "{{userId}}",
"name": "Move-in welcome",
"description": "Sent to new residents on move-in day",
"templateType": "email",
"subject": "Welcome to your new home",
"content": "<p>Welcome!</p>",
"htmlBuilder": false
}
'import requests
url = "https://core-api.getaptly.com/api/templates/{id}"
payload = {
"companyId": "{{companyId}}",
"userId": "{{userId}}",
"name": "Move-in welcome",
"description": "Sent to new residents on move-in day",
"templateType": "email",
"subject": "Welcome to your new home",
"content": "<p>Welcome!</p>",
"htmlBuilder": False
}
headers = {
"x-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyId: '{{companyId}}',
userId: '{{userId}}',
name: 'Move-in welcome',
description: 'Sent to new residents on move-in day',
templateType: 'email',
subject: 'Welcome to your new home',
content: '<p>Welcome!</p>',
htmlBuilder: false
})
};
fetch('https://core-api.getaptly.com/api/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://core-api.getaptly.com/api/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([
'companyId' => '{{companyId}}',
'userId' => '{{userId}}',
'name' => 'Move-in welcome',
'description' => 'Sent to new residents on move-in day',
'templateType' => 'email',
'subject' => 'Welcome to your new home',
'content' => '<p>Welcome!</p>',
'htmlBuilder' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-token: <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://core-api.getaptly.com/api/templates/{id}"
payload := strings.NewReader("{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-token", "<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.put("https://core-api.getaptly.com/api/templates/{id}")
.header("x-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://core-api.getaptly.com/api/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyId\": \"{{companyId}}\",\n \"userId\": \"{{userId}}\",\n \"name\": \"Move-in welcome\",\n \"description\": \"Sent to new residents on move-in day\",\n \"templateType\": \"email\",\n \"subject\": \"Welcome to your new home\",\n \"content\": \"<p>Welcome!</p>\",\n \"htmlBuilder\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"_id": "<string>",
"companyId": "<string>",
"name": "<string>",
"templateType": "sms",
"archived": true,
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Authorizations
Path Parameters
Template ID.
Body
Template kind. blockDocument is not accepted — it is an internal type for document blocks, not a user-facing template.
sms, email, form, eSignature, pdf Email subject, or the file name for a pdf template — in which case filename-illegal characters are stripped. Merge placeholders work here too, and are shape-checked the same way.
Template body. Merge placeholders take the form {{value}} or {{value || fallback: text}}, where value is an item's value from GET /api/board/{boardId}/merge-fields — for example {{firstname}}, {{Locations["Rent"] || fallback: TBD}}. They are checked for shape — an unclosed {{, an empty field name or a malformed bracket reference is rejected. Whether each field exists is not checked: an unknown one renders as its fallback at merge time.
Required with a partner token; resolved from an API key or delegate token.
The acting user. Required with an API key or partner token; a delegate token supplies its own.
Must be false or omitted. HTML-builder templates keep their markup in a builder-owned builderData format and can only be authored in the app.
false Builder document, when one already exists.
Library folder the template belongs to — must be an existing, non-archived folder in the company. Governs who may edit the template.
Board the template is scoped to. Must be an existing, non-archived board in the company.
Uploaded file ids to attach.
Response
Template updated.
Show child attributes
Show child attributes