Letter document templates

Create a letter document template

Creates a Word-document letter template. Give it an upload session and it starts from the .docx you uploaded; leave the session out and it starts from a blank document. Requires the letter_templates:write permission.

POST
https://services.magicdoor.com/communications/company-portal/letter-templates/documents

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Body

application/json

namestring

The name shown to the property manager, and the file name given to the document. Up to 250 characters.

letterTemplateGroupIdstring

File the template under this group. A 64-bit number sent as a string.

uploadSessionIdstring

The sessionId from Start a document file upload, if you are starting from your own .docx. Leave it out and MagicDoor creates an empty Word document for the property manager to write in.

communicationChannelsenum<string>[]required

The kinds of recipient this template can be addressed to. Each value decides which placeholders the content may use — a lease template can use {{rent_amount}}, a vendor template cannot. When several are listed, only the placeholders every one of them offers are allowed.

tenantownervendorleasemaintenanceRequestworkOrderrentalApplicationpropertyManagercompany

Response

200 · The template that was created, with the URL of its file.

idstringrequired

The letter document template. A 64-bit number sent as a string.

letterTemplateGroupIdstring

The group this template is filed under. Absent while it is ungrouped.

namestring

The name shown to the property manager. Absent when the template was created without one.

communicationChannelsenum<string>[]required

The kinds of recipient this template can be addressed to.

tenantownervendorleasemaintenanceRequestworkOrderrentalApplicationpropertyManagercompany
documentIdstringrequired

The document that holds the Word file behind this template. Pass it to nothing else in this reference — it is the handle the editor uses.

createdstring · date-timerequired

When the template was created, in the company's timezone and with no offset.

updatedstring · date-timerequired

When the template row was last changed, in the company's timezone and with no offset.

filePublicUrlstringrequired

A URL that serves the template's current .docx file. Fetched fresh on every call, so read it from the response rather than storing it.

400 · `communicationChannels` is missing or empty.

401 · The access token is missing, expired, or not a property-manager token.

403 · The token is valid but the caller does not hold the `letter_templates:write` permission.

404 · `letterTemplateGroupId` names a group that does not exist, or belongs to another company.

422 · The upload session is unknown, expired, already used, or the file was never uploaded to it.

Unlike a letter template, the placeholders inside the .docx are not checked when the template is created. Ask List document placeholder keys for the keys the editor should offer.