Attachments and Images
ScaiSend handles binary content in two ways: attachments (file downloads included with the message) and images (visual content rendered inside the email). This page covers both, including the image library that lets you upload once and reuse across templates.
Attachments#
Attachments are base64-encoded in the request body. Use for PDFs, CSVs, spreadsheets, or any file the recipient should download.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Attachment fields#
| Field | Type | Required | Notes |
|---|---|---|---|
content |
string (base64) | Yes | Binary file content, base64-encoded |
filename |
string | Yes | 1–255 chars; what the recipient sees in their mail client |
type |
string | No | MIME type; defaults to application/octet-stream |
disposition |
string | No | attachment (default) or inline |
content_id |
string | Conditional | Required for disposition: inline; the "CID" used to reference from HTML |
Limits#
- Max 10 attachments per message.
- Total serialized body (including base64) must be ≤ 20 MB. Base64 inflates binary by ~33%, so a 15 MB PDF plus a modest HTML body is fine; a 20 MB binary won't fit.
- For very large files (> 15 MB binary), host them externally and link from the email body.
Inline attachments for embedded images#
A classic use case: embed a company logo in the HTML so the email displays correctly even when images are blocked by default.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
The HTML references cid:logo; the attachment's content_id is logo. Mail clients resolve the CID and render the embedded image without fetching anything from the network.
This works but makes every message heavier. For images you reuse across many sends, use the image library.
The image library#
Upload an image once; reference it from any template or ad-hoc send. ScaiSend handles the serving, and — with the proxy embed mode — uses image loads as a backup open signal.
Upload#
1 2 3 4 5 | |
1 2 3 4 5 6 7 8 9 10 11 | |
1 2 3 4 5 6 7 8 9 10 11 12 | |
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
- Max file size: 10 MB.
- Supported formats: JPEG, PNG, GIF, WebP.
folderis optional; use it to organize assets ("brand", "marketing-q2", etc.).
Reference in HTML#
Use the returned url as any ordinary <img src="...">:
1 | |
Two embedding modes#
The tenant's image_embed_mode setting controls how ScaiSend treats /i/... URLs when the email goes out:
| Mode | Behavior |
|---|---|
proxy (default) |
The URL stays as-is in the HTML. The recipient's client fetches it on demand. Each fetch is recorded as a possible-open signal. Smaller emails; requires the recipient to have internet access when viewing. |
cid |
ScaiSend downloads the image server-side, converts it to a Content-ID inline attachment, and rewrites the <img src> to cid:.... Bigger emails; works offline; no image-load tracking. |
Set per tenant:
1 2 3 4 | |
See Tracking for the full discussion.
Listing, updating, deleting#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Deleting an image doesn't affect emails already sent — those messages have either embedded the image as CID (if you were on cid mode) or stored the URL (which continues to resolve at /i/img_01HXYZ?tombstone=true, returning a 410 Gone for future requests).
The public image proxy#
GET /i/{image_id} serves images without authentication. It's designed to be the src value in email HTML.
Three reasons to use the proxy rather than linking to S3 or a CDN directly:
- Your backend storage URL is hidden. Recipients see only
scaisend.scailabs.ai/i/.... You can migrate the underlying store without changing any email HTML. - Image loads are logged. If a recipient opens an email with images enabled, the proxy records a possible-open event. It's a backup signal when the tracking pixel is blocked.
- Caching headers are set correctly. ScaiSend sends
Cache-Control: public, max-age=31536000, immutable, which keeps image content in downstream CDNs without repeatedly hitting origin.
HEAD requests work — useful for preflight or link-checking tooling.
What about raw URLs to your own server?#
You can, of course, just point <img src> at an image on your own server or CDN. ScaiSend doesn't require you to use its image library. But two things to keep in mind:
- You lose the backup-open signal. Only tracked resources (the pixel and
/i/proxy) count as opens. - You own the hotlink problem. A popular email means millions of hits against your origin. Make sure it's cached.
For one-off images (a personalized chart, a QR code), hosting on your own infrastructure is fine. For recurring brand assets, use the image library.
What's next#
- Sending Mail — the top-level request with attachments.
- Templates — referencing images in template HTML.
- Tracking — how image embedding modes affect tracking.