Leases

Attach a file to a lease

Attaches an already-uploaded file to the lease. Get the uploadSessionId from the upload-session endpoint and upload the bytes there first; this call only records the attachment.

POST
https://api.portal.magicdoor.com/company-app/leases/{leaseId}/files

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

leaseIdstringrequired

The lease to attach the file to. A Snowflake id, sent as a decimal string.

example: 1830472847398404096

Body

application/json

uploadSessionIdstringrequired

The upload session the file was sent to. A Snowflake id, sent as a decimal string.

descriptionstring

Note about the file. 1 to 1000 characters.

shareTypesenum<string>[]

Who outside the company portal can see the file. Only tenant, vendor and owner are accepted.

tenantvendorowner

Response

200 · The file attachment that was created.

idstring

Id of the attachment. Use this to update or remove it. A Snowflake id, sent as a decimal string.

fileNamestring

Display name of the attachment.

descriptionstring

Note about the file.

createdstring · date-time

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

uploaderNamestring

Name of whoever uploaded it.

uploaderTypestring

What kind of user uploaded it, for example PropertyManager.

shareTypesstring[]

Who outside the company portal can see it.

relationTypeenum<string>

What the file is attached to. Always lease here.

lease
relationIdstring

Id of the thing it is attached to. A Snowflake id, sent as a decimal string.

fileobject

The stored file.

fileIdstringdeprecated

Use file.id.

fileUrlstringdeprecated

Use file.secureUrl.raw.

fileThumbUrlstringdeprecated

Use file.secureUrl.variantTemplate.

fileSizeBytesintegerdeprecated

Use file.size.

propertyIdstringdeprecated

Use relationId with relationType.

leaseIdstringdeprecated

Use relationId with relationType.

400 · The body failed validation — for example `shareTypes` contains something other than `tenant`, `vendor` or `owner`.

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

404 · No lease or upload session matched the id, or it belongs to another company.