Skip to main content
You can attach files to any message sent through the Email API. Attachments are added as an attachments array on the message, where each entry describes a single file.
The total size of all attachments must not exceed 50 MB per message. See Limits and overage rates for all sending limits.

Attachment fields

Each attachment is an object with three required fields:
FieldTypeDescription
fileNamestringName the recipient will see, including the extension (e.g. report.pdf).
contentTypestringValid MIME type for the file, e.g. application/pdf or text/plain.
contentstringThe file contents, Base64-encoded.

REST API example

Add the attachments array to the message body. The example below attaches a small text file (Hello World! Base64-encoded as SGVsbG8gV29ybGQh):
{
  "data": {
    "message": {
      "recipients": ["recipient@host.com"],
      "headers": {
        "subject": "Sample email with an attachment",
        "from": "sender@verifieddomain.com"
      },
      "content": {
        "text/plain": "Hello World!"
      },
      "attachments": [
        {
          "fileName": "hello_world.txt",
          "contentType": "text/plain",
          "content": "SGVsbG8gV29ybGQh"
        }
      ]
    }
  }
}
See the full Send a message reference for the complete request body.

SDK examples

Most Paubox SDKs accept attachments in the same fileName / contentType / content shape. The file content is always Base64-encoded.
import base64

with open('report.pdf', 'rb') as f:
    encoded = base64.b64encode(f.read()).decode('utf-8')

attachment = {
    'fileName':    'report.pdf',
    'contentType': 'application/pdf',
    'content':     encoded
}

# Pass attachments via the optional_headers dict
optional_headers = {
    'attachments': [attachment]
}
For language-specific details, see each SDK’s email client guide — for example the Python SDK or Node.js SDK.

Sending from the CLI

The Paubox CLI accepts files directly with the --attachment flag and handles the Base64 encoding for you:
paubox send \
  --from sender@verifieddomain.com \
  --to recipient@host.com \
  --subject "Sample email with an attachment" \
  --text "Hello World!" \
  --attachment report.pdf
See the CLI commands reference for all available flags.