File attachments

Upload an attachment directly

Uploads a file and attaches it to a record in one multipart request, without an upload session.

Request an upload session, send the bytes to it, then call POST /company-app/file-attachments/{entityType}/{entityId} with the session id.
POST
https://api.portal.magicdoor.com/company-app/file-attachments/{entityType}/{entityId}

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

What kind of record the file hangs off. Written in the path in lower case, for example lease.

example: leaseleaseunitpropertyportfoliocompanytenantvendormaintenanceRequestworkOrderbilltransactionchatchatMessagepropertyManagerunknownrentalApplicationleaseTemplateleaseDocumentassociationViolationownerunitListingfileworkOrderGroup
entityIdstringrequired

The record the file hangs off, of the kind named by entityType. A Snowflake id sent as a decimal string.

example: 1830472847398404096

Body

multipart/form-data

filefilerequired

The file, sent as a multipart part named file. An empty part is refused.

descriptionstring

Note about the attachment.

shareTypesenum<string>[]

Which outside audiences may see the file. Repeat the part once per value. Only tenant, vendor and owner are allowed.

tenantvendorowner

Response

200 · The attachment that was created.

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 · No file was sent, the part was empty, or `shareTypes` held a value other than tenant, vendor or owner.

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