Reference

Send a message

Send an email from the mailbox with POST /v1/messages. It returns 201 with the new message id. Set draft: true to save without sending.

TuskMail API: Send a message

Request

POST/v1/messages
NameTypeDescription
to(string | {email, name?})[]Recipients. Plain address strings or objects with an optional name.
cc, bccsame as toOptional. At most 100 recipients across to, cc and bcc.
subjectstringUp to 998 characters.
textstringPlain-text body.
htmlstringOptional HTML body. Send text as well for clients that do not render HTML.
reply_to_message_idstringReply to this message so it is threaded and the original is marked answered.
attachments{attachment_id}[]Up to 20 uploaded attachments. See Attachments.
draftbooleanSave as a draft instead of sending. Recipients are optional for drafts.

A sent message needs at least one recipient and at least one of subject, text or html. Header: Idempotency-Key (optional but recommended, see Idempotency).

curl -X POST "https://api.tuskmail.africa/v1/messages" \
  -H "X-API-Key: $TK_API_KEY" \
  -u "$MAILBOX_EMAIL:$APP_PASSWORD" \
  -H "Idempotency-Key: invoice-2041" \
  -H "Content-Type: application/json" \
  -d '{
  "to": [
    {
      "email": "[email protected]",
      "name": "Amina Wanjiru"
    }
  ],
  "cc": [
    "[email protected]"
  ],
  "subject": "Invoice 2041",
  "text": "Hello Amina, please find your invoice attached.",
  "html": "<p>Hello Amina, please find your invoice attached.</p>",
  "attachments": [
    {
      "attachment_id": "B987"
    }
  ]
}'
201 Created
{
  "id": "Mnew456",
  "sent": true
}

With draft: true the response is { "id": "...", "sent": false }.

Reply to a message

curl -X POST "https://api.tuskmail.africa/v1/messages" \
  -H "X-API-Key: $TK_API_KEY" \
  -u "$MAILBOX_EMAIL:$APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{
  "to": [
    "[email protected]"
  ],
  "subject": "Re: Quote request for Q4 deliveries",
  "text": "Thanks Amina, our rate card is attached.",
  "reply_to_message_id": "Mabc123"
}'

Limits and errors

Sends count toward the daily sending limit (Rate limits). Invalid addresses or missing fields return 422 validation_error naming the field.