/v1/workspaces/{workspace_id}/mailboxes/{id}/threadsAuthStart a conversation from a mailbox
Sends a new email from the mailbox (`From: <display name> <mailbox address>`) and opens a thread for it: answers to it join that thread. Same send rules as `POST /emails`. Needs `mail.send` on the mailbox.
Path parameters
workspace_id*string · uuidId of the workspace.
id*string · uuidMailbox id.
Headers
Idempotency-KeystringOpaque client-generated string (1–256 chars, `[A-Za-z0-9._:-]`) used to deduplicate retries within a 24h window. A retry with the same key and body returns the original response with `Idempotent-Replay: true`.
Request body
htmlstringHTML body. At least one of `html` and `text`. With no `text`, the plain-text part is derived from it.
Example: "<p>Thanks, the refund is on its way.</p>"
textstringPlain-text body. At least one of `html` and `text`.
Example: "Thanks, the refund is on its way."
ccobjectCc recipients: one address or an array. Shown in the `Cc` header to every recipient.
Example: ["finance@example.com"]
bccobjectBcc recipients: one address or an array. Each gets the message; no header names them.
Example: ["audit@example.com"]
attachmentsarrayFiles to attach, and inline images (`content_id`). Up to 20 files and 10 MB in total after decoding (400 `MAIL_ATTACHMENT_TOO_LARGE`). Stored for the message log's 30 days and downloadable from `GET /emails/{id}/attachments/{position}`. We do not scan for viruses: executable files are refused by name, declared type and content (400 `MAIL_ATTACHMENT_TYPE_BLOCKED`), and archives are passed through unopened. Not accepted by the batch routes (400 `MAIL_ATTACHMENTS_NOT_IN_BATCH`).
to*objectRecipient: one address or an array. At most 50 recipients across `to`, `cc` and `bcc`.
Example: ["success@simulator.amazonses.com"]
subject*stringSubject line.
Example: "Your order 42"
Response · 202 Accepted; queued for delivery.
thread_id*string · uuidThe conversation the message was sent in.
email_id*string · uuidThe sent email (`GET /emails/{id}`); also its `messages[].id` in `GET /threads/{id}`.
subject*stringSubject it went out with.
Example: "Re: Refund for order 42"
to*arrayRecipients in the `To` header.
Example: ["alice@example.com"]
cc*arrayRecipients in the `Cc` header.
Example: []
Example
Request
POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/mailboxes/{id}/threads
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"html": "<p>Thanks, the refund is on its way.</p>",
"text": "Thanks, the refund is on its way.",
"cc": [
"finance@example.com"
],
"bcc": [
"audit@example.com"
],
"attachments": [
{
"filename": "invoice-1234.pdf",
"content": "JVBERi0xLjcKJcfsj6IKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c+PgplbmRvYmoK",
"path": "https://files.acme.com/invoices/1234.pdf",
"content_type": "application/pdf",
"content_id": "logo"
}
],
"to": [
"success@simulator.amazonses.com"
],
"subject": "Your order 42"
}Response
{
"thread_id": "00000000-0000-0000-0000-000000000000",
"email_id": "00000000-0000-0000-0000-000000000000",
"subject": "Re: Refund for order 42",
"to": [
"alice@example.com"
],
"cc": []
}