Startseite / Doku / API-Referenz / API-Referenz: Vorlagen API-Referenz: Vorlagen 11 Endpunkte der Gruppe «Vorlagen». Die Referenz stammt aus der englischen OpenAPI-Spezifikation und ist nicht übersetzt.
List templates GET /v1/templates
Parameter Name Ort Typ Beschreibung limitquery integer Page size. The default and the maximum depend on the endpoint (emails 50 up to 500, received mail 50 up to 200, audit up to 200, the others 100 up to 500 or 1000). Default: 100 cursorquery string The next_cursor of the previous page. Opaque; pass it unchanged to the same endpoint with the same filters.
Beispiel curl "https://api.sendtide.ch/v1/templates" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 200 Templates Felder der Antwort dataarray<Template> data[].idstring data[].aliasstring data[].namestring data[].kindenum: visual | code data[].published_versioninteger | null data[].sub_allowboolean data[].draftTemplateVersion data[].draft.kindenum: visual | code data[].draft.styleobject data[].draft.langsobject data[].languagesarray<string> data[].updated_atstring (date-time) next_cursorstring | null
Create a template POST /v1/templates
Request-Body application/json Feld Typ Beschreibung aliasstring namestring kindenum: visual | code styleobject langsobject sub_allowboolean publishboolean notestring
Beispiel curl -X POST "https://api.sendtide.ch/v1/templates" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"alias":"welcome","name":"Willkommen","kind":"code","langs":{"de-CH":{"subject":"Willkommen, {{ data.name }}","html":"<p>Hallo {{ data.name }}</p>"}},"publish":true}' Antworten Status Beschreibung 201 Created Template Felder der Antwort idstring aliasstring namestring kindenum: visual | code published_versioninteger | null sub_allowboolean draftTemplateVersion draft.kindenum: visual | code draft.styleobject draft.style.accentstring draft.style.bgstring draft.style.fontstring draft.style.widthinteger draft.langsobject languagesarray<string> updated_atstring (date-time)
409 Fehler im üblichen Format, Fehler und Limits 422 Fehler im üblichen Format, Fehler und Limits
Get a template (draft and published version) GET /v1/templates/{id}
Parameter Name Ort Typ Beschreibung id * path string Alias or tpl_ id
Beispiel curl "https://api.sendtide.ch/v1/templates/welcome" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 200 The template Template Felder der Antwort idstring aliasstring namestring kindenum: visual | code published_versioninteger | null sub_allowboolean draftTemplateVersion draft.kindenum: visual | code draft.styleobject draft.style.accentstring draft.style.bgstring draft.style.fontstring draft.style.widthinteger draft.langsobject languagesarray<string> updated_atstring (date-time)
Change the draft (publish with "publish": true) PATCH /v1/templates/{id}
A language set to null is removed. Sending always uses the published version.
Parameter Name Ort Typ Beschreibung id * path string Alias or tpl_ id
Request-Body application/json Feld Typ Beschreibung aliasstring namestring kindenum: visual | code styleobject langsobject sub_allowboolean publishboolean notestring
Beispiel curl -X PATCH "https://api.sendtide.ch/v1/templates/welcome" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"langs":{"de-CH":{"subject":"Willkommen, {{ data.name }}"}},"publish":true}' Antworten Status Beschreibung 200 Updated Template Felder der Antwort idstring aliasstring namestring kindenum: visual | code published_versioninteger | null sub_allowboolean draftTemplateVersion draft.kindenum: visual | code draft.styleobject draft.style.accentstring draft.style.bgstring draft.style.fontstring draft.style.widthinteger draft.langsobject languagesarray<string> updated_atstring (date-time)
Delete a template DELETE /v1/templates/{id}
Parameter Name Ort Typ Beschreibung id * path string Alias or tpl_ id
Beispiel curl -X DELETE "https://api.sendtide.ch/v1/templates/welcome" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 204 Deleted
Publish the draft as a new version POST /v1/templates/{id}/publish
Parameter Name Ort Typ Beschreibung id * path string
Request-Body application/json Feld Typ Beschreibung notestring
Beispiel curl -X POST "https://api.sendtide.ch/v1/templates/welcome/publish" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{}' Antworten Status Beschreibung 200 Published Template Felder der Antwort idstring aliasstring namestring kindenum: visual | code published_versioninteger | null sub_allowboolean draftTemplateVersion draft.kindenum: visual | code draft.styleobject draft.style.accentstring draft.style.bgstring draft.style.fontstring draft.style.widthinteger draft.langsobject languagesarray<string> updated_atstring (date-time)
Render a preview with data POST /v1/templates/{id}/render
Parameter Name Ort Typ Beschreibung id * path string
Request-Body application/json Feld Typ Beschreibung dataobject localestring versionstring "draft", "published" or a version number Default: "draft" Example: 3 contentTemplateVersion Unsaved working copy to render instead of a stored version content.kindenum: visual | code content.styleobject content.style.accentstring content.style.bgstring content.style.fontstring content.style.widthinteger content.langsobject
Beispiel curl -X POST "https://api.sendtide.ch/v1/templates/welcome/render" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"version":"3"}' Antworten Status Beschreibung 200 Rendered Felder der Antwort localestring subjectstring htmlstring textstring missing_variablesarray<string>
Send a test mail POST /v1/templates/{id}/test
Renders the template and sends one mail with "[Test]" before the subject. Needs a key with send rights.
Parameter Name Ort Typ Beschreibung id * path string
Request-Body application/json Feld Typ Beschreibung from * string Example: Shop <hallo@example.ch> to * string (email) dataobject localestring versionstring "draft" (default), "published" or a version number contentTemplateVersion Unsaved working copy content.kindenum: visual | code content.styleobject content.style.accentstring content.style.bgstring content.style.fontstring content.style.widthinteger content.langsobject attachmentsarray<Attachment> Files sent with the test mail attachments[].filename * string Sanitized: path and control characters are removed. Executable and script files are refused. Example: rechnung.pdf attachments[].content * string (base64) attachments[].content_typestring Taken from the file extension if missing Example: application/pdf attachments[].content_idstring Makes the file an inline image; the HTML refers to it as src="cid:logo" Example: logo attachments[].dispositionenum: attachment | inline Default inline with a content_id, else attachment streamstring
Beispiel curl -X POST "https://api.sendtide.ch/v1/templates/welcome/test" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"from":"Shop <hallo@example.ch>","to":"anna@example.com"}' Antworten Status Beschreibung 202 Queued EmailAccepted Felder der Antwort idstring Example: msg_8kq2m4bt statusenum: queued | suppressed | held send_atstring (date-time) held_reasonenum: bulk_review Only when the status is held: the mail was accepted but waits for a review of the platform (see Held mail)
422 Fehler im üblichen Format, Fehler und Limits
List published versions, newest first GET /v1/templates/{id}/versions
Parameter Name Ort Typ Beschreibung id * path string
Beispiel curl "https://api.sendtide.ch/v1/templates/welcome/versions" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 200 Versions Felder der Antwort dataarray<TemplateVersionInfo> data[].versioninteger data[].notestring data[].publishedboolean This is the version that mail is sent with data[].created_atstring (date-time) data[].contentTemplateVersion Only when getting one version data[].content.kindenum: visual | code data[].content.styleobject data[].content.langsobject
Get one version with its content GET /v1/templates/{id}/versions/{version}
Parameter Name Ort Typ Beschreibung id * path string version * path string A number or "published"
Beispiel curl "https://api.sendtide.ch/v1/templates/welcome/versions/3" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 200 The version TemplateVersionInfo Felder der Antwort versioninteger notestring publishedboolean This is the version that mail is sent with created_atstring (date-time) contentTemplateVersion Only when getting one version content.kindenum: visual | code content.styleobject content.style.accentstring content.style.bgstring content.style.fontstring content.style.widthinteger content.langsobject
404 Fehler im üblichen Format, Fehler und Limits
Copy a version into the draft POST /v1/templates/{id}/versions/{version}/restore
The published version stays until the draft is published again.
Parameter Name Ort Typ Beschreibung id * path string version * path string
Beispiel curl -X POST "https://api.sendtide.ch/v1/templates/welcome/versions/3/restore" \
-H "Authorization: Bearer sk_test_…" Antworten Status Beschreibung 200 Draft restored Template Felder der Antwort idstring aliasstring namestring kindenum: visual | code published_versioninteger | null sub_allowboolean draftTemplateVersion draft.kindenum: visual | code draft.styleobject draft.style.accentstring draft.style.bgstring draft.style.fontstring draft.style.widthinteger draft.langsobject languagesarray<string> updated_atstring (date-time)