Emails

Create an attachment upload

POST/v1/attachmentsrequires email:send

Reserves a slot for a file and returns a URL to PUT it to, so the file never travels inside the send request. Upload the raw bytes with the headers given, then send an email whose attachments names the slot by upload_id.

One upload can be referenced by any number of sends until it expires. Files are at most 7340032 bytes (7 MB); the message as a whole is capped at 10 MB after encoding.

Requestcurl -X POST https://api.transmit.dev/v1/attachments \
  -H "Authorization: Bearer tr_v2_…" \
  -H "Content-Type: application/json" \
  -d '{
       "filename": "invoice-1042.pdf",
       "type": "application/pdf",
       "size_bytes": 184320
     }'

Body

FieldTypeNotes
filename requiredstring1–255 characters
type requiredstringMIME type, sent as the object's Content-Type. 1–255 characters
size_bytes requiredintegerExact size of the file in bytes, at most 7340032. The upload must match it.. 1–7340032

Responses

StatusMeaning
201The slot, with the URL and headers for the PUT
401The API key is missing, malformed, expired or revoked
403The API key lacks the email:send scope
422The request failed validation, or the file is over the size limit

Every response body is described in the OpenAPI spec, which this page is generated from.