Download a file
Fetches the file itself. The response is not the bytes but a 302 redirect to a short-lived signed storage URL, so any HTTP client that follows redirects gets the content.
Authorization
AuthorizationstringrequiredPath parameters
fileIdstringrequiredThe file to fetch, as a Snowflake id in decimal-string form. Must be a positive whole number.
filenamestringAn optional trailing segment that renames the file for this download only — nothing is renamed in MagicDoor. Leave the whole segment off and the stored name is used. When you do send it, it must be 3 to 200 characters, and it must be URL-escaped.
Query parameters
downloadbooleantrue makes the storage URL send Content-Disposition: attachment, so a browser saves the file instead of displaying it. Leave it off and browsers show what they can inline.
Response
302 · Redirect to the signed storage URL that holds the content
LocationstringThe signed storage URL. It is valid for seven days and needs no MagicDoor access token of its own, so treat it as a secret. There is no response body.
401 · The access token is missing, expired, or invalid
404 · No such file, the file has been deleted, or it belongs to another company
The first request is to MagicDoor and needs your access token. The second is to storage and is authorised by the signature in the URL. Most clients handle both for you — cURL needs --location, and fetch follows redirects by default.
Do not send your MagicDoor Authorization header on to the storage URL. Some clients strip it across hosts and some do not; storage does not want it either way.
The trailing filename segment is a display name for this one download. With download=true it becomes the name the browser saves the file under; without it, it mostly just makes the URL readable. It never changes anything stored in MagicDoor, and the file is still found by its id whatever you put there.