Retrieve email template setup details for editing

PUT /api/communications/email-template-setup

Success: 200 OK

Overview

Returns the setup details of an email template that already exists — its saved HTML, its editor configuration and the merge placeholders available to it — so an editor can reopen it.

The verb is PUT, but the call changes nothing. It is the read counterpart of Create and retrieve email template setup details, which creates a template and returns the same payload; use that one once, then this one every time the template is reopened. The identifier goes in the body, not the path.

The placeholder list is rebuilt on each call from the query the template is bound to, rather than stored with the template, so a template picks up changes to its query's available fields the next time it is loaded. The template must still be bound to a query; one that has lost its query cannot be loaded at all.

Endpoint

PUT {base_url}/api/communications/email-template-setup

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Request body

FieldTypeRequiredDescription
templateIdinteger (int32)YesThe template to load, as returned in templateId by Create and retrieve email template setup details. The template must exist, or the call fails with 404; it must also still reference a query, or the call fails with 400. Unlike the create call, no query or template type is sent — both are read from the stored template.

Sample request

cURL
curl -X PUT '{base_url}/api/communications/email-template-setup' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "templateId": 12345
}'

Response fields

FieldTypeDescription
closeDelimiterstringThe marker that closes a placeholder inside html. Always ]]; it never varies.
configstringThe editor configuration JSON saved alongside the template's HTML, returned verbatim. null when no content has ever been saved for this template.
descriptionstringThe template's stored description.
openDelimiterstringThe marker that opens a placeholder inside html. Always [[ — so a placeholder is written [[PlaceholderName]].
placeholdersstringThe merge fields available to this template, as one comma-separated string of Label:Placeholder pairs — show the label to a user, write the second half between the delimiters. Rebuilt on every call from the fields of the tables the template's query reads, plus the tenant's custom fields. If that query is raw SQL rather than a query-builder definition, its own column names are appended as name:name pairs.
templateIdstringThe template you asked for, echoed back as a string.
queryIdstringThe query the template is bound to, as a string. Taken from the saved template — you cannot set it through this call.
templateNamestringThe template's saved description. It is the same value as description, so for an existing template the two fields always match.
templateTypeIdstringThe template type this template belongs to, returned as a string.
htmlstringThe template's saved HTML body, placeholder markers included. An empty string when no content has been saved for it yet.
previewOnlybooleanPart of the editor payload; this endpoint never sets it, so it is always false.

Sample response

200 OK
{
  "closeDelimiter": "string",
  "config": "string",
  "description": "string",
  "openDelimiter": "string",
  "placeholders": "string",
  "templateId": "string",
  "queryId": "string",
  "templateName": "string",
  "templateTypeId": "string",
  "html": "string",
  "previewOnly": false
}

Errors

StatusMeaningWhen
400Bad requesttemplateId is absent (TemplateId must be specified), or the template exists but has no query associated with it (Template for Id {templateId} has no associated query.).
404Not foundNo template with that id (Template Detail for Id {templateId} does not exist.), or the query the template is bound to no longer exists (Query with id {queryId} does not exist.).
500Internal server errorAn unexpected failure while reading the template, its query or its placeholder list.

This page as markdown · All pages · llms.txt