Upload a file
Uploads one file as multipart form data and returns its id and paths. The file is stored on its own, not yet attached to any record — pass the returned id to whatever you want to attach it to.
Authorization
AuthorizationstringrequiredBody
multipart/form-data
Send this as multipart/form-data, not JSON. The nested allowedSize values are separate form fields named allowedSize.start and allowedSize.end.
filefilerequiredThe file itself. Must not be empty, and must not exceed 100 MB — that ceiling is fixed and allowedSize can only lower it, never raise it.
allowedTypesstring[]Refuse the upload unless its detected MIME type matches one of these. Each entry is an exact type such as application/pdf, a subtype wildcard such as image/*, or * for anything. Repeat the field once per pattern, and send at least one when you use it. Leave it out to accept any type.
allowedSizeobjectRefuse the upload unless its size in bytes falls in this range. Sent as the form fields allowedSize.start and allowedSize.end.
Response
200 · The stored file
idstringThe new file's id, a Snowflake sent as a decimal string. This is what you hand to whatever should own the file.
namestringThe file name taken from the upload, with any path stripped off.
sizeintegerHow large the stored file is, in bytes.
contentTypestringThe MIME type MagicDoor worked out by inspecting the content, not the one your form claimed. It can differ from what you sent.
secureUrlobjectWhere to fetch the file back. Both paths need an access token.
400 · No file, an empty file, a file over the size ceiling, a size outside `allowedSize`, or a detected type not in `allowedTypes`
401 · The access token is missing, expired, or invalid
It still works and is still supported, but it is marked obsolete in MagicDoor's source and will be removed. Nothing replaces it in this reference yet — if you are building on it, tell support so the change can be planned around you.
An upload here is stored with no category and no owning record, and is not claimed by anything. It is a staging step: upload first, get an id back, then send that id to whichever endpoint creates or updates the record the file belongs to.
Both allowedTypes and allowedSize are guardrails you set for yourself. They are optional, and if you leave them out the only limit is the fixed 100 MB ceiling.
MagicDoor reads the content to decide the MIME type and ignores the one in your multipart part. allowedTypes is checked against the detected type, so a .pdf that is really a JPEG is rejected by allowedTypes=application/pdf, and the contentType in the response can differ from what you sent.