# Retrieve email template setup details for editing

`PUT /api/communications/email-template-setup`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Retrieve email template setup details for editing](https://support.gladstonesoftware.cloud/reference/communications/retrieve-email-template-setup-details-for-editing)

## 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](create-and-retrieve-email-template-setup-details.md), 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](../../guides/authenticating-with-gladstone-apis.md).

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `templateId` | integer (int32) | Yes | The template to load, as returned in `templateId` by [Create and retrieve email template setup details](create-and-retrieve-email-template-setup-details.md). 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

```bash title="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

| Field | Type | Description |
|-------|------|-------------|
| `closeDelimiter` | string | The marker that closes a placeholder inside `html`. Always `]]`; it never varies. |
| `config` | string | The editor configuration JSON saved alongside the template's HTML, returned verbatim. `null` when no content has ever been saved for this template. |
| `description` | string | The template's stored description. |
| `openDelimiter` | string | The marker that opens a placeholder inside `html`. Always `[[` — so a placeholder is written `[[PlaceholderName]]`. |
| `placeholders` | string | The 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. |
| `templateId` | string | The template you asked for, echoed back as a string. |
| `queryId` | string | The query the template is bound to, as a string. Taken from the saved template — you cannot set it through this call. |
| `templateName` | string | The template's saved description. It is the same value as `description`, so for an existing template the two fields always match. |
| `templateTypeId` | string | The template type this template belongs to, returned as a string. |
| `html` | string | The template's saved HTML body, placeholder markers included. An empty string when no content has been saved for it yet. |
| `previewOnly` | boolean | Part of the editor payload; this endpoint never sets it, so it is always `false`. |

## Sample response

```json title="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

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `templateId` 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.`). |
| `404` | Not found | No 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.`). |
| `500` | Internal server error | An unexpected failure while reading the template, its query or its placeholder list. |
