Skip to main content
Hiveku offers three ways to send email. Use the SDK when you can, fall back to REST when you cannot, and use SMTP when you need to plug Hiveku into a third-party service that only speaks SMTP (Supabase Auth, Firebase Auth, WordPress, etc.).

Choose an integration

Email parameters

to
string | string[]
required
Recipient address(es). Pass a string for one recipient or an array for many.
from
string
required
Sender address. Must be on a verified domain. Supports friendly format: Acme <noreply@mail.acme.com>.
subject
string
required
Email subject line.
html
string
HTML body. At least one of html or text is required.
text
string
Plain-text body. Strongly recommended alongside html for deliverability.
cc
string | string[]
CC recipients.
bcc
string | string[]
BCC recipients.
reply_to
string | string[]
Reply-To address(es).
attachments
Attachment[]
File attachments. See Attachments below.
tags
string[]
Tags for filtering analytics and webhooks. Up to 10 tags per email.
headers
Record<string, string>
Custom headers (e.g., List-Unsubscribe).
template_id
string
Send with a template instead of raw html/text. See Templates.
variables
Record<string, unknown>
Variable values for the template.
scheduled_at
string (ISO 8601)
Schedule the send for a future time.
idempotency_key
string
Client-generated key to prevent duplicate sends on retry.

Batch sending

Send up to 100 emails in a single request with POST /v1/email/batch:
const { results } = await hiveku.emails.batch([
  {
    from: "noreply@mail.acme.com",
    to: "alice@example.com",
    subject: "Welcome, Alice",
    html: "<p>Hi Alice!</p>",
  },
  {
    from: "noreply@mail.acme.com",
    to: "bob@example.com",
    subject: "Welcome, Bob",
    html: "<p>Hi Bob!</p>",
  },
]);

for (const r of results) {
  console.log(r.messageId, r.status);
}
Each item in the batch is validated and enqueued independently — a failure on one item does not block the others.

Template sending

If you have a saved template, reference it by ID and pass variables:
await hiveku.emails.sendTemplate({
  template_id: "tmpl_order_shipped",
  from: "noreply@mail.acme.com",
  to: "customer@example.com",
  variables: {
    customer_name: "Sam",
    order_number: "1024",
    tracking_url: "https://acme.com/track/ABC123",
  },
});
REST endpoint: POST /v1/email/send-template.

Scheduled delivery

Schedule a send for a future time by passing an ISO 8601 scheduled_at:
await hiveku.emails.send({
  from: "noreply@mail.acme.com",
  to: "customer@example.com",
  subject: "Your trial ends tomorrow",
  html: "<p>Reminder!</p>",
  scheduled_at: "2026-04-18T15:00:00Z",
});
Scheduled emails can be canceled before their delivery window opens.

Attachments

Attachments are passed as base64-encoded content:
await hiveku.emails.send({
  from: "noreply@mail.acme.com",
  to: "customer@example.com",
  subject: "Your invoice",
  html: "<p>See attached.</p>",
  attachments: [
    {
      filename: "invoice-1024.pdf",
      content: pdfBuffer.toString("base64"),
      content_type: "application/pdf",
    },
  ],
});
Total message size (including all attachments) is capped at 40 MB.

Custom headers

Pass arbitrary headers via the headers field. Common uses:
await hiveku.emails.send({
  from: "newsletter@mail.acme.com",
  to: "subscriber@example.com",
  subject: "This week at Acme",
  html: "<p>News!</p>",
  headers: {
    "List-Unsubscribe": "<https://acme.com/unsub?u=42>, <mailto:unsub@acme.com>",
    "List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
  },
});

Tracking tags

Tags flow through to analytics, webhooks, and suppression filters. Use them to slice sends by feature, tenant, or campaign:
tags: ["password-reset", "tenant-42", "experiment-b"];

Idempotency

Pass an idempotency_key to make retries safe. If Hiveku receives the same key twice within 24 hours, the second request returns the original response without sending again.
await hiveku.emails.send({
  idempotency_key: `order-${orderId}-shipped`,
  from: "noreply@mail.acme.com",
  to: "customer@example.com",
  subject: "Your order shipped",
  html: "<p>On the way!</p>",
});

Response format

All send endpoints return a consistent shape:
{
  "messageId": "msg_01HPQRS...",
  "status": "queued",
  "scheduled_at": null,
  "created_at": "2026-04-17T12:34:56Z"
}
Track the message further via Webhooks or the dashboard logs.