Get your API key
Sending email

Send API

One endpoint, one key. The same address that receives can send — transactional mail, replies, and broadcasts go out over your own authenticated domain, DKIM-signed and aligned so they land in the inbox.

Send a message

POST /v1/send with an API key. The from address must be on a verified domain. Pick your language — the choice is remembered across the docs.

send a message
import { MailKite } from "mailkite";

const mk = new MailKite(process.env.MAILKITE_API_KEY);

const { id, status } = await mk.send({
  from: "hello@myapp.ai",
  to: "ada@example.com",
  subject: "Your invoice #1042",
  html: "<p>Thanks! Receipt attached.</p>",
});
response
← 202 Accepted
{ "id": "msg_2Hk9…", "status": "queued" }

A 202 Accepted means the message was queued for delivery. Use the returned id to look it up later via the Messages API.

Request fields

FieldTypeNotes
fromstringRequired. An address on a verified domain.
tostring · arrayRequired. One address or a list.
subjectstringSubject line — required unless a template supplies it.
htmlstringHTML body. Provide html, text, or both.
textstringPlain-text body. Recommended alongside html.
templateIdstringSend a saved template — a user template (tpl_…) or base template (base_…); explicit subject/html/text override it.
templateDataobjectValues for the template's {{merge_tags}} (e.g. { "name": "Ann" }). HTML values are auto-escaped.
cc / bccstring · arrayOptional additional recipients.
replyTostringOptional Reply-To address.
attachmentsarrayEach: { filename, url } (fetched by us) or { filename, content } (base64).
inReplyTostringA threadId/Message-ID to reply in-thread.

Every snippet above is the official client library — same shape in Node, Python, PHP, Java, Go, and Ruby — or raw curl.

Replying in-thread

To reply to something you received, set inReplyTo to the inbound event's threadId. The reply threads correctly in the recipient's client:

reply.json
{
  "from": "support@myapp.ai",
  "to": "ada@example.com",
  "subject": "Re: invoice #1042",
  "text": "Approved — thanks!",
  "inReplyTo": "<a1b2c3@mail.example.com>"
}

Attachments

Attach files two ways:

  • By URL{ filename, url }. We fetch it at send time. Best for files you already host.
  • Inline{ filename, content, contentType } with base64 content. Best for small, generated files.

Deliverability

Outbound is DKIM-signed and SPF/DMARC-aligned automatically on your verified domain — there's nothing to configure beyond publishing your DNS records. Always send a text part alongside html, keep your from consistent, and warm new domains gradually for the best inbox placement.

See every parameter and response in the API reference.