WWistfare Mail

Sending Emails

Send single and batch transactional emails with the Wistfare Mail API.

Send a Single Email

POST /api/v1/emails

Scope: emails:send

Request Body

FieldTypeRequiredDescription
fromstringYesSender email (must match verified domain)
tostring | string[]YesRecipient(s), max 50
subjectstringYesSubject line, max 998 chars
htmlstringNoHTML body
textstringNoPlain text body
ccstring | string[]NoCC recipients
bccstring | string[]NoBCC recipients
replyTostring | string[]NoReply-To address(es)
headersobjectNoCustom email headers
attachmentsarrayNoFile attachments, max 20
tagsobjectNoKey-value tags for tracking
scheduledAtstringNoISO 8601 date for delayed sending
templateIdstringNoTemplate ID to use
variablesobjectNoTemplate variable values

Attachments

Each attachment has:

FieldTypeRequiredDescription
filenamestringYesFile name
contentstringYesBase64-encoded content
contentTypestringNoMIME type (auto-detected if omitted)

Example

const { id } = await wm.emails.send({
  from: 'notifications@wistfare.com',
  to: ['user@example.com'],
  subject: 'Your order has shipped',
  html: `
    <h1>Order Shipped!</h1>
    <p>Your order #1234 is on its way.</p>
  `,
  tags: { orderId: '1234', type: 'shipping' },
})

Response

{ "id": "eml_a1b2c3d4e5f6..." }

Batch Send

POST /api/v1/emails/batch

Scope: emails:send

Send up to 100 emails in a single request.

const { ids } = await wm.emails.batchSend([
  {
    from: 'hello@wistfare.com',
    to: 'alice@example.com',
    subject: 'Welcome, Alice!',
    html: '<p>Welcome!</p>',
  },
  {
    from: 'hello@wistfare.com',
    to: 'bob@example.com',
    subject: 'Welcome, Bob!',
    html: '<p>Welcome!</p>',
  },
])
 
console.log(ids) // ['eml_xxx', 'eml_yyy']

Get Email Status

GET /api/v1/emails/:id

Scope: emails:read

const email = await wm.emails.get('eml_abc123')
console.log(email.status) // 'delivered' | 'bounced' | 'sent' | ...

Response

{
  "id": "eml_abc123",
  "status": "delivered",
  "from": "hello@wistfare.com",
  "to": ["user@example.com"],
  "subject": "Welcome!",
  "createdAt": "2026-03-28T12:00:00Z",
  "deliveredAt": "2026-03-28T12:00:01Z",
  "openedAt": "2026-03-28T14:30:00Z",
  "clickedAt": null,
  "bouncedAt": null
}

Email Statuses

StatusDescription
queuedEmail accepted, waiting to be sent
sendingBeing processed by mail engine
sentHanded off to recipient's mail server
deliveredConfirmed delivered to inbox
bouncedDelivery failed (hard or soft bounce)
failedSending error
complainedRecipient marked as spam

Cancel Scheduled Email

PATCH /api/v1/emails/:id/cancel

Cancel an email that was scheduled for future delivery.

await wm.emails.cancel('eml_abc123')

On this page