File attachments

Generate an attachment from a letter template

Renders one of the company's letter templates to PDF for a tenant, an owner or a vendor, and attaches the result to that record. Only those three kinds of record are supported.

POST
https://api.portal.magicdoor.com/company-app/file-attachments/{entityType}/{entityId}/from-template

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.

Path parameters

entityTypeenum<string>required

Which kind of record to render the letter for. Only these three work; anything else returns 400.

example: tenanttenantownervendor
entityIdstringrequired

The tenant, owner or vendor to render the letter for, and attach it to. A Snowflake id sent as a decimal string.

example: 1830472847398406006

Body

application/json

letterDocumentTemplateIdstringrequired

The letter template to render. A Snowflake id sent as a decimal string.

fileNamestring

Name to store the generated PDF under, 3 to 250 characters. Falls back to the rendered document's own name, and to document.pdf if that is missing.

Response

200 · The attachment holding the generated PDF.

idstring

The attachment. A Snowflake id sent as a decimal string. Different from file.id, which is the stored file.

fileNamestring

Name shown for the attachment.

descriptionstring

Note about the attachment. Absent when none was set.

createdstring · date-time

When the file was attached, in the company's timezone.

uploaderNamestring

Name of whoever attached it. Absent when it is not known.

uploaderTypestring

What kind of user attached it, written in PascalCase: System, MagicDoor, PropertyManager, Tenant, Vendor or Owner. Absent when it is not known.

shareTypesstring[]

Which outside audiences can see the file, written in PascalCase: Tenant, Vendor or Owner. Empty when it is internal only.

relationTypeenum<string>

What kind of record the file hangs off.

leaseunitpropertyportfoliocompanytenantvendormaintenanceRequestworkOrderbilltransactionchatchatMessagepropertyManagerunknownrentalApplicationleaseTemplateleaseDocumentassociationViolationownerunitListingfileworkOrderGroup
relationIdstring

The record the file hangs off.

fileobject

The stored file itself.

fileIdstringdeprecated

Same value as file.id.

fileUrlstringdeprecated

Pre-signed URL for the file. Use file.secureUrl.raw instead.

fileThumbUrlstringdeprecated

Pre-signed thumbnail URL. Use file.secureUrl.variantTemplate instead.

fileSizeBytesintegerdeprecated

Same value as file.size.

propertyIdstringdeprecated

Set to relationId when relationType is property, otherwise absent. Use relationType and relationId.

leaseIdstringdeprecated

Set to relationId when relationType is lease, otherwise absent. Use relationType and relationId.

400 · `entityType` was something other than tenant, owner or vendor.

401 · The access token is missing, expired, or not valid for this company.

The template's placeholders are filled from the record named in the path. Signature fields are not extracted; the result is a flat PDF, not a document to be signed.

The new attachment starts with no description and no share types. Use the update and share-type endpoints to change either.