Emails

Start an email attachment upload

Reserves an upload slot for a file you want to attach to an email, and returns where to upload it. Nothing is sent to anyone.

POST
https://api.portal.magicdoor.com/company-app/emails/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.

Body

application/json

fileNamestringrequired

The name to store the file under. 1 to 250 characters.

example: inspection-report.pdf
fileSizeintegerrequired

The exact size of the file in bytes. Must be at least 1.

example: 184320
contentTypestringrequired

The MIME type of the file. 1 to 200 characters.

example: application/pdf

Response

200 · Where and how to upload the file.

sessionIdstring

Identifies the upload. Pass it back when you attach the file.

endpointstring

The absolute URL to upload the file bytes to.

methodstring

The HTTP method to use for the upload, such as POST.

fieldsobject

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

expiresstring · date-time

When the session stops accepting the upload.

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

Attaching a file takes three calls. This is the first.

  1. Ask for an upload session here. You get back an endpoint, a method, and a set of form fields.
  2. Upload the file bytes to that endpoint yourself, sending the form fields exactly as they were returned.
  3. Pass the sessionId when you send the message, email, or announcement the file belongs to.

A session that is never used simply expires. Uploading the bytes does not deliver anything on its own — the file only reaches a recipient once you reference the sessionId in a send call.

One session works for any of the email send endpoints — pass its sessionId in attachmentSessionIds.