Sending Emails via BioT API

To send an email using the BioT API:

  • If no attachments are needed, simply call the sendEmail endpoint.
  • If you want to include attachments, first upload each file using the addAttachment endpoint, then reference it in the sendEmail request.

Upload the Attachment

Use the Add Attachment endpoint.

Request:

Use multipart/form-data to upload the file. This is similar to how file uploads work in HTML forms. The uploaded file must be passed using the file field.

Response:

A successful upload returns a JSON object that includes a unique key for the uploaded file:

{
  "key": "report.pdf"
}

Send the Email

Use Send Email endpoint.

With Attachments (Optional)

Include the attachmentsKeysAndNames field in your payload only if your email includes attachments.
Each attachment requires:

  • key: the file key received from the upload step
  • value: the desired file name shown to the recipient
{
  "to": ["[email protected]"],
  "subject": "Monthly Report",
  "body": "Please find the report attached.",
  "attachmentsKeysAndNames": {
      "report.pdf": "report"
  }
}

Notes:

  • Attachments are optional. Only include the attachmentsKeysAndNames field when needed.
  • Uploaded files are deleted after the email is sent. To reuse a file, you must re-upload it.
  • Each attachment must be uploaded individually before being referenced in the email request.