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.
Authorization
AuthorizationstringrequiredBody
application/json
fileNamestringrequiredThe name to store the file under. 1 to 250 characters.
fileSizeintegerrequiredThe exact size of the file in bytes. Must be at least 1.
contentTypestringrequiredThe MIME type of the file. 1 to 200 characters.
Response
200 · Where and how to upload the file.
sessionIdstringIdentifies the upload. Pass it back when you attach the file.
endpointstringThe absolute URL to upload the file bytes to.
methodstringThe HTTP method to use for the upload, such as POST.
fieldsobjectForm fields that must accompany the upload, exactly as given.
expiresstring · date-timeWhen 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.
- Ask for an upload session here. You get back an endpoint, a method, and a set of form fields.
- Upload the file bytes to that endpoint yourself, sending the form fields exactly as they were returned.
- Pass the
sessionIdwhen 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.