Send a new message
const url = 'https://mail.work.optidata.cloud/api/mail/mailboxes/78/messages';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"draft_id":918,"to":["john.roe@example.com"],"cc":[],"bcc":[],"subject":"Quarterly report","body":"<p>Hi John, the report is attached.</p>","is_read_receipt_enabled":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://mail.work.optidata.cloud/api/mail/mailboxes/78/messages \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "draft_id": 918, "to": [ "john.roe@example.com" ], "cc": [], "bcc": [], "subject": "Quarterly report", "body": "<p>Hi John, the report is attached.</p>", "is_read_receipt_enabled": false }'Send a message that has already been saved as a draft. Save the body and
attachments with the draft endpoint first, then send the resulting
draft_id here together with the envelope.
Delivery is queued, so a 200 means “accepted for sending”, not
“delivered”. The draft moves to a queued state and disappears from the
Drafts folder. Per-user sending limits apply; exceeding one answers 422.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Id of the mailbox. Every mailbox the caller may use is listed in their account.
Request Bodyrequired
Section titled “Request Bodyrequired”The envelope of a message to send. The body and its files come from the
draft named by draft_id.
object
Id of the saved draft carrying the body and the attachments.
Recipient addresses. At least one is required.
HTML body.
Send date. Defaults to now.
Examples
{ "draft_id": 918, "to": [ "john.roe@example.com" ], "cc": [], "bcc": [], "subject": "Quarterly report", "body": "<p>Hi John, the report is attached.</p>", "is_read_receipt_enabled": false}Responses
Section titled “ Responses ”The message was accepted for sending. The record returned is the queued message, not a delivery confirmation.
A message accepted for sending.
object
How an outgoing message came to be.
The HTML body the message was sent with.
One participant of a message.
object
Display name, when one is known.
The role the address plays: f sender, t recipient, c carbon copy,
b blind copy, r reply-to.
One participant of a message.
object
Display name, when one is known.
The role the address plays: f sender, t recipient, c carbon copy,
b blind copy, r reply-to.
One participant of a message.
object
Display name, when one is known.
The role the address plays: f sender, t recipient, c carbon copy,
b blind copy, r reply-to.
One participant of a message.
object
Display name, when one is known.
The role the address plays: f sender, t recipient, c carbon copy,
b blind copy, r reply-to.
Examples
{ "id": 5120, "mailbox_id": 78, "type": "new", "subject": "Quarterly report", "body": "<p>Hi John, the report is attached.</p>", "date": "2026-08-19T13:02:11.000000Z", "is_read_receipt_enabled": false, "reply_server_message_id": null, "from": [ { "name": "Jane Doe", "email": "jane.doe@acme.example" } ], "to": [ { "name": "John Roe", "email": "john.roe@example.com" } ], "cc": null, "bcc": null, "created_at": "2026-08-19T13:02:11.000000Z", "updated_at": "2026-08-19T13:02:11.000000Z"}Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The caller may not act on this mailbox, user or resource.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "This action is unauthorized."}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The conversations field is required.", "errors": { "conversation_ids": [ "The conversations field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}The mail platform did not answer as expected — a folder or message that
does not exist, or a transient failure. reference is the code to quote to
support and fault_code names the underlying condition. A 503 with the
same envelope means the platform is in maintenance; retry shortly.
Failure raised by the mail platform behind the API rather than by the request itself.
object
What went wrong, phrased for the end user.
Repeats the HTTP status code.
Suggested next step.
Support reference, e.g. MZ-502.
Names the underlying condition, e.g. mail.NO_SUCH_FOLDER.
Examples
Unknown folder
{ "error": "The mail server did not answer as expected, so this action could not be completed.", "status": 502, "help": "If the problem persists, contact support and inform the error code above.", "reference": "MZ-502", "fault_code": "mail.NO_SUCH_FOLDER"}Unknown message
{ "error": "The mail server did not answer as expected, so this action could not be completed.", "status": 502, "help": "If the problem persists, contact support and inform the error code above.", "reference": "MZ-502", "fault_code": "mail.NO_SUCH_MSG"}