PUT/api/v1/projects/{project_id}/templates/{template_id}
update_template
Saves a new version of a template: its latest version’s number plus one, with the sources given; the name and kind stay.
- Call it
- to change a template; campaigns already launched keep the version they took.
- Needs
- an admin key with
project_id, or a project key with scopewrite(its own project; the argument is ignored), and sources that pass the checks ofcreate_template. A new version of a partial is checked on its own; the messages that include it take it at their next render and are refused then if it breaks them. - Returns
- the new version, the same as
PUT /api/v1/projects/{project_id}/templates/{template_id}.
Arguments
- object
-
html_bodystringrequiredThe HTML body of the new version.
-
template_idstring · uuidrequiredThe template’s id, as
create_templateorlist_templatesgave it. -
project_idstring · uuid | nullThe template’s project. An admin key must pass it; a project key’s own project is used and this is ignored.
-
subjectstring | nullThe subject of the new version.
-
text_bodystring | nullThe text body of the new version; null or left out: made from the HTML.
No other arguments are accepted.
Result
The result comes back as structuredContent, with the same JSON as a text block.
- object · all fields required
-
created_atstring · date-timeWhen this version was saved.
-
engineEngineOutputThe template engine.
- minijinja
-
html_bodystring -
idstring · uuidThe template’s id, the same in every version.
-
What a template is.
messageA message: subject, HTML, text.partialA fragment other templates include. -
namestring -
project_idstring · uuid -
subjectstring | nullnullfor a partial. -
text_bodystring | nullnull: the text is made from the HTML when the message is sent. -
versioninteger · uint32From 1, one more at each save.
≥ 0
Definitions
EngineOutput
The template engine.
string · enum
- minijinja
TemplateKindOutput
What a template is.
string · enum
message A message: subject, HTML, text.
partial A fragment other templates include.
Errors
A failed call answers isError: true with a code from the same table as the HTTP API, and detail. How tools report errors
HTTP API
The same operation over HTTP: PUT /api/v1/projects/{project_id}/templates/{template_id}