Send Attachments

Attachments in bluefox.email allow you to include files in your emails. These files are specified as an array of objects, with each object representing a single attachment. Attachments can be used in both transactional and triggered emails.

WARNING

Attachments are cached for 1 hour. If your email sending process is expected to take longer than an hour, please contact our support team to ensure uninterrupted delivery.

Attachment Object Structure

Each attachment object includes the following fields:

FieldTypeDescriptionRequired
fileNameStringThe name of the file, including the file extension (e.g., report.pdf).Yes
contentStringThe file content encoded in Base64 format.Yes

Example

Here’s an example of how to structure attachments:

json
{
  "attachments": [
    {
      "fileName": "example.txt",
      "content": "Ymx1ZWZveC5lbWFpbCBhdHRhY2htZW50IGV4YW1wbGUh"
    }
  ]
}

API Responses

CodeNameMessageDescriptionJSON Response Example
400VALIDATION_ERRORInvalid attachments format. Ensure each attachment has a filename with an extension and content type base64.Attachments must have valid filenames and be encoded in base64.json { "status": 400, "error": { "name": "VALIDATION_ERROR", "message": "Invalid attachments format. Ensure each attachment has a filename with an extension and content type base64." } }

Frequently Asked Questions

Which email types support file attachments in BlueFox Email?

Attachments are supported for both transactional emails and triggered emails sent via the API. Each attachment is passed as an object in the attachments array of the request body.

How do I format attachments in the API request?

Each attachment is an object with two required fields: fileName (the file name including extension, for example report.pdf) and content (the file content encoded as a Base64 string). Include the attachments array in the same request body as the email and transactionalId or triggeredId fields.

Is there a time limit for how long attachments are cached?

Yes. Attachments are cached for 1 hour. If your email sending process is expected to take longer than one hour to complete, contact BlueFox Email support to arrange uninterrupted delivery.

Can I send multiple attachments in a single email?

Yes. The attachments field is an array, so you can include as many attachment objects as needed in a single request. Each object requires its own fileName and Base64-encoded content.