Skip to main content
POST
/
api
/
v1
/
emails
Send Email
curl --request POST \
  --url https://api.example.com/api/v1/emails \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": "<string>",
  "to": [
    "<string>"
  ],
  "subject": "<string>",
  "html": "<string>",
  "text": "<string>",
  "templateId": "<string>",
  "variables": {},
  "attachmentIds": [
    "<string>"
  ],
  "cc": [
    "<string>"
  ],
  "bcc": [
    "<string>"
  ],
  "replyTo": "<string>",
  "headers": {},
  "idempotencyKey": "<string>"
}
'
{
  "id": "<string>",
  "status": "<string>",
  "messageId": "<string>",
  "createdAt": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.mailbreeze.com/llms.txt

Use this file to discover all available pages before exploring further.

Send an email using raw content or a pre-built template.

Request Body

from
string
required
Sender email address. Must match a verified domain. Supports display name format: "Name" <email@domain.com>
to
string | string[]
required
Recipient email address(es). If array, all recipients see each other (single email, not batch).
subject
string
Email subject line (max 998 characters, no newlines). Required unless using a template.
html
string
HTML content of the email. Required if not using templateId.
text
string
Plain text fallback content.
templateId
string
Template ID to use instead of raw html/text. Subject comes from template unless overridden.
variables
object
Key-value pairs for template variable substitution ({{variable}}).
attachmentIds
string[]
IDs of attachments to include (from the attachments upload flow).
cc
string | string[]
CC recipients.
bcc
string | string[]
BCC recipients.
replyTo
string
Reply-to email address.
headers
object
Custom email headers to include.
idempotencyKey
string
Unique key to prevent duplicate sends. Valid for 24 hours, max 256 characters.

Content Options

You must provide content in one of two ways: Option 1: Direct Content
{
  "from": "hello@yourdomain.com",
  "to": "user@example.com",
  "subject": "Welcome!",
  "html": "<h1>Welcome!</h1>",
  "text": "Welcome!"
}
Option 2: Template
{
  "from": "hello@yourdomain.com",
  "to": "user@example.com",
  "templateId": "welcome-template",
  "variables": {
    "name": "John",
    "plan": "Pro"
  }
}

Examples

import { MailBreeze } from "mailbreeze";

const mailbreeze = new MailBreeze({ apiKey: "sk_live_xxx" });

// Send with direct content
const result = await mailbreeze.emails.send({
  from: "hello@yourdomain.com",
  to: "user@example.com",
  subject: "Welcome!",
  html: "<h1>Welcome to our platform!</h1>",
  text: "Welcome to our platform!",
});

console.log(result.id); // "msg_xxx"

// Send with template
const result = await mailbreeze.emails.send({
  from: "hello@yourdomain.com",
  to: "user@example.com",
  templateId: "welcome-template",
  variables: {
    name: "John",
    plan: "Pro",
  },
});

Response

id
string
Unique email ID.
status
string
Current status: queued, sent, delivered, bounced, or failed.
messageId
string
SMTP message ID.
createdAt
string
ISO 8601 timestamp when queued.
Success Response
{
  "success": true,
  "data": {
    "messageId": "ea296955-b253-424b-9bf4-761381e8dedc"
  },
  "meta": {
    "timestamp": "2025-12-27T13:36:06.342Z",
    "requestId": "e69b115b-21e5-4051-a0bf-550c39ad7c1a",
    "path": "/api/v1/emails"
  }
}

Test Mode Response

When using a test API key (sk_test_*), emails are simulated:
Sandbox Response
{
  "success": true,
  "data": {
    "sandbox": true,
    "messageId": "sandbox_abc123xyz",
    "message": "Email simulated (test mode) - no real email was sent",
    "recipients": ["user@example.com"]
  },
  "meta": {
    "timestamp": "2024-01-15T10:30:00.000Z",
    "requestId": "req_abc123",
    "path": "/api/v1/emails"
  }
}
SDKs automatically extract the data field, so you access result.messageId directly.

Errors

CodeDescription
DNS_VERIFICATION_FAILEDDomain DNS records not verified
DOMAIN_VALIDATION_FAILEDDomain not active or verified
FROM_DOMAIN_MISMATCHFrom address domain must match verified domain
TEMPLATE_NOT_FOUNDTemplate ID doesn’t exist
TEMPLATE_RENDER_ERRORTemplate variable substitution failed
ATTACHMENT_NOT_FOUNDAttachment ID doesn’t exist
ATTACHMENT_TOO_LARGEAttachment exceeds 10MB limit
EMAIL_TOO_LARGETotal email exceeds 10MB limit
SPAM_SCORE_TOO_HIGHContent flagged as spam
RECIPIENT_SUPPRESSEDRecipient is on suppression list