Mail API reference

Mail API · Threads

post/v1/workspaces/{workspace_id}/threads/{id}/replyAuth

Reply to a message in a conversation

Sends from the thread's mailbox (`From: <display name> <mailbox address>`) to the answered message's `Reply-To`, else its sender; `reply_all` adds its `To` and `Cc`, minus this workspace's mailbox addresses. Sets `In-Reply-To` and `References` so the reply lands in the recipient's conversation, prefixes the subject with `Re: `, and quotes the original text under yours (`quote: false` to leave it out). The reply appears in the thread. Goes through the send path like `POST /emails`: limits, suppression, test addresses, attachments and the message log (`source: inbox_reply`). Needs `mail.send` on the mailbox.

Path parameters

workspace_id*string · uuid

Id of the workspace.

id*string · uuid

Thread id.

Headers

Idempotency-Keystring

Opaque 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

htmlstring

HTML 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>"

textstring

Plain-text body. At least one of `html` and `text`.

Example: "Thanks, the refund is on its way."

ccobject

Cc recipients: one address or an array. Shown in the `Cc` header to every recipient.

Example: ["finance@example.com"]

bccobject

Bcc recipients: one address or an array. Each gets the message; no header names them.

Example: ["audit@example.com"]

attachmentsarray

Files 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`).

message_id*string · uuid

The message you are answering: a received message of this thread (`messages[].id` with `direction: inbound`), or one sent in it (`direction: outbound`).

Example: "3f0a3c3e-6c1d-4b8e-9b7a-0d4b1c2e3f40"

reply_allboolean

Reply to everyone: the answered message's `To` and `Cc` are added to `cc`, minus every mailbox address of this workspace. At most 50 recipients in total. Default false: only the sender (its `Reply-To` when it has one).

quoteboolean

Quote the answered message under your reply (`On <date>, <sender> wrote:` and the original text). Default true. The quote is the original's text only: its HTML is never re-sent.

subjectstring

Subject override. Default: `Re: ` + the answered subject, unless it already reads as a reply.

Example: "Re: Refund for order 42"

Response · 202 Accepted; queued for delivery.

thread_id*string · uuid

The conversation the message was sent in.

email_id*string · uuid

The sent email (`GET /emails/{id}`); also its `messages[].id` in `GET /threads/{id}`.

subject*string

Subject it went out with.

Example: "Re: Refund for order 42"

to*array

Recipients in the `To` header.

Example: ["alice@example.com"]

cc*array

Recipients in the `Cc` header.

Example: []

Example

Request

POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/threads/{id}/reply
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"
    }
  ],
  "message_id": "3f0a3c3e-6c1d-4b8e-9b7a-0d4b1c2e3f40",
  "reply_all": false,
  "quote": false,
  "subject": "Re: Refund for 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": []
}