Templates

Create a template

Creates a communication template.

The acting user — the delegate token's own user, or the body userId when authenticating with an API key or partner token — must belong to the company and hold the setup or setup_communication_templates permission.

Only plain templates can be created here — htmlBuilder must be false or omitted.

attachmentIds are resolved against the company's uploaded files, stored on the template as full attachment entries, and tied to it so the detached-upload cleanup leaves them alone — ids that no longer resolve are dropped. A pdf template's subject becomes a file name, so characters that are illegal in one are stripped.

Merge fields

subject and content may contain merge placeholders, which are replaced with the recipient's, board card's or company's own values when the template is sent.

Fetch the available fields from GET /api/board/{boardId}/merge-fields for the board the template is used with. Every item in that response is { label, value } — label is what to show a human, value is what goes inside the braces:

{{firstname}}
{{Locations["Rent"]}}
{{customFields.7Lq2.LoyaltyTier}}

A placeholder may carry a fallback, used when the field is empty or unknown:

{{firstname || fallback: there}}        ->  "there" when the contact has no first name
{{Locations["Rent"] || fallback: TBD}}  ->  "TBD" when the card has no rent
{{firstname || fallback: }}             ->  renders nothing at all

Everything after fallback: up to the closing braces is the fallback text, and an empty one (or _blank) renders nothing.

Placeholders are shape-checked on write — an unclosed {{, an empty field name, or a malformed bracket reference such as Locations["Rent] is rejected with 400. Whether the field exists is not checked: an unknown field is normal (boards differ), and simply renders as its fallback at merge time.

post/api/templates

Request

Request body

companyIdstring

Required with a partner token; resolved from an API key or delegate token.

userIdstring

The acting user. Required with an API key or partner token; a delegate token supplies its own.

namestring required
descriptionstring required
templateType'sms' | 'email' | 'form' | 'eSignature' | 'pdf' required

Template kind. blockDocument is not accepted — it is an internal type for document blocks, not a user-facing template.

subjectstring required

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.

contentstring required

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.

htmlBuilderfalse

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.

builderDataobject

Builder document, when one already exists.

folderIdstring

Library folder the template belongs to — must be an existing, non-archived folder in the company. Governs who may edit the template.

aptletUuidstring

Board the template is scoped to. Must be an existing, non-archived board in the company.

signaturestring
attachmentIdsstring[]

Uploaded file ids to attach.

Response

Template created.

Changes

No recorded changes to this operation across all 1 revision of this API.