Leases

Request an upload session for a custom-field file

Starts an upload for a file that will become the value of a file-reference custom field on this lease. Upload the file to the endpoint you get back, then pass the sessionId as referenceFileUploadSessionId when you set the value.

POST
https://api.portal.magicdoor.com/company-app/leases/{leaseId}/custom-fields/{customFieldId}/upload-sessions

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 the custom field is on. A Snowflake id, sent as a decimal string.

example: 1830472847398404096
customFieldIdstringrequired

The file-reference custom field the file is for. A Snowflake id, sent as a decimal string.

example: 1851019384756201984

Body

application/json

Describe the file you are about to upload for this custom field.

fileNamestringrequired

Name to store the file under. 1 to 250 characters.

example: inspection-report.pdf
fileSizeintegerrequired

Size of the file in bytes. At least 1.

example: 284193
contentTypestringrequired

MIME type of the file. 1 to 200 characters.

example: application/pdf

Response

200 · Where to send the file.

sessionIdstring

Id of the upload session. Pass this back when you attach the finished file. A Snowflake id, sent as a decimal string.

endpointstring

Absolute URL to send the file to.

methodstring

HTTP method to use against endpoint.

fieldsobject

Form fields that must accompany the upload, exactly as given.

expiresstring · date-time

When the session stops accepting the upload, in the company's timezone.

400 · The request failed validation. `errors` maps each field name to what was wrong with it.

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

404 · No lease or custom field matched the id, or it belongs to another company.

How an upload works

Uploading is three calls. Ask for an upload session here, POST the file itself to the endpoint the session names with the fields it gives you, then hand the sessionId back to the endpoint that attaches the file. This endpoint does not receive the file.