Attachments
Upload files once and attach them to email messages.
Attachments are files stored in your project's storage and attached to email messages. Sending with attachments is a two-step flow:
- Upload the file and keep its
id. - Send the message with the id in
attachmentIds.
See the guide for complete samples.
Upload rules
| Rule | Value |
|---|---|
| Request | multipart/form-data with one file in the field file. |
| Maximum file size | 10 MB (larger requests answer 413 or 422 attachment.too_large). |
| Allowed types | pdf, png, jpg, jpeg, gif, txt, csv, doc, docx, xls, xlsx, ppt, pptx, zip |
| Content check | The file content must match its extension (for example a real PDF for .pdf); executables are always rejected (422 attachment.type_not_allowed). |
| Empty files | Rejected (422 attachment.empty). |
| Storage | The project's default storage. Without one, uploads answer 422 storage.no_default. |
The response contains the attachment id, the sanitized fileName, contentType, sizeBytes and the sha256 of the
content. Uploading the same file twice creates two attachments.
Limits per message
- Only the
emailchannel accepts attachments (422 message.attachments_not_supported). - At most 10 attachments and 20 MB in total per message, including the template's attachments
(
422 message.attachments_too_large). - Ids must belong to the project (
404 attachment.not_found). Duplicate ids are attached once.
In the message, template attachments come first (source: "Template"), then your own (source: "Message").
Lifetime
Unused uploads expire
An attachment that is not used by a message or template within 24 hours of its upload is deleted automatically. Upload files right before sending.