Skip to Content
Notification APIDocs

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:

  1. Upload the file and keep its id.
  2. Send the message with the id in attachmentIds.

See the guide for complete samples.

Upload rules

RuleValue
Requestmultipart/form-data with one file in the field file.
Maximum file size10 MB (larger requests answer 413 or 422 attachment.too_large).
Allowed typespdf, png, jpg, jpeg, gif, txt, csv, doc, docx, xls, xlsx, ppt, pptx, zip
Content checkThe file content must match its extension (for example a real PDF for .pdf); executables are always rejected (422 attachment.type_not_allowed).
Empty filesRejected (422 attachment.empty).
StorageThe 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 email channel 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.

  • Once a message uses an attachment, the attachment is kept with the message and cannot be deleted (422 attachment.in_use).
  • You can delete an attachment that no message or template uses.
  • Download streams the file with its stored content type as a download (Content-Disposition: attachment).

On this page